class documentation

class PrivateImportChecker(BaseChecker): (source)

View In Hierarchy

Undocumented

Static Method same_root_dir Does the node's file's path contain the base name of `import_mod_name`?
Method __init__ Checker instances should have the linter as argument.
Method visit_import Undocumented
Method visit_importfrom Undocumented
Class Variable msgs Undocumented
Class Variable name Name of the provider.
Instance Variable all_used_type_annotations Undocumented
Instance Variable populated_annotations Undocumented
Static Method _assignments_call_private_name Returns True if no assignments involve accessing `private_name`.
Static Method _name_is_private Returns true if the name exists, starts with `_`, and if len(name) > 4 it is not a dunder, i.e. it does not begin and end with two underscores.
Method _get_private_imports Returns the private names from input names by a simple string check.
Method _get_type_annotation_names Removes from names any names that are used as type annotations with no other illegal usages.
Method _populate_type_annotations Adds to `all_used_type_annotations` all names ever used as a type annotation in the node's (nested) scopes and whether they are only used as annotation.
Method _populate_type_annotations_annotation Handles the possibility of an annotation either being a Name, i.e. just type, or a Subscript e.g. `Optional[type]` or an Attribute, e.g. `pylint.lint.linter`.
Method _populate_type_annotations_function Adds all names used as type annotation in the arguments and return type of the function node into the dict `all_used_type_annotations`.

Inherited from BaseChecker:

Method __eq__ Permit to assert Checkers are equal.
Method __gt__ Sorting of checkers.
Method __hash__ Make Checker hashable.
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 options Options provided by this provider.
Class Variable reports Undocumented
Instance Variable linter Undocumented
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
@staticmethod
def same_root_dir(node: nodes.Import|nodes.ImportFrom, import_mod_name: str) -> bool: (source)

Does the node's file's path contain the base name of `import_mod_name`?

def __init__(self, linter: PyLinter): (source)

Checker instances should have the linter as argument.

@utils.only_required_for_messages('import-private-name')
def visit_import(self, node: nodes.Import): (source)

Undocumented

@utils.only_required_for_messages('import-private-name')
def visit_importfrom(self, node: nodes.ImportFrom): (source)

Undocumented

Name of the provider.

all_used_type_annotations: dict[str, bool] = (source)

Undocumented

populated_annotations: bool = (source)

Undocumented

@staticmethod
def _assignments_call_private_name(assignments: list[nodes.AnnAssign|nodes.Assign], private_name: str) -> bool: (source)

Returns True if no assignments involve accessing `private_name`.

@staticmethod
def _name_is_private(name: str) -> bool: (source)

Returns true if the name exists, starts with `_`, and if len(name) > 4 it is not a dunder, i.e. it does not begin and end with two underscores.

def _get_private_imports(self, names: list[str]) -> list[str]: (source)

Returns the private names from input names by a simple string check.

def _get_type_annotation_names(self, node: nodes.Import|nodes.ImportFrom, names: list[str]) -> list[str]: (source)

Removes from names any names that are used as type annotations with no other illegal usages.

def _populate_type_annotations(self, node: nodes.LocalsDictNodeNG, all_used_type_annotations: dict[str, bool]): (source)

Adds to `all_used_type_annotations` all names ever used as a type annotation in the node's (nested) scopes and whether they are only used as annotation.

def _populate_type_annotations_annotation(self, node: ((nodes.Attribute|nodes.Subscript)|nodes.Name)|None, all_used_type_annotations: dict[str, bool]) -> str|None: (source)

Handles the possibility of an annotation either being a Name, i.e. just type, or a Subscript e.g. `Optional[type]` or an Attribute, e.g. `pylint.lint.linter`.

def _populate_type_annotations_function(self, node: nodes.FunctionDef, all_used_type_annotations: dict[str, bool]): (source)

Adds all names used as type annotation in the arguments and return type of the function node into the dict `all_used_type_annotations`.