Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typing flake8 #1560

Merged
merged 3 commits into from
Jun 21, 2022
Merged

fix typing flake8 #1560

merged 3 commits into from
Jun 21, 2022

Conversation

auvipy
Copy link
Member

@auvipy auvipy commented Jun 19, 2022

No description provided.

@auvipy
Copy link
Member Author

auvipy commented Jun 19, 2022

@Kludex aren't the pre-commit not recognizing future annotation imports? is it possible to configure CI?

@Kludex
Copy link
Contributor

Kludex commented Jun 19, 2022

I didn't understand the question. Based on what are you asking that? What is this PR doing exactly? 🤔

EDIT: Ah! You mean the pre-commit ci thing. Checking.

@Kludex
Copy link
Contributor

Kludex commented Jun 19, 2022

Need to add --py39-plus I guess? https://github.com/asottile/pyupgrade#pep-585-typing-rewrites

@Kludex
Copy link
Contributor

Kludex commented Jun 19, 2022

Hold on... I didn't get it. What's wrong with the changes on the pre-commit? 🤔 The previous type annotation was correct.

@auvipy
Copy link
Member Author

auvipy commented Jun 19, 2022

yes

@Kludex
Copy link
Contributor

Kludex commented Jun 19, 2022

By previous I mean that the current master branch has the right type annotation. 🤔

@auvipy
Copy link
Member Author

auvipy commented Jun 19, 2022

this was right what you are talking, 1a7b9c4 right?

@Kludex
Copy link
Contributor

Kludex commented Jun 19, 2022

I'm not understanding, sorry.

There are two commits on the matcher.py file:

I don't understand what triggered pre-commit CI for that file yesterday, but the annotation it provides is correct.

The replacement below is just fine:

-        self._matchers: Dict[str, MatcherFunction] = {}
-        self._default_matcher: Optional[MatcherFunction] = None
+        self._matchers: dict[str, MatcherFunction] = {}
+        self._default_matcher: MatcherFunction | None = None

The only problem is that types like Optional, Dict, etc. were not removed from this file.

You can use the dict notation instead of Dict and | (pipe) instead of Optional if you're using __future__.annotations.

@auvipy auvipy added this to the 5.3 milestone Jun 21, 2022
@lgtm-com
Copy link

lgtm-com bot commented Jun 21, 2022

This pull request fixes 1 alert when merging 6edc2b7 into e97223f - view on LGTM.com

fixed alerts:

  • 1 for Unused import

@auvipy auvipy merged commit 7b84679 into master Jun 21, 2022
@auvipy auvipy deleted the lint branch June 21, 2022 04:30
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.

2 participants