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

Update typing for Python 3.7 (1) #1555

Merged
merged 4 commits into from
May 12, 2022
Merged

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented May 12, 2022

Description

Part 1 of 3 to update the typing in astroid following the bump to Python 3.7.2

Part 1: Replace typing aliases for builtin types
Part 2: Replace typing aliases for collections.abc classes.
Part 3: Update py-version in pylintrc

@cdce8p cdce8p added the Maintenance Discussion or action around maintaining astroid or the dev workflow label May 12, 2022
@cdce8p cdce8p added this to the 2.12.0 milestone May 12, 2022
@coveralls
Copy link

coveralls commented May 12, 2022

Pull Request Test Coverage Report for Build 2316381986

  • 420 of 420 (100.0%) changed or added relevant lines in 33 files are covered.
  • 51 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.02%) to 91.707%

Files with Coverage Reduction New Missed Lines %
astroid/builder.py 8 95.31%
astroid/rebuilder.py 11 96.97%
astroid/brain/brain_gi.py 32 23.02%
Totals Coverage Status
Change from base Build 2315268094: 0.02%
Covered Lines: 9167
Relevant Lines: 9996

💛 - Coveralls

Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

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

I added a white line between imports and docstring whenever there originally was one.

Another approach would be to replace all on the __future__ imports with a white lines in front of it. Black should then remove those case where there are more than one line and we would have consitency across all files.

Rest LGTM!

astroid/brain/brain_builtin_inference.py Show resolved Hide resolved
astroid/brain/brain_namedtuple_enum.py Show resolved Hide resolved
astroid/filter_statements.py Show resolved Hide resolved
astroid/inference.py Show resolved Hide resolved
astroid/inference_tip.py Show resolved Hide resolved
@@ -310,7 +310,7 @@ mixin-class-rgx=.*Mix[Ii]n
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E0201 when accessed. Python regular
# expressions are accepted.
generated-members=REQUEST,acl_users,aq_parent,argparse.Namespace
generated-members=REQUEST,acl_users,aq_parent,argparse.Namespace,ast\.([mM]atch.*|pattern)
Copy link
Collaborator

Choose a reason for hiding this comment

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

? Shouldn't this be in a different PR/commit?

Copy link
Member Author

Choose a reason for hiding this comment

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

Need this to fix a no-member issue now that the string annotations are replaced with from __future__ import annotations, see pylint-dev/pylint#6594.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah! That explains it!

script/bump_changelog.py Show resolved Hide resolved
tests/unittest_brain.py Show resolved Hide resolved
tests/unittest_inference.py Show resolved Hide resolved
tests/unittest_nodes.py Show resolved Hide resolved
@cdce8p
Copy link
Member Author

cdce8p commented May 12, 2022

I added a white line between imports and docstring whenever there originally was one.

Added empty lines between every docstring and future import (in the changed files). There is an isort setting lines-before-imports. Unfortunately though it doesn't seem to work reliably for our use case. More promising is a black PR to make that the default behavior: psf/black#2996.

@cdce8p cdce8p merged commit d616f2b into pylint-dev:main May 12, 2022
@cdce8p cdce8p deleted the typing-update-1 branch May 12, 2022 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance Discussion or action around maintaining astroid or the dev workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants