Skip to content

Fix linting error in src/test_typing_extensions.py - #98

Merged
srittau merged 3 commits into
python:mainfrom
hegjon:lint-fix
Nov 25, 2022
Merged

srittau merged 3 commits into
python:mainfrom
hegjon:lint-fix

Conversation

@hegjon

@hegjon hegjon commented Nov 25, 2022

Copy link
Copy Markdown
Contributor

Before

typing_extensions on  main via 🐍 v3.10.8 took 2s
❯ ~/.local/bin/flake8 --config=.flake8-tests src/test_typing_extensions.py
src/test_typing_extensions.py:20:1: F401 'typing.Iterator' imported but unused

After

typing_extensions on  lint-fix [⇡] via 🐍 v3.10.8
❯ ~/.local/bin/flake8 --config=.flake8-tests src/test_typing_extensions.py

@hegjon hegjon changed the title Removed unused typing.Iterator import Removed unused typing.Iterator import from src/test_typing_extensions.py Nov 25, 2022
@AlexWaygood

AlexWaygood commented Nov 25, 2022 •

Copy link
Copy Markdown
Member

Can you convert uses in the file such as the following to PEP 526 syntax? It's not actually an unused import, it's just that flake8 v6 doesn't support type comments anymore:

base_it = range(10) # type: Iterator[int]

You can use https://github.com/ilevkivskyi/com2ann to automate the process.

@hegjon hegjon changed the title Removed unused typing.Iterator import from src/test_typing_extensions.py Fix linting error in src/test_typing_extensions.py Nov 25, 2022
@hegjon

hegjon commented Nov 25, 2022

Copy link
Copy Markdown
Contributor Author
typing_extensions on  lint-fix [⇡] via 🐍 v3.10.8 took 8s
❯ ~/.local/bin/flake8 --config=.flake8-tests src/test_typing_extensions.py

typing_extensions on  lint-fix [⇡] via 🐍 v3.10.8
❯ pytest
===================================== test session starts =====================================
platform linux -- Python 3.10.8, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/jonny/projects/typing_extensions
plugins: web3-5.29.0, forked-1.4.0, xdist-2.5.0, cov-4.0.0
collected 263 items

src/test_typing_extensions.py ......................................................... [ 21%]
....................................................................................... [ 54%]
.s................s.................................................................... [ 87%]
...................s.s..s.......                                                        [100%]

=============================== 258 passed, 5 skipped in 2.89s ================================

@srittau srittau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM

@srittau
srittau merged commit ad3966d into python:main Nov 25, 2022
@hegjon
hegjon deleted the lint-fix branch November 25, 2022 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants