Skip to content

Commit

Permalink
Fix linting (#875)
Browse files Browse the repository at this point in the history
* Split linting into two steps
* Fix an overly long line
* Run linter with Python 3.9
* Ignore more errors in test linting
  • Loading branch information
srittau committed Aug 30, 2021
1 parent 6a6f807 commit 68e7cb7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
12 changes: 10 additions & 2 deletions .flake8-tests
Expand Up @@ -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
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Expand Up @@ -44,7 +44,7 @@ jobs:
pytest $PYTHONPATH
linting:
name: Run linting
name: Lint

runs-on: ubuntu-latest

Expand All @@ -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
4 changes: 3 additions & 1 deletion typing_extensions/src_py3/typing_extensions.py
Expand Up @@ -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.
Expand Down

0 comments on commit 68e7cb7

Please sign in to comment.