diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2023-03-07 21:33:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-07 21:33:00 +0100 |
commit | 9c4fbedb368d87c383f86ece309a2473e6b1e68a (patch) | |
tree | 013ee7b74b47620a2adb3d050f6ce6db2024bc26 | |
parent | 30e1759d51d54641e834d95cd1960f4d4dc9e7e9 (diff) | |
download | pylint-git-9c4fbedb368d87c383f86ece309a2473e6b1e68a.tar.gz |
Upgrade to astroid 2.15.0 (#8387)
Co-authored-by: Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>
-rw-r--r-- | doc/whatsnew/fragments/8387.feature | 3 | ||||
-rw-r--r-- | pylint/checkers/imports.py | 2 | ||||
-rw-r--r-- | pylint/checkers/typecheck.py | 2 | ||||
-rw-r--r-- | pylint/pyreverse/inspector.py | 12 | ||||
-rw-r--r-- | pylint/pyreverse/writer.py | 2 | ||||
-rw-r--r-- | pyproject.toml | 2 | ||||
-rw-r--r-- | requirements_test_min.txt | 2 |
7 files changed, 14 insertions, 11 deletions
diff --git a/doc/whatsnew/fragments/8387.feature b/doc/whatsnew/fragments/8387.feature new file mode 100644 index 000000000..2b4df0001 --- /dev/null +++ b/doc/whatsnew/fragments/8387.feature @@ -0,0 +1,3 @@ +pylint now supports ``TryStar`` nodes from Python 3.11 and should be fully compatible with Python 3.11. + +Closes #8387 diff --git a/pylint/checkers/imports.py b/pylint/checkers/imports.py index 7270ea368..ba526821a 100644 --- a/pylint/checkers/imports.py +++ b/pylint/checkers/imports.py @@ -891,7 +891,7 @@ class ImportsChecker(DeprecatedMixin, BaseChecker): 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 diff --git a/pylint/checkers/typecheck.py b/pylint/checkers/typecheck.py index 8448a0f13..e40113473 100644 --- a/pylint/checkers/typecheck.py +++ b/pylint/checkers/typecheck.py @@ -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() ) diff --git a/pylint/pyreverse/inspector.py b/pylint/pyreverse/inspector.py index 9150bbef3..cf22d7eb1 100644 --- a/pylint/pyreverse/inspector.py +++ b/pylint/pyreverse/inspector.py @@ -300,14 +300,14 @@ class Linker(IdGeneratorMixIn, utils.LocalsVisitor): 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 diff --git a/pylint/pyreverse/writer.py b/pylint/pyreverse/writer.py index 88e3d0535..3d0a4613a 100644 --- a/pylint/pyreverse/writer.py +++ b/pylint/pyreverse/writer.py @@ -136,7 +136,7 @@ class DiagramWriter: 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] diff --git a/pyproject.toml b/pyproject.toml index 1c8a915ac..333d2856e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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'", diff --git a/requirements_test_min.txt b/requirements_test_min.txt index 7328b2bf8..d3a76f096 100644 --- a/requirements_test_min.txt +++ b/requirements_test_min.txt @@ -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 |