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 misc type issues #1884

Merged
merged 6 commits into from
Nov 22, 2022
Merged

Conversation

nickdrozd
Copy link
Contributor

Description

Address some minor Mypy complaints.

Type of Changes

Type
βœ“ πŸ”¨ Refactoring

@@ -109,7 +109,7 @@ def _append_node(self, child: nodes.NodeNG) -> None:
# which uses the current class as a mixin or base class.
# It's rewritten in 2.0, so it makes no sense for now
# to spend development time on it.
self.body.append(child)
self.body.append(child) # type: ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some dynamic trickery happening here. From comment: # pylint: disable=no-member; depending by the class

Copy link
Collaborator

Choose a reason for hiding this comment

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

We should at least ignore a specific warning instead of the broader ignore.

@@ -75,5 +75,5 @@ def brainless_manager():
m.astroid_cache = {}
m._mod_file_cache = {}
m._transform = transforms.TransformVisitor()
m.extension_package_whitelist = {}
m.extension_package_whitelist = set()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Straightforward type error

@coveralls
Copy link

coveralls commented Nov 22, 2022

Pull Request Test Coverage Report for Build 3526908840

  • 5 of 5 (100.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 92.29%

Totals Coverage Status
Change from base Build 3524660578: 0.0%
Covered Lines: 9888
Relevant Lines: 10714

πŸ’› - Coveralls

@@ -636,13 +636,14 @@ def _infer_old_style_string_formatting(
TODO: Instead of returning Uninferable we should rely
on the call to '%' to see if the result is actually uninferable.
"""
values = None
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rather than assign and then reassign with a different type, just make sure the variable gets defined in all branches

@Pierre-Sassoulas Pierre-Sassoulas added the Maintenance Discussion or action around maintaining astroid or the dev workflow label Nov 22, 2022
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @nickdrozd !

astroid/interpreter/objectmodel.py Show resolved Hide resolved
@@ -109,7 +109,7 @@ def _append_node(self, child: nodes.NodeNG) -> None:
# which uses the current class as a mixin or base class.
# It's rewritten in 2.0, so it makes no sense for now
# to spend development time on it.
self.body.append(child)
self.body.append(child) # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should at least ignore a specific warning instead of the broader ignore.

@Pierre-Sassoulas Pierre-Sassoulas merged commit 396c5e1 into pylint-dev:main Nov 22, 2022
@nickdrozd nickdrozd deleted the type-errors branch November 22, 2022 22:12
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.

4 participants