Skip to content

Commit

Permalink
Merge / style fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
chadrik committed Jun 22, 2017
1 parent 7dac5be commit ee58984
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions mypy/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ def named_generic_type(self, name: str, args: List[Type]) -> Instance:
# arguments of the documented function; otherwise, an error will be raised.
DocstringParserContext = NamedTuple(
'DocstringParserContext', [
('docstring', str), # The docstring to be parsed
('line', int), # The line number where the docstring begins
('errors', 'Errors') # Errors object for reporting errors, warnings, and info
('docstring', str), # The docstring to be parsed
('line', int), # The line number where the docstring begins
('errors', 'Errors') # Errors object for reporting errors, warnings, and info
])

TypeMap = Dict[
str, # Argument name, or 'return' for return type.
Type # Corresponding type extracted from docstring
]
str, # Argument name, or 'return' for return type.
Type # Corresponding type extracted from docstring
]


class Plugin:
Expand Down
2 changes: 1 addition & 1 deletion mypy/stubgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def generate_stub(path: str, output_dir: str, _all_: Optional[List[str]] = None,
source = f.read()
options = MypyOptions()
options.python_version = pyversion
plugin = Plugin(pyversion)
plugin = Plugin(options)
try:
ast = mypy.parse.parse(source, fnam=path, errors=None, options=options, plugin=plugin)
except mypy.errors.CompileError as e:
Expand Down
7 changes: 4 additions & 3 deletions mypy/test/testparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_parser(testcase: DataDrivenTestCase) -> None:
fnam='main',
errors=None,
options=options,
plugin=Plugin(options.python_version))
plugin=Plugin(options))
a = str(n).split('\n')
except CompileError as e:
a = e.messages
Expand All @@ -70,8 +70,9 @@ def cases(self) -> List[DataDrivenTestCase]:
def test_parse_error(testcase: DataDrivenTestCase) -> None:
try:
# Compile temporary file. The test file contains non-ASCII characters.
parse(bytes('\n'.join(testcase.input), 'utf-8'), INPUT_FILE_NAME, None, Options(),
Plugin())
options = Options()
parse(bytes('\n'.join(testcase.input), 'utf-8'), INPUT_FILE_NAME, None, options,
Plugin(options))
raise AssertionFailure('No errors reported')
except CompileError as e:
# Verify that there was a compile error and that the error messages
Expand Down

0 comments on commit ee58984

Please sign in to comment.