Hello community, here is the log from the commit of package python-flake8-pyi for openSUSE:Factory checked in at 2019-03-10 09:37:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-flake8-pyi (Old) and /work/SRC/openSUSE:Factory/.python-flake8-pyi.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-flake8-pyi" Sun Mar 10 09:37:27 2019 rev:4 rq:682604 version:19.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-flake8-pyi/python-flake8-pyi.changes 2019-03-01 16:48:31.461774161 +0100 +++ /work/SRC/openSUSE:Factory/.python-flake8-pyi.new.28833/python-flake8-pyi.changes 2019-03-10 09:37:30.192145668 +0100 @@ -1,0 +2,9 @@ +Thu Mar 7 16:34:17 UTC 2019 - John Vandenberg <jay...@gmail.com> + +- Fix python base dependency to allow on Python 3.6 +- Make dependency on python-typing explicit +- Update to v19.3.0 + - Set pyflakes minimum dependency + - Blacken source + +------------------------------------------------------------------- Old: ---- flake8-pyi-19.2.0.tar.gz New: ---- flake8-pyi-19.3.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-flake8-pyi.spec ++++++ --- /var/tmp/diff_new_pack.CNAz4O/_old 2019-03-10 09:37:31.488145358 +0100 +++ /var/tmp/diff_new_pack.CNAz4O/_new 2019-03-10 09:37:31.492145357 +0100 @@ -19,7 +19,7 @@ %define skip_python2 1 %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-flake8-pyi -Version: 19.2.0 +Version: 19.3.0 Release: 0 Summary: A plugin for flake8 to enable linting .pyi files License: MIT @@ -27,18 +27,23 @@ Url: https://github.com/ambv/flake8-pyi Source: https://files.pythonhosted.org/packages/source/f/flake8-pyi/flake8-pyi-%{version}.tar.gz Source1: https://raw.githubusercontent.com/ambv/flake8-pyi/master/LICENSE -BuildRequires: %{python_module base > 3.6.0} +BuildRequires: %{python_module base >= 3.6.0} BuildRequires: %{python_module setuptools} BuildRequires: python-rpm-macros # SECTION test requirements BuildRequires: %{python_module attrs} BuildRequires: %{python_module flake8 >= 3.2.1} +BuildRequires: %{python_module pyflakes >= 2.1.1} # Use pytest directly to bypass setup.py test dependencies BuildRequires: %{python_module pytest} +BuildRequires: %{python_module typing} # /SECTION BuildRequires: fdupes Requires: python-attrs +Requires: python-base >= 3.6.0 Requires: python-flake8 >= 3.2.1 +Requires: python-pyflakes >= 2.1.1 +Requires: python-typing BuildArch: noarch %python_subpackages ++++++ flake8-pyi-19.2.0.tar.gz -> flake8-pyi-19.3.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-pyi-19.2.0/.flake8 new/flake8-pyi-19.3.0/.flake8 --- old/flake8-pyi-19.2.0/.flake8 2018-12-08 16:46:26.000000000 +0100 +++ new/flake8-pyi-19.3.0/.flake8 2019-02-24 02:10:45.000000000 +0100 @@ -1,7 +1,7 @@ # This is an example .flake8 config, used when developing flake8-pyi itself. [flake8] -ignore = E302, E501, E701, W503 +ignore = E302, E501, E701, W503, E203 max-line-length = 80 max-complexity = 12 select = B,C,E,F,W,Y,B9 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-pyi-19.2.0/PKG-INFO new/flake8-pyi-19.3.0/PKG-INFO --- old/flake8-pyi-19.2.0/PKG-INFO 2019-02-23 08:31:11.000000000 +0100 +++ new/flake8-pyi-19.3.0/PKG-INFO 2019-03-01 04:32:36.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: flake8-pyi -Version: 19.2.0 +Version: 19.3.0 Summary: A plugin for flake8 to enable linting .pyi files. Home-page: https://github.com/ambv/flake8-pyi Author: Łukasz Langa @@ -113,6 +113,11 @@ Change Log ---------- + 19.3.0 + ~~~~~~ + + * update pyflakes dependency + 19.2.0 ~~~~~~~ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-pyi-19.2.0/README.rst new/flake8-pyi-19.3.0/README.rst --- old/flake8-pyi-19.2.0/README.rst 2019-02-23 08:30:43.000000000 +0100 +++ new/flake8-pyi-19.3.0/README.rst 2019-03-01 04:31:08.000000000 +0100 @@ -105,6 +105,11 @@ Change Log ---------- +19.3.0 +~~~~~~ + +* update pyflakes dependency + 19.2.0 ~~~~~~~ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-pyi-19.2.0/flake8_pyi.egg-info/PKG-INFO new/flake8-pyi-19.3.0/flake8_pyi.egg-info/PKG-INFO --- old/flake8-pyi-19.2.0/flake8_pyi.egg-info/PKG-INFO 2019-02-23 08:31:11.000000000 +0100 +++ new/flake8-pyi-19.3.0/flake8_pyi.egg-info/PKG-INFO 2019-03-01 04:32:36.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: flake8-pyi -Version: 19.2.0 +Version: 19.3.0 Summary: A plugin for flake8 to enable linting .pyi files. Home-page: https://github.com/ambv/flake8-pyi Author: Łukasz Langa @@ -113,6 +113,11 @@ Change Log ---------- + 19.3.0 + ~~~~~~ + + * update pyflakes dependency + 19.2.0 ~~~~~~~ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-pyi-19.2.0/flake8_pyi.egg-info/requires.txt new/flake8-pyi-19.3.0/flake8_pyi.egg-info/requires.txt --- old/flake8-pyi-19.2.0/flake8_pyi.egg-info/requires.txt 2019-02-23 08:31:11.000000000 +0100 +++ new/flake8-pyi-19.3.0/flake8_pyi.egg-info/requires.txt 2019-03-01 04:32:36.000000000 +0100 @@ -1,2 +1,3 @@ -flake8<3.7.0,>=3.2.1 +flake8>=3.2.1 +pyflakes>=2.1.1 attrs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-pyi-19.2.0/pyi.py new/flake8-pyi-19.3.0/pyi.py --- old/flake8-pyi-19.2.0/pyi.py 2019-02-23 08:30:43.000000000 +0100 +++ new/flake8-pyi-19.3.0/pyi.py 2019-03-01 04:31:58.000000000 +0100 @@ -12,17 +12,14 @@ from pyflakes.checker import ModuleScope, ClassScope, FunctionScope from typing import Any, Iterable, NamedTuple, Optional, Type -__version__ = '19.2.0' +__version__ = "19.3.0" -LOG = logging.getLogger('flake8.pyi') +LOG = logging.getLogger("flake8.pyi") -Error = NamedTuple('Error', [ - ('lineno', int), - ('col', int), - ('message', str), - ('type', Type[Any]), -]) +Error = NamedTuple( + "Error", [("lineno", int), ("col", int), ("message", str), ("type", Type[Any])] +) class PyiAwareFlakesChecker(FlakesChecker): @@ -97,9 +94,11 @@ self.pushScope(ClassScope) # doctest does not process doctest within a doctest # classes within classes are processed. - if (self.withDoctest - and not self._in_doctest() - and not isinstance(self.scope, FunctionScope)): + if ( + self.withDoctest + and not self._in_doctest() + and not isinstance(self.scope, FunctionScope) + ): self.deferFunction(lambda: self.handleDoctests(node)) for stmt in node.body: self.handleNode(stmt, node) @@ -116,25 +115,25 @@ class PyiAwareFileChecker(checker.FileChecker): def run_check(self, plugin, **kwargs): - if self.filename == '-': + if self.filename == "-": filename = self.options.stdin_display_name else: filename = self.filename - if filename.endswith('.pyi') and plugin['plugin'] == FlakesChecker: + if filename.endswith(".pyi") and plugin["plugin"] == FlakesChecker: LOG.info( - 'Replacing FlakesChecker with PyiAwareFlakesChecker while ' - 'checking %r', + "Replacing FlakesChecker with PyiAwareFlakesChecker while " + "checking %r", filename, ) plugin = dict(plugin) - plugin['plugin'] = PyiAwareFlakesChecker + plugin["plugin"] = PyiAwareFlakesChecker return super().run_check(plugin, **kwargs) @attr.s class PyiVisitor(ast.NodeVisitor): - filename = attr.ib(default=Path('(none)')) + filename = attr.ib(default=Path("(none)")) errors = attr.ib(default=attr.Factory(list)) def visit_Assign(self, node: ast.Assign) -> None: @@ -142,12 +141,15 @@ private. """ self.generic_visit(node) - if isinstance(node.value, ast.Call) and isinstance(node.value.func, ast.Name) and \ - node.value.func.id == 'TypeVar': + if ( + isinstance(node.value, ast.Call) + and isinstance(node.value.func, ast.Name) + and node.value.func.id == "TypeVar" + ): for target in node.targets: - if isinstance(target, ast.Name) and not target.id.startswith('_'): + if isinstance(target, ast.Name) and not target.id.startswith("_"): # avoid catching AnyStr in typing (the only library TypeVar so far) - if not self.filename.name == 'typing.pyi': + if not self.filename.name == "typing.pyi": self.error(target, Y001) def visit_If(self, node: ast.If) -> None: @@ -170,10 +172,10 @@ if isinstance(node.left, ast.Subscript): self._check_subscript_version_check(node) elif isinstance(node.left, ast.Attribute): - if isinstance(node.left.value, ast.Name) and node.left.value.id == 'sys': - if node.left.attr == 'platform': + if isinstance(node.left.value, ast.Name) and node.left.value.id == "sys": + if node.left.attr == "platform": self._check_platform_check(node) - elif node.left.attr == 'version_info': + elif node.left.attr == "version_info": self._check_version_check(node) else: self.error(node, Y002) @@ -208,12 +210,19 @@ else: # extended slicing self.error(node, Y003) - self._check_version_check(node, must_be_single=must_be_single, - can_have_strict_equals=can_have_strict_equals) - - def _check_version_check(self, node: ast.Compare, *, - must_be_single: bool = False, - can_have_strict_equals: Optional[int] = None) -> None: + self._check_version_check( + node, + must_be_single=must_be_single, + can_have_strict_equals=can_have_strict_equals, + ) + + def _check_version_check( + self, + node: ast.Compare, + *, + must_be_single: bool = False, + can_have_strict_equals: Optional[int] = None + ) -> None: comparator = node.comparators[0] if must_be_single: if not isinstance(comparator, ast.Num) or not isinstance(comparator.n, int): @@ -248,7 +257,7 @@ if isinstance(comparator, ast.Str): # other values are possible but we don't need them right now # this protects against typos - if comparator.s not in ('linux', 'win32', 'cygwin', 'darwin'): + if comparator.s not in ("linux", "win32", "cygwin", "darwin"): self.error(node, Y008.format(platform=comparator.s)) else: self.error(node, Y007) @@ -259,7 +268,9 @@ # empty class body should contain "..." not "pass" if len(node.body) == 1: statement = node.body[0] - if isinstance(statement, ast.Expr) and isinstance(statement.value, ast.Ellipsis): + if isinstance(statement, ast.Expr) and isinstance( + statement.value, ast.Ellipsis + ): return elif isinstance(statement, ast.Pass): self.error(statement, Y009) @@ -270,7 +281,9 @@ if isinstance(statement, ast.Pass): self.error(statement, Y012) # "..." should not be used in non-empty class body - elif isinstance(statement, ast.Expr) and isinstance(statement.value, ast.Ellipsis): + elif isinstance(statement, ast.Expr) and isinstance( + statement.value, ast.Ellipsis + ): self.error(statement, Y013) def visit_FunctionDef(self, node: ast.FunctionDef) -> None: @@ -282,22 +295,26 @@ if isinstance(statement, ast.Pass): self.error(statement, Y009) continue - elif isinstance(statement, ast.Expr) and isinstance(statement.value, ast.Ellipsis): + elif isinstance(statement, ast.Expr) and isinstance( + statement.value, ast.Ellipsis + ): continue # allow "raise", a number of stubs have this if isinstance(statement, ast.Raise): continue # allow assignments in constructor for now # (though these should probably be changed) - if node.name == '__init__': + if node.name == "__init__": self.error(statement, Y090) continue self.error(statement, Y010) def visit_arguments(self, node: ast.arguments) -> None: self.generic_visit(node) - args = node.args[-len(node.defaults):] - for arg, default in chain(zip(args, node.defaults), zip(node.kwonlyargs, node.kw_defaults)): + args = node.args[-len(node.defaults) :] + for arg, default in chain( + zip(args, node.defaults), zip(node.kwonlyargs, node.kw_defaults) + ): if default is None: continue # keyword-only arg without a default if not isinstance(default, ast.Ellipsis): @@ -307,12 +324,7 @@ self.error(default, Y011) def error(self, node: ast.AST, message: str) -> None: - self.errors.append(Error( - node.lineno, - node.col_offset, - message, - PyiTreeChecker - )) + self.errors.append(Error(node.lineno, node.col_offset, message, PyiTreeChecker)) def run(self, tree: ast.AST) -> Iterable[Error]: self.errors.clear() @@ -322,16 +334,16 @@ @attr.s class PyiTreeChecker: - name = 'flake8-pyi' + name = "flake8-pyi" version = __version__ tree = attr.ib(default=None) - filename = attr.ib(default='(none)') + filename = attr.ib(default="(none)") options = attr.ib(default=None) def run(self): path = Path(self.filename) - if path.suffix == '.pyi': + if path.suffix == ".pyi": visitor = PyiVisitor(filename=path) for error in visitor.run(self.tree): if self.should_warn(error.message[:4]): @@ -341,15 +353,17 @@ def add_options(cls, parser): """This is brittle, there's multiple levels of caching of defaults.""" for option in parser.options: - if option.long_option_name == '--filename': - option.default = '*.py,*.pyi' - option.option_kwargs['default'] = option.default + if option.long_option_name == "--filename": + option.default = "*.py,*.pyi" + option.option_kwargs["default"] = option.default option.to_optparse().default = option.default parser.parser.defaults[option.dest] = option.default try: parser.add_option( - '--no-pyi-aware-file-checker', default=False, action='store_true', + "--no-pyi-aware-file-checker", + default=False, + action="store_true", parse_from_config=True, help="don't patch flake8 with .pyi-aware file checker", ) @@ -373,7 +387,7 @@ warnings. This function is a workaround for this behavior. Users should explicitly enable these warnings. """ - if code[:3] != 'Y09': + if code[:3] != "Y09": # Normal warnings are safe for emission. return True @@ -387,13 +401,15 @@ return False -Y001 = 'Y001 Name of private TypeVar must start with _' -Y002 = 'Y002 If test must be a simple comparison against sys.platform or sys.version_info' -Y003 = 'Y003 Unrecognized sys.version_info check' -Y004 = 'Y004 Version comparison must use only major and minor version' -Y005 = 'Y005 Version comparison must be against a length-{n} tuple' -Y006 = 'Y006 Use only < and >= for version comparisons' -Y007 = 'Y007 Unrecognized sys.platform check' +Y001 = "Y001 Name of private TypeVar must start with _" +Y002 = ( + "Y002 If test must be a simple comparison against sys.platform or sys.version_info" +) +Y003 = "Y003 Unrecognized sys.version_info check" +Y004 = "Y004 Version comparison must use only major and minor version" +Y005 = "Y005 Version comparison must be against a length-{n} tuple" +Y006 = "Y006 Use only < and >= for version comparisons" +Y007 = "Y007 Unrecognized sys.platform check" Y008 = 'Y008 Unrecognized platform "{platform}"' Y009 = 'Y009 Empty body should contain "...", not "pass"' Y010 = 'Y010 Function body must contain only "..."' @@ -401,6 +417,6 @@ Y012 = 'Y012 Class body must not contain "pass"' Y013 = 'Y013 Non-empty class body must not contain "..."' Y014 = 'Y014 Default values for arguments must be "..."' -Y090 = 'Y090 Use explicit attributes instead of assignments in __init__' +Y090 = "Y090 Use explicit attributes instead of assignments in __init__" DISABLED_BY_DEFAULT = [Y090] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-pyi-19.2.0/setup.py new/flake8-pyi-19.3.0/setup.py --- old/flake8-pyi-19.2.0/setup.py 2019-02-23 08:30:43.000000000 +0100 +++ new/flake8-pyi-19.3.0/setup.py 2019-03-01 04:31:08.000000000 +0100 @@ -11,49 +11,45 @@ current_dir = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(current_dir, 'README.rst'), encoding='utf8') as ld_file: +with open(os.path.join(current_dir, "README.rst"), encoding="utf8") as ld_file: long_description = ld_file.read() -_version_re = re.compile(r'__version__\s+=\s+(?P<version>.*)') +_version_re = re.compile(r"__version__\s+=\s+(?P<version>.*)") -with open(os.path.join(current_dir, 'pyi.py'), 'r') as f: - version = _version_re.search(f.read()).group('version') +with open(os.path.join(current_dir, "pyi.py"), "r") as f: + version = _version_re.search(f.read()).group("version") version = str(ast.literal_eval(version)) setup( - name='flake8-pyi', + name="flake8-pyi", version=version, description="A plugin for flake8 to enable linting .pyi files.", long_description=long_description, - keywords='flake8 pyi bugs pyflakes pylint linter qa', - author='Łukasz Langa', - author_email='luk...@langa.pl', - url='https://github.com/ambv/flake8-pyi', - license='MIT', - py_modules=['pyi'], + keywords="flake8 pyi bugs pyflakes pylint linter qa", + author="Łukasz Langa", + author_email="luk...@langa.pl", + url="https://github.com/ambv/flake8-pyi", + license="MIT", + py_modules=["pyi"], zip_safe=False, python_requires=">=3.6", - install_requires=['flake8 >= 3.2.1, < 3.7.0', 'attrs'], - test_suite='tests.test_pyi', + install_requires=["flake8 >= 3.2.1", "pyflakes >= 2.1.1", "attrs"], + test_suite="tests.test_pyi", classifiers=[ - 'Development Status :: 3 - Alpha', - 'Environment :: Console', - 'Framework :: Flake8', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Topic :: Software Development :: Libraries :: Python Modules', - 'Topic :: Software Development :: Quality Assurance', + "Development Status :: 3 - Alpha", + "Environment :: Console", + "Framework :: Flake8", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Software Development :: Quality Assurance", ], - entry_points={ - 'flake8.extension': [ - 'Y0 = pyi:PyiTreeChecker', - ], - }, + entry_points={"flake8.extension": ["Y0 = pyi:PyiTreeChecker"]}, ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-pyi-19.2.0/tests/test_pyi.py new/flake8-pyi-19.3.0/tests/test_pyi.py --- old/flake8-pyi-19.2.0/tests/test_pyi.py 2018-12-08 16:46:26.000000000 +0100 +++ new/flake8-pyi-19.3.0/tests/test_pyi.py 2019-02-24 02:07:16.000000000 +0100 @@ -9,33 +9,37 @@ class PyiTestCase(unittest.TestCase): maxDiff = None # type: int - def checkFile(self, filename: str, pyi_aware: bool, - extra_options: Sequence[str] = ()) -> Tuple[int, str, str]: + def checkFile( + self, filename: str, pyi_aware: bool, extra_options: Sequence[str] = () + ) -> Tuple[int, str, str]: file_path = Path(__file__).absolute().parent / filename - cmdline = ['flake8', '-j0', *extra_options, str(file_path)] + cmdline = ["flake8", "-j0", *extra_options, str(file_path)] if not pyi_aware: - cmdline.insert(-1, '--no-pyi-aware-file-checker') + cmdline.insert(-1, "--no-pyi-aware-file-checker") env = os.environ.copy() - env['PYTHONWARNINGS'] = 'ignore' + env["PYTHONWARNINGS"] = "ignore" proc = subprocess.run( - cmdline, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - timeout=60, - env=env, + cmdline, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=60, env=env ) - stdout_text = proc.stdout.decode('utf8') - stderr_text = proc.stderr.decode('utf8') + stdout_text = proc.stdout.decode("utf8") + stderr_text = proc.stderr.decode("utf8") return proc.returncode, stdout_text, stderr_text - def checkStdin(self, filename: str, pyi_aware: bool, - extra_options: Sequence[str] = ()) -> Tuple[int, str, str]: + def checkStdin( + self, filename: str, pyi_aware: bool, extra_options: Sequence[str] = () + ) -> Tuple[int, str, str]: file_path = Path(__file__).absolute().parent / filename - cmdline = ['flake8', '-j0', '--stdin-display-name=' + filename, *extra_options, '-'] + cmdline = [ + "flake8", + "-j0", + "--stdin-display-name=" + filename, + *extra_options, + "-", + ] if not pyi_aware: - cmdline.insert(-1, '--no-pyi-aware-file-checker') + cmdline.insert(-1, "--no-pyi-aware-file-checker") env = os.environ.copy() - env['PYTHONWARNINGS'] = 'ignore' + env["PYTHONWARNINGS"] = "ignore" proc = subprocess.run( cmdline, stdout=subprocess.PIPE, @@ -44,22 +48,31 @@ env=env, input=file_path.read_bytes(), ) - stdout_text = proc.stdout.decode('utf8') - stderr_text = proc.stderr.decode('utf8') + stdout_text = proc.stdout.decode("utf8") + stderr_text = proc.stderr.decode("utf8") return proc.returncode, stdout_text, stderr_text - def checkFileOutput(self, filename: str, *, pyi_aware: bool = True, - stdout_lines: Sequence[str] = (), stderr_lines: Sequence[str] = (), - extra_options: Sequence[str] = ()) -> None: + def checkFileOutput( + self, + filename: str, + *, + pyi_aware: bool = True, + stdout_lines: Sequence[str] = (), + stderr_lines: Sequence[str] = (), + extra_options: Sequence[str] = () + ) -> None: def check_output(returncode: int, stdout: str, stderr: str): expected_returncode = 1 if stdout else 0 - for (actual, expected_lines) in [(stderr, stderr_lines), (stdout, stdout_lines)]: - actual = '\n'.join( - line.split('/')[-1] for line in actual.split('\n') if line + for (actual, expected_lines) in [ + (stderr, stderr_lines), + (stdout, stdout_lines), + ]: + actual = "\n".join( + line.split("/")[-1] for line in actual.split("\n") if line ) - expected = '\n'.join( - '{filename}:{line}'.format(filename=filename, line=line) + expected = "\n".join( + "{filename}:{line}".format(filename=filename, line=line) for line in expected_lines ) self.assertMultiLineEqual(expected, actual) @@ -67,12 +80,18 @@ self.assertEqual(returncode, expected_returncode, stdout) with self.subTest(stdin=False): - check_output(*self.checkFile(filename, pyi_aware=pyi_aware, - extra_options=extra_options)) + check_output( + *self.checkFile( + filename, pyi_aware=pyi_aware, extra_options=extra_options + ) + ) with self.subTest(stdin=True): - check_output(*self.checkStdin(filename, pyi_aware=pyi_aware, - extra_options=extra_options)) + check_output( + *self.checkStdin( + filename, pyi_aware=pyi_aware, extra_options=extra_options + ) + ) def test_vanilla_flake8_not_clean_forward_refs(self) -> None: stdout_lines = ( @@ -85,62 +104,64 @@ # "22:12: F821 undefined name 'C'", "27:35: F821 undefined name 'C'", ) - self.checkFileOutput('forward_refs.pyi', pyi_aware=False, stdout_lines=stdout_lines) + self.checkFileOutput( + "forward_refs.pyi", pyi_aware=False, stdout_lines=stdout_lines + ) @unittest.skipIf(sys.version_info < (3, 6), "variable annotations used") def test_patched_flake8_clean_forward_refs(self) -> None: - self.checkFileOutput('forward_refs_annassign.pyi', pyi_aware=True, stdout_lines=()) + self.checkFileOutput( + "forward_refs_annassign.pyi", pyi_aware=True, stdout_lines=() + ) def test_vanilla_flake8_not_clean_del(self) -> None: stdout_lines = ("4:16: F821 undefined name 'EitherStr'",) - self.checkFileOutput('del.pyi', pyi_aware=False, stdout_lines=stdout_lines) + self.checkFileOutput("del.pyi", pyi_aware=False, stdout_lines=stdout_lines) def test_patched_flake8_clean_del(self) -> None: - self.checkFileOutput('del.pyi', pyi_aware=True, stdout_lines=()) + self.checkFileOutput("del.pyi", pyi_aware=True, stdout_lines=()) def test_typevar(self) -> None: - stdout_lines = ( - '3:1: Y001 Name of private TypeVar must start with _', - ) - self.checkFileOutput('typevar.pyi', stdout_lines=stdout_lines) + stdout_lines = ("3:1: Y001 Name of private TypeVar must start with _",) + self.checkFileOutput("typevar.pyi", stdout_lines=stdout_lines) def test_sys_platform(self) -> None: stdout_lines = ( - '3:4: Y007 Unrecognized sys.platform check', - '3:4: Y007 Unrecognized sys.platform check', - '6:4: Y007 Unrecognized sys.platform check', + "3:4: Y007 Unrecognized sys.platform check", + "3:4: Y007 Unrecognized sys.platform check", + "6:4: Y007 Unrecognized sys.platform check", '9:4: Y008 Unrecognized platform "linus"', ) - self.checkFileOutput('sysplatform.pyi', stdout_lines=stdout_lines) + self.checkFileOutput("sysplatform.pyi", stdout_lines=stdout_lines) def test_sys_versioninfo(self) -> None: stdout_lines = ( - '6:4: Y003 Unrecognized sys.version_info check', - '9:4: Y003 Unrecognized sys.version_info check', - '12:4: Y003 Unrecognized sys.version_info check', - '15:4: Y003 Unrecognized sys.version_info check', - '18:4: Y003 Unrecognized sys.version_info check', - '24:4: Y005 Version comparison must be against a length-1 tuple', - '30:4: Y005 Version comparison must be against a length-2 tuple', - '33:4: Y003 Unrecognized sys.version_info check', - '36:4: Y003 Unrecognized sys.version_info check', - '39:4: Y003 Unrecognized sys.version_info check', - '42:4: Y004 Version comparison must use only major and minor version', - '45:4: Y006 Use only < and >= for version comparisons', - '48:4: Y006 Use only < and >= for version comparisons', - '51:4: Y006 Use only < and >= for version comparisons', - '60:4: Y002 If test must be a simple comparison against sys.platform or sys.version_info', + "6:4: Y003 Unrecognized sys.version_info check", + "9:4: Y003 Unrecognized sys.version_info check", + "12:4: Y003 Unrecognized sys.version_info check", + "15:4: Y003 Unrecognized sys.version_info check", + "18:4: Y003 Unrecognized sys.version_info check", + "24:4: Y005 Version comparison must be against a length-1 tuple", + "30:4: Y005 Version comparison must be against a length-2 tuple", + "33:4: Y003 Unrecognized sys.version_info check", + "36:4: Y003 Unrecognized sys.version_info check", + "39:4: Y003 Unrecognized sys.version_info check", + "42:4: Y004 Version comparison must use only major and minor version", + "45:4: Y006 Use only < and >= for version comparisons", + "48:4: Y006 Use only < and >= for version comparisons", + "51:4: Y006 Use only < and >= for version comparisons", + "60:4: Y002 If test must be a simple comparison against sys.platform or sys.version_info", ) - self.checkFileOutput('sysversioninfo.pyi', stdout_lines=stdout_lines) + self.checkFileOutput("sysversioninfo.pyi", stdout_lines=stdout_lines) def test_comparisons(self) -> None: stdout_lines = ( - '3:4: Y002 If test must be a simple comparison against sys.platform or sys.version_info', - '6:4: Y002 If test must be a simple comparison against sys.platform or sys.version_info', - '9:4: Y002 If test must be a simple comparison against sys.platform or sys.version_info', - '12:4: Y002 If test must be a simple comparison against sys.platform or sys.version_info', + "3:4: Y002 If test must be a simple comparison against sys.platform or sys.version_info", + "6:4: Y002 If test must be a simple comparison against sys.platform or sys.version_info", + "9:4: Y002 If test must be a simple comparison against sys.platform or sys.version_info", + "12:4: Y002 If test must be a simple comparison against sys.platform or sys.version_info", ) - self.checkFileOutput('comparisons.pyi', stdout_lines=stdout_lines) + self.checkFileOutput("comparisons.pyi", stdout_lines=stdout_lines) def test_class_def(self) -> None: stdout_lines = ( @@ -150,7 +171,7 @@ '17:5: Y013 Non-empty class body must not contain "..."', '20:5: Y013 Non-empty class body must not contain "..."', ) - self.checkFileOutput('emptyclasses.pyi', stdout_lines=stdout_lines) + self.checkFileOutput("emptyclasses.pyi", stdout_lines=stdout_lines) def test_function_def(self) -> None: stdout_lines = ( @@ -158,16 +179,17 @@ '19:5: Y010 Function body must contain only "..."', '23:5: Y010 Function body must contain only "..."', ) - self.checkFileOutput('emptyfunctions.pyi', stdout_lines=stdout_lines) + self.checkFileOutput("emptyfunctions.pyi", stdout_lines=stdout_lines) def test_empty_init(self) -> None: # should have no output if it's not explicitly selected - self.checkFileOutput('emptyinit.pyi', stdout_lines=()) + self.checkFileOutput("emptyinit.pyi", stdout_lines=()) stdout_lines = ( - '3:9: Y090 Use explicit attributes instead of assignments in __init__', + "3:9: Y090 Use explicit attributes instead of assignments in __init__", + ) + self.checkFileOutput( + "emptyinit.pyi", stdout_lines=stdout_lines, extra_options=("--select=Y090",) ) - self.checkFileOutput('emptyinit.pyi', stdout_lines=stdout_lines, - extra_options=('--select=Y090',)) def test_defaults(self) -> None: stdout_lines = ( @@ -176,8 +198,8 @@ '9:10: Y014 Default values for arguments must be "..."', '13:20: Y011 Default values for typed arguments must be "..."', ) - self.checkFileOutput('defaults.pyi', stdout_lines=stdout_lines) + self.checkFileOutput("defaults.pyi", stdout_lines=stdout_lines) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main()