From ee589842439c51716fc1107dfc6f129e4a77693d Mon Sep 17 00:00:00 2001 From: Chad Dombrova Date: Wed, 21 Jun 2017 18:33:09 -0700 Subject: [PATCH] Merge / style fixes. --- mypy/plugin.py | 12 ++++++------ mypy/stubgen.py | 2 +- mypy/test/testparse.py | 7 ++++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/mypy/plugin.py b/mypy/plugin.py index 3038ef46dccf9..8955caeb125c9 100644 --- a/mypy/plugin.py +++ b/mypy/plugin.py @@ -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: diff --git a/mypy/stubgen.py b/mypy/stubgen.py index d010f4f4a3854..546c78129c7da 100644 --- a/mypy/stubgen.py +++ b/mypy/stubgen.py @@ -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: diff --git a/mypy/test/testparse.py b/mypy/test/testparse.py index b6aa25e21084a..14be44205bfd1 100644 --- a/mypy/test/testparse.py +++ b/mypy/test/testparse.py @@ -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 @@ -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