diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2023-03-22 16:41:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-22 16:41:42 +0100 |
commit | 25406f7963769c658119b66d7dd7c966cf2f14db (patch) | |
tree | 60af0f30d215756eb41567af2921ca234ee10ac4 /pylint/checkers | |
parent | 1f2cf716a3e76d8f2a7429d6550460ce8038e6e6 (diff) | |
download | pylint-git-25406f7963769c658119b66d7dd7c966cf2f14db.tar.gz |
[deprecation] Remove duplicated utils typing guards check (#8475)
Diffstat (limited to 'pylint/checkers')
-rw-r--r-- | pylint/checkers/utils.py | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index c99c90457..503e5d419 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -12,7 +12,6 @@ import itertools import numbers import re import string -import warnings from collections import deque from collections.abc import Iterable, Iterator from functools import lru_cache, partial @@ -1792,48 +1791,6 @@ def is_sys_guard(node: nodes.If) -> bool: return False -def is_typing_guard(node: nodes.If) -> bool: - """Return True if IF stmt is a typing guard. - - >>> from typing import TYPE_CHECKING - >>> if TYPE_CHECKING: - >>> from xyz import a - """ - warnings.warn( - "This method will be removed in pylint 3.0; use in_type_checking_block() instead.", - DeprecationWarning, - stacklevel=2, - ) # pragma: no cover - return isinstance( - node.test, (nodes.Name, nodes.Attribute) - ) and node.test.as_string().endswith("TYPE_CHECKING") - - -def is_node_in_typing_guarded_import_block(node: nodes.NodeNG) -> bool: - """Return True if node is part for guarded `typing.TYPE_CHECKING` if block.""" - warnings.warn( - "This method will be removed in pylint 3.0; use in_type_checking_block() instead.", - DeprecationWarning, - stacklevel=2, - ) # pragma: no cover - return isinstance(node.parent, nodes.If) and is_typing_guard(node.parent) - - -def is_node_in_guarded_import_block(node: nodes.NodeNG) -> bool: - """Return True if node is part for guarded if block. - - I.e. `sys.version_info` or `typing.TYPE_CHECKING` - """ - warnings.warn( - "This method will be removed in pylint 3.0; use in_type_checking_block() instead.", - DeprecationWarning, - stacklevel=2, - ) # pragma: no cover - return isinstance(node.parent, nodes.If) and ( - is_sys_guard(node.parent) or is_typing_guard(node.parent) - ) - - def is_reassigned_after_current(node: nodes.NodeNG, varname: str) -> bool: """Check if the given variable name is reassigned in the same scope after the current node. |