From 68e7cb7c90a1932e04fde6808a3ca9d3818fd64c Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Tue, 31 Aug 2021 00:06:04 +0200 Subject: [PATCH] Fix linting (#875) * Split linting into two steps * Fix an overly long line * Run linter with Python 3.9 * Ignore more errors in test linting --- .flake8-tests | 12 ++++++++++-- .github/workflows/ci.yml | 13 +++++++------ typing_extensions/src_py3/typing_extensions.py | 4 +++- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.flake8-tests b/.flake8-tests index 06b437dbf..6af938e1f 100644 --- a/.flake8-tests +++ b/.flake8-tests @@ -11,17 +11,25 @@ builtins = basestring, unicode max-line-length = 100 ignore = # temporary ignores until we sort it out + B017, + E302, + E303, E306, + E501, E701, E704, + F722, F811, + F821, + F841, + W503, # irrelevant plugins B3, - DW12 + DW12, # consistency with mypy W504 exclude = # This config is NOT for the main module. - setup.py + setup.py, python2/typing.py, src/typing.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e368d104..e09f89d41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: pytest $PYTHONPATH linting: - name: Run linting + name: Lint runs-on: ubuntu-latest @@ -54,14 +54,15 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: 3.9 - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r test-requirements.txt - - name: Run linting - run: | - flake8 - flake8 --config=.flake8-tests src/test_typing.py python2/test_typing.py typing_extensions/src_py2/test_typing_extensions.py typing_extensions/src_py3/test_typing_extensions.py + - name: Lint implementation + run: flake8 + + - name: Lint tests + run: flake8 --config=.flake8-tests src/test_typing.py python2/test_typing.py typing_extensions/src_py2/test_typing_extensions.py typing_extensions/src_py3/test_typing_extensions.py diff --git a/typing_extensions/src_py3/typing_extensions.py b/typing_extensions/src_py3/typing_extensions.py index f36bba372..184da0ad1 100644 --- a/typing_extensions/src_py3/typing_extensions.py +++ b/typing_extensions/src_py3/typing_extensions.py @@ -2428,7 +2428,9 @@ def __call__(self, *args, **kwargs): @property def __parameters__(self): - return tuple(tp for tp in self.__args__ if isinstance(tp, (TypeVar, ParamSpec))) + return tuple( + tp for tp in self.__args__ if isinstance(tp, (TypeVar, ParamSpec)) + ) if not PEP_560: # Only required in 3.6 and lower.