diff options
| author | dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> | 2022-12-27 00:13:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-27 00:13:13 +0100 |
| commit | a96e05bf73b6fbba8edf78aa9adde3e1faa16b66 (patch) | |
| tree | 9256f4b7f9756fcba52263036e087c19179d4aed /astroid | |
| parent | 3894c593f5266d8692b8b5b4ebe83c0c9ae4c946 (diff) | |
| download | astroid-git-a96e05bf73b6fbba8edf78aa9adde3e1faa16b66.tar.gz | |
Bump pylint from 2.15.8 to 2.15.9 (#1907)
Diffstat (limited to 'astroid')
| -rw-r--r-- | astroid/decorators.py | 5 | ||||
| -rw-r--r-- | astroid/interpreter/_import/spec.py | 11 | ||||
| -rw-r--r-- | astroid/nodes/as_string.py | 4 |
3 files changed, 9 insertions, 11 deletions
diff --git a/astroid/decorators.py b/astroid/decorators.py index 935d34cb..7ce157b9 100644 --- a/astroid/decorators.py +++ b/astroid/decorators.py @@ -189,7 +189,7 @@ if util.check_warnings_filter(): # noqa: C901 try: index = keys.index(arg) except ValueError: - raise Exception( + raise ValueError( f"Can't find argument '{arg}' for '{args[0].__class__.__qualname__}'" ) from None if ( @@ -237,13 +237,12 @@ if util.check_warnings_filter(): # noqa: C901 def deco(func: Callable[_P, _R]) -> Callable[_P, _R]: @functools.wraps(func) def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _R: - keys = list(inspect.signature(func).parameters.keys()) for arg, note in arguments.items(): try: index = keys.index(arg) except ValueError: - raise Exception( + raise ValueError( f"Can't find argument '{arg}' for '{args[0].__class__.__qualname__}'" ) from None if arg in kwargs or len(args) > index: diff --git a/astroid/interpreter/_import/spec.py b/astroid/interpreter/_import/spec.py index ce6d2416..05fec7ef 100644 --- a/astroid/interpreter/_import/spec.py +++ b/astroid/interpreter/_import/spec.py @@ -301,12 +301,11 @@ def _is_setuptools_namespace(location: pathlib.Path) -> bool: data = stream.read(4096) except OSError: return False - else: - extend_path = b"pkgutil" in data and b"extend_path" in data - declare_namespace = ( - b"pkg_resources" in data and b"declare_namespace(__name__)" in data - ) - return extend_path or declare_namespace + extend_path = b"pkgutil" in data and b"extend_path" in data + declare_namespace = ( + b"pkg_resources" in data and b"declare_namespace(__name__)" in data + ) + return extend_path or declare_namespace def _get_zipimporters() -> Iterator[tuple[str, zipimport.zipimporter]]: diff --git a/astroid/nodes/as_string.py b/astroid/nodes/as_string.py index ace70909..cbd5ee17 100644 --- a/astroid/nodes/as_string.py +++ b/astroid/nodes/as_string.py @@ -588,7 +588,7 @@ class AsStringVisitor: def visit_matchclass(self, node: MatchClass) -> str: """Return an astroid.MatchClass node as string.""" if node.cls is None: - raise Exception(f"{node} does not have a 'cls' node") + raise AssertionError(f"{node} does not have a 'cls' node") class_strings: list[str] = [] if node.patterns: class_strings.extend(p.accept(self) for p in node.patterns) @@ -617,7 +617,7 @@ class AsStringVisitor: def visit_matchor(self, node: MatchOr) -> str: """Return an astroid.MatchOr node as string.""" if node.patterns is None: - raise Exception(f"{node} does not have pattern nodes") + raise AssertionError(f"{node} does not have pattern nodes") return " | ".join(p.accept(self) for p in node.patterns) # These aren't for real AST nodes, but for inference objects. |
