diff --git a/astroid/helpers.py b/astroid/helpers.py index 9c370aa32..d7c04fe49 100644 --- a/astroid/helpers.py +++ b/astroid/helpers.py @@ -6,7 +6,6 @@ from __future__ import annotations -import warnings from collections.abc import Generator from astroid import bases, manager, nodes, objects, raw_building, util @@ -20,20 +19,7 @@ ) from astroid.nodes import scoped_nodes from astroid.typing import InferenceResult -from astroid.util import safe_infer as real_safe_infer - - -def safe_infer( - node: nodes.NodeNG | bases.Proxy | util.UninferableBase, - context: InferenceContext | None = None, -) -> InferenceResult | None: - # When removing, also remove the real_safe_infer alias - warnings.warn( - "Import safe_infer from astroid.util; this shim in astroid.helpers will be removed.", - DeprecationWarning, - stacklevel=2, - ) - return real_safe_infer(node, context=context) +from astroid.util import safe_infer def _build_proxy_class(cls_name: str, builtins: nodes.Module) -> nodes.ClassDef: @@ -177,7 +163,7 @@ def has_known_bases(klass, context: InferenceContext | None = None) -> bool: except AttributeError: pass for base in klass.bases: - result = real_safe_infer(base, context=context) + result = safe_infer(base, context=context) # TODO: check for A->B->A->B pattern in class structure too? if ( not isinstance(result, scoped_nodes.ClassDef) @@ -250,7 +236,7 @@ def object_len(node, context: InferenceContext | None = None): # pylint: disable=import-outside-toplevel; circular import from astroid.objects import FrozenSet - inferred_node = real_safe_infer(node, context=context) + inferred_node = safe_infer(node, context=context) # prevent self referential length calls from causing a recursion error # see https://github.com/pylint-dev/astroid/issues/777 diff --git a/astroid/nodes/node_classes.py b/astroid/nodes/node_classes.py index 1d16b747a..52d4d9d3c 100644 --- a/astroid/nodes/node_classes.py +++ b/astroid/nodes/node_classes.py @@ -968,7 +968,7 @@ def is_argument(self, name) -> bool: return True return self.find_argname(name)[1] is not None - def find_argname(self, argname, rec=DEPRECATED_ARGUMENT_DEFAULT): + def find_argname(self, argname): """Get the index and :class:`AssignName` node for given name. :param argname: The name of the argument to search for. @@ -977,12 +977,6 @@ def find_argname(self, argname, rec=DEPRECATED_ARGUMENT_DEFAULT): :returns: The index and node for the argument. :rtype: tuple(str or None, AssignName or None) """ - if rec != DEPRECATED_ARGUMENT_DEFAULT: # pragma: no cover - warnings.warn( - "The rec argument will be removed in astroid 3.1.", - DeprecationWarning, - stacklevel=2, - ) if self.arguments: index, argument = _find_arg(argname, self.arguments) if argument: diff --git a/astroid/util.py b/astroid/util.py index 510b81cc1..635f7050f 100644 --- a/astroid/util.py +++ b/astroid/util.py @@ -108,19 +108,6 @@ def __str__(self) -> str: return msg.format(self.op, self.left_type.name, self.right_type.name) -def _instancecheck(cls, other) -> bool: - wrapped = cls.__wrapped__ - other_cls = other.__class__ - is_instance_of = wrapped is other_cls or issubclass(other_cls, wrapped) - warnings.warn( - "%r is deprecated and slated for removal in astroid " - "2.0, use %r instead" % (cls.__class__.__name__, wrapped.__name__), - PendingDeprecationWarning, - stacklevel=2, - ) - return is_instance_of - - def check_warnings_filter() -> bool: """Return True if any other than the default DeprecationWarning filter is enabled.