class documentation

A mixin implementing logic for checking deprecated symbols. A class implementing mixin must define "deprecated-method" Message.

Method check_deprecated_class Checks if the class is deprecated.
Method check_deprecated_class_in_call Checks if call the deprecated class.
Method check_deprecated_method Executes the checker for the given node.
Method check_deprecated_module Checks if the module is deprecated.
Method deprecated_arguments Callback returning the deprecated arguments of method/function.
Method deprecated_classes Callback returning the deprecated classes of module.
Method deprecated_decorators Callback returning the deprecated decorators.
Method deprecated_methods Callback returning the deprecated methods/functions.
Method deprecated_modules Callback returning the deprecated modules.
Method visit_call Called when a :class:`nodes.Call` node is visited.
Method visit_decorators Triggered when a decorator statement is seen.
Method visit_import Triggered when an import statement is seen.
Method visit_importfrom Triggered when a from statement is seen.
Constant DEPRECATED_ARGUMENT_MESSAGE Undocumented
Constant DEPRECATED_CLASS_MESSAGE Undocumented
Constant DEPRECATED_DECORATOR_MESSAGE Undocumented
Constant DEPRECATED_METHOD_MESSAGE Undocumented
Constant DEPRECATED_MODULE_MESSAGE Undocumented

Inherited from BaseChecker:

Method __eq__ Permit to assert Checkers are equal.
Method __gt__ Sorting of checkers.
Method __hash__ Make Checker hashable.
Method __init__ Checker instances should have the linter as argument.
Method __repr__ Undocumented
Method __str__ This might be incomplete because multiple classes inheriting BaseChecker can have the same name.
Method add_message Undocumented
Method check_consistency Check the consistency of msgid.
Method close Called after visiting project (i.e set of modules).
Method create_message_definition_from_tuple Undocumented
Method get_full_documentation Undocumented
Method get_map_data Undocumented
Method get_message_definition Undocumented
Method open Called before visiting project (i.e. set of modules).
Method reduce_map_data Undocumented
Class Variable enabled Undocumented
Class Variable msgs Undocumented
Class Variable options Options provided by this provider.
Class Variable reports Undocumented
Instance Variable linter Undocumented
Instance Variable name Name of the provider.
Property messages Undocumented

Inherited from _ArgumentsProvider (via BaseChecker):

Method get_option_def DEPRECATED: Return the dictionary defining an option given its name.
Method level.setter Undocumented
Method load_defaults DEPRECATED: Initialize the provider using default values.
Method option_attrname DEPRECATED: Get the config attribute corresponding to opt.
Method option_value DEPRECATED: Get the current value for the given option.
Method options_and_values DEPRECATED.
Method options_by_section DEPRECATED: Return an iterator on options grouped by section.
Method set_option DEPRECATED: Method called to set an option (registered in the options list).
Class Variable option_groups_descs Option groups of this provider and their descriptions.
Property config Undocumented
Property level Undocumented
Instance Variable _arguments_manager The manager that will parse and register any options provided.
Instance Variable _level Undocumented
def check_deprecated_class(self, node: nodes.NodeNG, mod_name: str, class_names: Iterable[str]): (source)

Checks if the class is deprecated.

def check_deprecated_class_in_call(self, node: nodes.Call): (source)

Checks if call the deprecated class.

def check_deprecated_method(self, node: nodes.Call, inferred: nodes.NodeNG): (source)

Executes the checker for the given node. This method should be called from the checker implementing this mixin.

def check_deprecated_module(self, node: nodes.Import, mod_path: str|None): (source)

Checks if the module is deprecated.

def deprecated_arguments(self, method: str) -> Iterable[tuple[int|None, str]]: (source)

Callback returning the deprecated arguments of method/function. Args: method (str): name of function/method checked for deprecated arguments Returns: collections.abc.Iterable in form: ((POSITION1, PARAM1), (POSITION2: PARAM2) ...) where * POSITIONX - position of deprecated argument PARAMX in function definition. If argument is keyword-only, POSITIONX should be None. * PARAMX - name of the deprecated argument. E.g. suppose function: .. code-block:: python def bar(arg1, arg2, arg3, arg4, arg5='spam') with deprecated arguments `arg2` and `arg4`. `deprecated_arguments` should return: .. code-block:: python ((1, 'arg2'), (3, 'arg4'))

def deprecated_classes(self, module: str) -> Iterable[str]: (source)

Callback returning the deprecated classes of module. Args: module (str): name of module checked for deprecated classes Returns: collections.abc.Container of deprecated class names.

def deprecated_decorators(self) -> Iterable[str]: (source)

Callback returning the deprecated decorators. Returns: collections.abc.Container of deprecated decorator names.

def deprecated_methods(self) -> Container[str]: (source)

Callback returning the deprecated methods/functions. Returns: collections.abc.Container of deprecated function/method names.

def deprecated_modules(self) -> Iterable[str]: (source)

Callback returning the deprecated modules. Returns: collections.abc.Container of deprecated module names.

@utils.only_required_for_messages('deprecated-method', 'deprecated-argument', 'deprecated-class')
def visit_call(self, node: nodes.Call): (source)

Called when a :class:`nodes.Call` node is visited.

@utils.only_required_for_messages('deprecated-decorator')
def visit_decorators(self, node: nodes.Decorators): (source)

Triggered when a decorator statement is seen.

@utils.only_required_for_messages('deprecated-module', 'deprecated-class')
def visit_import(self, node: nodes.Import): (source)

Triggered when an import statement is seen.

@utils.only_required_for_messages('deprecated-module', 'deprecated-class')
def visit_importfrom(self, node: nodes.ImportFrom): (source)

Triggered when a from statement is seen.

DEPRECATED_ARGUMENT_MESSAGE: dict[str, MessageDefinitionTuple] = (source)

Undocumented

Value
{'W4903': ('Using deprecated argument %s of method %s()',
           'deprecated-argument',
           'The argument is marked as deprecated and will be removed in the futu
re.',
           {'old_names': [('W1511', 'old-deprecated-argument')], 'shared': True}
)}
DEPRECATED_CLASS_MESSAGE: dict[str, MessageDefinitionTuple] = (source)

Undocumented

Value
{'W4904': ('Using deprecated class %s of module %s',
           'deprecated-class',
           'The class is marked as deprecated and will be removed in the future.'
,
           {'old_names': [('W1512', 'old-deprecated-class')], 'shared': True})}
DEPRECATED_DECORATOR_MESSAGE: dict[str, MessageDefinitionTuple] = (source)

Undocumented

Value
{'W4905': ('Using deprecated decorator %s()',
           'deprecated-decorator',
           'The decorator is marked as deprecated and will be removed in the fut
ure.',
           {'old_names': [('W1513', 'old-deprecated-decorator')],
            'shared': True})}
DEPRECATED_METHOD_MESSAGE: dict[str, MessageDefinitionTuple] = (source)

Undocumented

Value
{'W4902': ('Using deprecated method %s()',
           'deprecated-method',
           'The method is marked as deprecated and will be removed in the future
.',
           {'old_names': [('W1505', 'old-deprecated-method')], 'shared': True})}
DEPRECATED_MODULE_MESSAGE: dict[str, MessageDefinitionTuple] = (source)

Undocumented

Value
{'W4901': ('Deprecated module %r',
           'deprecated-module',
           'A module marked as deprecated is imported.',
           {'old_names': [('W0402', 'old-deprecated-module')], 'shared': True})}