8000 Allow overloads in source files, not just stubs by sixolet · Pull Request #2603 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Allow overloads in source files, not just stubs #2603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Mar 27, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Another theory about how to make windows paths work
  • Loading branch information
sixolet committed Feb 17, 2017
commit 95555e66f74d6e155a755840a47475a3bb24416c
1 change: 0 additions & 1 deletion mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3186,7 +3186,6 @@ def visit_func_def(self, func: FuncDef) -> None:
sem.function_stack.pop()

def visit_overloaded_func_def(self, func: OverloadedFuncDef) -> None:
# REFACTOR: Visit all bodies
kind = self.kind_by_scope()
if kind == GDEF:
self.sem.check_no_global(func.name(), func, True)
Expand Down
14 changes: 8 additions & 6 deletions mypy/test/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os.path
import os
import posixpath
import re
from os import remove, rmdir
import shutil
Expand All @@ -27,7 +28,10 @@ def parse_test_cases(
myunit and pytest codepaths -- if something looks redundant,
that's likely the reason.
"""

if native_sep:
join = os.path.join
else:
join = posixpath.join # type: ignore
if not include_path:
include_path = os.path.dirname(path)
with open(path, encoding='utf-8') as f:
Expand Down Expand Up @@ -57,7 +61,7 @@ def parse_test_cases(
# Record an extra file needed for the test case.
arg = p[i].arg
assert arg is not None
file_entry = (os.path.join(base_path, arg), '\n'.join(p[i].data))
file_entry = (join(base_path, arg), '\n'.join(p[i].data))
if p[i].id == 'file':
files.append(file_entry)
elif p[i].id == 'outfile':
Expand All @@ -66,14 +70,14 @@ def parse_test_cases(
# Use a custom source file for the std module.
arg = p[i].arg
assert arg is not None
mpath = os.path.join(os.path.dirname(path), arg)
mpath = join(os.path.dirname(path), arg)
if p[i].id == 'builtins':
fnam = 'builtins.pyi'
else:
# Python 2
fnam = '__builtin__.pyi'
with open(mpath) as f:
files.append((os.path.join(base_path, fnam), f.read()))
files.append((join(base_path, fnam), f.read()))
elif p[i].id == 'stale':
arg = p[i].arg
if arg is None:
Expand Down Expand Up @@ -119,8 +123,6 @@ def parse_test_cases(
input = expand_includes(p[i0].data, include_path)
expand_errors(input, tcout, 'main')
for file_path, contents in files:
if native_sep and os.path.sep == '\\':
file_path = fix_win_path(file_path)
expand_errors(contents.split('\n'), tcout, file_path)
lastline = p[i].line if i < len(p) else p[i - 1].line + 9999
tc = DataDrivenTestCase(p[i0].arg, input, tcout, tcout2, path,
Expand Down
0