Method: pylint.checkers.variables._find_frame_imports
Calls: 236, Exceptions: 0, Paths: 6Back
Path 1: 184 calls (0.78)
'args' (73) 'kwargs' (58) 'i' (7) 'self' (4) 'kw' (2) 'j' (2) 'n' (2) 'kwds' (2) 'parts' (2) 'next' (2)
FunctionDef (142) Lambda (24) ListComp (8) GeneratorExp (8) DictComp (2)
False (184)
1def _find_frame_imports(name: str, frame: nodes.LocalsDictNodeNG) -> bool:
2 """Detect imports in the frame, with the required *name*.
3
4 Such imports can be considered assignments if they are not globals.
5 Returns True if an import for the given name was found.
6 """
7 if name in _flattened_scope_names(frame.nodes_of_class(nodes.Global)):
8 return False
9
10 imports = frame.nodes_of_class((nodes.Import, nodes.ImportFrom))
11 for import_node in imports:
12 for import_name, import_alias in import_node.names:
13 # If the import uses an alias, check only that.
14 # Otherwise, check only the import name.
15 if import_alias:
16 if import_alias == name:
17 return True
18 elif import_name and import_name == name:
19 return True
20 return False
Path 2: 47 calls (0.2)
're' (9) 'error' (9) 'w0401_cycle' (2) 'argparse' (2) 'sys' (2) 'optparse' (2) 'unknown' (1) 'exit' (1) 'LocalException' (1) 'zlib' (1)
FunctionDef (47)
True (47)
1def _find_frame_imports(name: str, frame: nodes.LocalsDictNodeNG) -> bool:
2 """Detect imports in the frame, with the required *name*.
3
4 Such imports can be considered assignments if they are not globals.
5 Returns True if an import for the given name was found.
6 """
7 if name in _flattened_scope_names(frame.nodes_of_class(nodes.Global)):
8 return False
9
10 imports = frame.nodes_of_class((nodes.Import, nodes.ImportFrom))
11 for import_node in imports:
12 for import_name, import_alias in import_node.names:
13 # If the import uses an alias, check only that.
14 # Otherwise, check only the import name.
15 if import_alias:
16 if import_alias == name:
17 return True
18 elif import_name and import_name == name:
19 return True
20 return False
Path 3: 2 calls (0.01)
'ass' (1) 'plt' (1)
FunctionDef (2)
True (2)
1def _find_frame_imports(name: str, frame: nodes.LocalsDictNodeNG) -> bool:
2 """Detect imports in the frame, with the required *name*.
3
4 Such imports can be considered assignments if they are not globals.
5 Returns True if an import for the given name was found.
6 """
7 if name in _flattened_scope_names(frame.nodes_of_class(nodes.Global)):
8 return False
9
10 imports = frame.nodes_of_class((nodes.Import, nodes.ImportFrom))
11 for import_node in imports:
12 for import_name, import_alias in import_node.names:
13 # If the import uses an alias, check only that.
14 # Otherwise, check only the import name.
15 if import_alias:
16 if import_alias == name:
17 return True
18 elif import_name and import_name == name:
19 return True
20 return False
Path 4: 1 calls (0.0)
're' (1)
FunctionDef (1)
True (1)
1def _find_frame_imports(name: str, frame: nodes.LocalsDictNodeNG) -> bool:
2 """Detect imports in the frame, with the required *name*.
3
4 Such imports can be considered assignments if they are not globals.
5 Returns True if an import for the given name was found.
6 """
7 if name in _flattened_scope_names(frame.nodes_of_class(nodes.Global)):
8 return False
9
10 imports = frame.nodes_of_class((nodes.Import, nodes.ImportFrom))
11 for import_node in imports:
12 for import_name, import_alias in import_node.names:
13 # If the import uses an alias, check only that.
14 # Otherwise, check only the import name.
15 if import_alias:
16 if import_alias == name:
17 return True
18 elif import_name and import_name == name:
19 return True
20 return False
Path 5: 1 calls (0.0)
'pd' (1)
FunctionDef (1)
True (1)
1def _find_frame_imports(name: str, frame: nodes.LocalsDictNodeNG) -> bool:
2 """Detect imports in the frame, with the required *name*.
3
4 Such imports can be considered assignments if they are not globals.
5 Returns True if an import for the given name was found.
6 """
7 if name in _flattened_scope_names(frame.nodes_of_class(nodes.Global)):
8 return False
9
10 imports = frame.nodes_of_class((nodes.Import, nodes.ImportFrom))
11 for import_node in imports:
12 for import_name, import_alias in import_node.names:
13 # If the import uses an alias, check only that.
14 # Otherwise, check only the import name.
15 if import_alias:
16 if import_alias == name:
17 return True
18 elif import_name and import_name == name:
19 return True
20 return False
Path 6: 1 calls (0.0)
'time' (1)
FunctionDef (1)
False (1)
1def _find_frame_imports(name: str, frame: nodes.LocalsDictNodeNG) -> bool:
2 """Detect imports in the frame, with the required *name*.
3
4 Such imports can be considered assignments if they are not globals.
5 Returns True if an import for the given name was found.
6 """
7 if name in _flattened_scope_names(frame.nodes_of_class(nodes.Global)):
8 return False
9
10 imports = frame.nodes_of_class((nodes.Import, nodes.ImportFrom))
11 for import_node in imports:
12 for import_name, import_alias in import_node.names:
13 # If the import uses an alias, check only that.
14 # Otherwise, check only the import name.
15 if import_alias:
16 if import_alias == name:
17 return True
18 elif import_name and import_name == name:
19 return True
20 return False