Method: pylint.checkers.imports.ImportsChecker._check_misplaced_future
Calls: 657, Exceptions: 0, Paths: 4Back
Path 1: 606 calls (0.92)
ImportFrom (606)
1def _check_misplaced_future(self, node: nodes.ImportFrom) -> None:
2 basename = node.modname
3 if basename == "__future__":
4 # check if this is the first non-docstring statement in the module
5 prev = node.previous_sibling()
6 if prev:
7 # consecutive future statements are possible
8 if not (
9 isinstance(prev, nodes.ImportFrom) and prev.modname == "__future__"
10 ):
11 self.add_message("misplaced-future", node=node)
12 return
Path 2: 47 calls (0.07)
ImportFrom (47)
None (47)
1def _check_misplaced_future(self, node: nodes.ImportFrom) -> None:
2 basename = node.modname
3 if basename == "__future__":
4 # check if this is the first non-docstring statement in the module
5 prev = node.previous_sibling()
6 if prev:
7 # consecutive future statements are possible
8 if not (
9 isinstance(prev, nodes.ImportFrom) and prev.modname == "__future__"
10 ):
11 self.add_message("misplaced-future", node=node)
12 return
Path 3: 2 calls (0.0)
ImportFrom (2)
None (2)
1def _check_misplaced_future(self, node: nodes.ImportFrom) -> None:
2 basename = node.modname
3 if basename == "__future__":
4 # check if this is the first non-docstring statement in the module
5 prev = node.previous_sibling()
6 if prev:
7 # consecutive future statements are possible
8 if not (
9 isinstance(prev, nodes.ImportFrom) and prev.modname == "__future__"
10 ):
11 self.add_message("misplaced-future", node=node)
12 return
Path 4: 2 calls (0.0)
ImportFrom (2)
None (2)
1def _check_misplaced_future(self, node: nodes.ImportFrom) -> None:
2 basename = node.modname
3 if basename == "__future__":
4 # check if this is the first non-docstring statement in the module
5 prev = node.previous_sibling()
6 if prev:
7 # consecutive future statements are possible
8 if not (
9 isinstance(prev, nodes.ImportFrom) and prev.modname == "__future__"
10 ):
11 self.add_message("misplaced-future", node=node)
12 return