Skip to content

Commit 9c4fbed

Browse files
Upgrade to astroid 2.15.0 (#8387)
Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
1 parent 30e1759 commit 9c4fbed

File tree

7 files changed

+14
-11
lines changed

7 files changed

+14
-11
lines changed

doc/whatsnew/fragments/8387.feature

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pylint now supports ``TryStar`` nodes from Python 3.11 and should be fully compatible with Python 3.11.
2+
3+
Closes #8387

pylint/checkers/imports.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ def _add_imported_module(self, node: ImportNode, importedmodname: str) -> None:
891891
if context_name == importedmodname:
892892
self.add_message("import-self", node=node)
893893

894-
elif not astroid.modutils.is_standard_module(importedmodname):
894+
elif not astroid.modutils.is_stdlib_module(importedmodname):
895895
# if this is not a package __init__ module
896896
if base != "__init__" and context_name not in self._module_pkg:
897897
# record the module's parent, or the module itself if this is

pylint/checkers/typecheck.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ def _infer_from_metaclass_constructor(
790790
def _is_c_extension(module_node: InferenceResult) -> bool:
791791
return (
792792
isinstance(module_node, nodes.Module)
793-
and not astroid.modutils.is_standard_module(module_node.name)
793+
and not astroid.modutils.is_stdlib_module(module_node.name)
794794
and not module_node.fully_defined()
795795
)
796796

pylint/pyreverse/inspector.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -300,14 +300,14 @@ def visit_importfrom(self, node: nodes.ImportFrom) -> None:
300300
if fullname != basename:
301301
self._imported_module(node, fullname, relative)
302302

303-
def compute_module(self, context_name: str, mod_path: str) -> int:
304-
"""Return true if the module should be added to dependencies."""
303+
def compute_module(self, context_name: str, mod_path: str) -> bool:
304+
"""Should the module be added to dependencies ?"""
305305
package_dir = os.path.dirname(self.project.path)
306306
if context_name == mod_path:
307-
return 0
308-
if astroid.modutils.is_standard_module(mod_path, (package_dir,)):
309-
return 1
310-
return 0
307+
return False
308+
# astroid does return a boolean but is not typed correctly yet
309+
310+
return astroid.modutils.module_in_path(mod_path, (package_dir,)) # type: ignore[no-any-return]
311311

312312
def _imported_module(
313313
self, node: nodes.Import | nodes.ImportFrom, mod_path: str, relative: bool

pylint/pyreverse/writer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def get_class_properties(self, obj: ClassEntity) -> NodeProperties:
136136
def get_shape_color(self, obj: DiagramEntity) -> str:
137137
"""Get shape color."""
138138
qualified_name = obj.node.qname()
139-
if modutils.is_standard_module(qualified_name.split(".", maxsplit=1)[0]):
139+
if modutils.is_stdlib_module(qualified_name.split(".", maxsplit=1)[0]):
140140
return "grey"
141141
if isinstance(obj.node, nodes.ClassDef):
142142
package = qualified_name.rsplit(".", maxsplit=2)[0]

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ dependencies = [
3939
# Also upgrade requirements_test_min.txt.
4040
# Pinned to dev of second minor update to allow editable installs and fix primer issues,
4141
# see https://github.com/PyCQA/astroid/issues/1341
42-
"astroid>=2.14.2,<=2.16.0-dev0",
42+
"astroid>=2.15.0,<=2.17.0-dev0",
4343
"isort>=4.2.5,<6",
4444
"mccabe>=0.6,<0.8",
4545
"tomli>=1.1.0;python_version<'3.11'",

requirements_test_min.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-e .[testutils,spelling]
22
# astroid dependency is also defined in pyproject.toml
3-
astroid==2.14.2 # Pinned to a specific version for tests
3+
astroid==2.15.0 # Pinned to a specific version for tests
44
typing-extensions~=4.5
55
py~=1.11.0
66
pytest~=7.2

0 commit comments

Comments
 (0)