Skip to content

Commit

Permalink
Upgrade to astroid 2.15.0 (#8387)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniël van Noord <[email protected]>
  • Loading branch information
Pierre-Sassoulas and DanielNoord authored Mar 7, 2023
1 parent 30e1759 commit 9c4fbed
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/8387.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pylint now supports ``TryStar`` nodes from Python 3.11 and should be fully compatible with Python 3.11.

Closes #8387
2 changes: 1 addition & 1 deletion pylint/checkers/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ def _add_imported_module(self, node: ImportNode, importedmodname: str) -> None:
if context_name == importedmodname:
self.add_message("import-self", node=node)

elif not astroid.modutils.is_standard_module(importedmodname):
elif not astroid.modutils.is_stdlib_module(importedmodname):
# if this is not a package __init__ module
if base != "__init__" and context_name not in self._module_pkg:
# record the module's parent, or the module itself if this is
Expand Down
2 changes: 1 addition & 1 deletion pylint/checkers/typecheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ def _infer_from_metaclass_constructor(
def _is_c_extension(module_node: InferenceResult) -> bool:
return (
isinstance(module_node, nodes.Module)
and not astroid.modutils.is_standard_module(module_node.name)
and not astroid.modutils.is_stdlib_module(module_node.name)
and not module_node.fully_defined()
)

Expand Down
12 changes: 6 additions & 6 deletions pylint/pyreverse/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,14 @@ def visit_importfrom(self, node: nodes.ImportFrom) -> None:
if fullname != basename:
self._imported_module(node, fullname, relative)

def compute_module(self, context_name: str, mod_path: str) -> int:
"""Return true if the module should be added to dependencies."""
def compute_module(self, context_name: str, mod_path: str) -> bool:
"""Should the module be added to dependencies ?"""
package_dir = os.path.dirname(self.project.path)
if context_name == mod_path:
return 0
if astroid.modutils.is_standard_module(mod_path, (package_dir,)):
return 1
return 0
return False
# astroid does return a boolean but is not typed correctly yet

return astroid.modutils.module_in_path(mod_path, (package_dir,)) # type: ignore[no-any-return]

def _imported_module(
self, node: nodes.Import | nodes.ImportFrom, mod_path: str, relative: bool
Expand Down
2 changes: 1 addition & 1 deletion pylint/pyreverse/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def get_class_properties(self, obj: ClassEntity) -> NodeProperties:
def get_shape_color(self, obj: DiagramEntity) -> str:
"""Get shape color."""
qualified_name = obj.node.qname()
if modutils.is_standard_module(qualified_name.split(".", maxsplit=1)[0]):
if modutils.is_stdlib_module(qualified_name.split(".", maxsplit=1)[0]):
return "grey"
if isinstance(obj.node, nodes.ClassDef):
package = qualified_name.rsplit(".", maxsplit=2)[0]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies = [
# Also upgrade requirements_test_min.txt.
# Pinned to dev of second minor update to allow editable installs and fix primer issues,
# see https://github.com/PyCQA/astroid/issues/1341
"astroid>=2.14.2,<=2.16.0-dev0",
"astroid>=2.15.0,<=2.17.0-dev0",
"isort>=4.2.5,<6",
"mccabe>=0.6,<0.8",
"tomli>=1.1.0;python_version<'3.11'",
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_min.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-e .[testutils,spelling]
# astroid dependency is also defined in pyproject.toml
astroid==2.14.2 # Pinned to a specific version for tests
astroid==2.15.0 # Pinned to a specific version for tests
typing-extensions~=4.5
py~=1.11.0
pytest~=7.2
Expand Down

0 comments on commit 9c4fbed

Please sign in to comment.