Method: pylint.utils.file_state.FileState._set_state_on_block_lines
Calls: 514242, Exceptions: 0, Paths: 5Back
Path 1: 259510 calls (0.5)
MessageDefinitionStore (259510)
Name (108642) Const (61526) AssignName (60325) Pass (9564) Arguments (6924) ImportFrom (3761) Import (3494) List (1196) Dict (1144) Break (893)
MessageDefinition (259510)
{1: False} (84445) {2: False} (60962) {3: False} (40320) {4: False} (18071) {} (10093) {5: False} (9001) {6: False} (6201) {7: False} (4155) {9: False...
1def _set_state_on_block_lines(
2 self,
3 msgs_store: MessageDefinitionStore,
4 node: nodes.NodeNG,
5 msg: MessageDefinition,
6 msg_state: dict[int, bool],
7 ) -> None:
8 """Recursively walk (depth first) AST to collect block level options
9 line numbers and set the state correctly.
10 """
11 for child in node.get_children():
12 self._set_state_on_block_lines(msgs_store, child, msg, msg_state)
13 # first child line number used to distinguish between disable
14 # which are the first child of scoped node with those defined later.
15 # For instance in the code below:
16 #
17 # 1. def meth8(self):
18 # 2. """test late disabling"""
19 # 3. pylint: disable=not-callable, useless-suppression
20 # 4. print(self.blip)
21 # 5. pylint: disable=no-member, useless-suppression
22 # 6. print(self.bla)
23 #
24 # E1102 should be disabled from line 1 to 6 while E1101 from line 5 to 6
25 #
26 # this is necessary to disable locally messages applying to class /
27 # function using their fromlineno
28 if (
29 isinstance(node, (nodes.Module, nodes.ClassDef, nodes.FunctionDef))
30 and node.body
31 ):
32 firstchildlineno = node.body[0].fromlineno
33 else:
34 firstchildlineno = node.tolineno
35 self._set_message_state_in_block(msg, msg_state, node, firstchildlineno)
Path 2: 215937 calls (0.42)
MessageDefinitionStore (215937)
Call (36838) Assign (22228) Attribute (20943) Expr (20858) Arguments (19146) Return (12126) If (9004) Compare (8771) Subscript (8377) Tuple (6544)
MessageDefinition (215937)
{1: False} (70690) {2: False} (50860) {3: False} (34315) {4: False} (15212) {} (8594) {5: False} (6836) {6: False} (5090) {7: False} (3146) {151: Fals...
1def _set_state_on_block_lines(
2 self,
3 msgs_store: MessageDefinitionStore,
4 node: nodes.NodeNG,
5 msg: MessageDefinition,
6 msg_state: dict[int, bool],
7 ) -> None:
8 """Recursively walk (depth first) AST to collect block level options
9 line numbers and set the state correctly.
10 """
11 for child in node.get_children():
12 self._set_state_on_block_lines(msgs_store, child, msg, msg_state)
13 # first child line number used to distinguish between disable
14 # which are the first child of scoped node with those defined later.
15 # For instance in the code below:
16 #
17 # 1. def meth8(self):
18 # 2. """test late disabling"""
19 # 3. pylint: disable=not-callable, useless-suppression
20 # 4. print(self.blip)
21 # 5. pylint: disable=no-member, useless-suppression
22 # 6. print(self.bla)
23 #
24 # E1102 should be disabled from line 1 to 6 while E1101 from line 5 to 6
25 #
26 # this is necessary to disable locally messages applying to class /
27 # function using their fromlineno
28 if (
29 isinstance(node, (nodes.Module, nodes.ClassDef, nodes.FunctionDef))
30 and node.body
31 ):
32 firstchildlineno = node.body[0].fromlineno
33 else:
34 firstchildlineno = node.tolineno
35 self._set_message_state_in_block(msg, msg_state, node, firstchildlineno)
Path 3: 37078 calls (0.07)
MessageDefinitionStore (37078)
FunctionDef (23336) ClassDef (9938) Module (3546) AsyncFunctionDef (258)
MessageDefinition (37078)
{1: False} (12002) {2: False} (7572) {3: False} (5899) {4: False} (3146) {5: False} (1420) {} (1331) {6: False} (806) {7: False} (550) {9: False} (293...
1def _set_state_on_block_lines(
2 self,
3 msgs_store: MessageDefinitionStore,
4 node: nodes.NodeNG,
5 msg: MessageDefinition,
6 msg_state: dict[int, bool],
7 ) -> None:
8 """Recursively walk (depth first) AST to collect block level options
9 line numbers and set the state correctly.
10 """
11 for child in node.get_children():
12 self._set_state_on_block_lines(msgs_store, child, msg, msg_state)
13 # first child line number used to distinguish between disable
14 # which are the first child of scoped node with those defined later.
15 # For instance in the code below:
16 #
17 # 1. def meth8(self):
18 # 2. """test late disabling"""
19 # 3. pylint: disable=not-callable, useless-suppression
20 # 4. print(self.blip)
21 # 5. pylint: disable=no-member, useless-suppression
22 # 6. print(self.bla)
23 #
24 # E1102 should be disabled from line 1 to 6 while E1101 from line 5 to 6
25 #
26 # this is necessary to disable locally messages applying to class /
27 # function using their fromlineno
28 if (
29 isinstance(node, (nodes.Module, nodes.ClassDef, nodes.FunctionDef))
30 and node.body
31 ):
32 firstchildlineno = node.body[0].fromlineno
33 else:
34 firstchildlineno = node.tolineno
35 self._set_message_state_in_block(msg, msg_state, node, firstchildlineno)
Path 4: 1389 calls (0.0)
MessageDefinitionStore (1389)
FunctionDef (1055) ClassDef (328) AsyncFunctionDef (6)
MessageDefinition (1389)
{2: False} (308) {1: False} (301) {3: False} (201) {4: False} (127) {5: False} (91) {} (89) {85: False} (36) {7: False} (34) {8: False} (27) {9: False...
1def _set_state_on_block_lines(
2 self,
3 msgs_store: MessageDefinitionStore,
4 node: nodes.NodeNG,
5 msg: MessageDefinition,
6 msg_state: dict[int, bool],
7 ) -> None:
8 """Recursively walk (depth first) AST to collect block level options
9 line numbers and set the state correctly.
10 """
11 for child in node.get_children():
12 self._set_state_on_block_lines(msgs_store, child, msg, msg_state)
13 # first child line number used to distinguish between disable
14 # which are the first child of scoped node with those defined later.
15 # For instance in the code below:
16 #
17 # 1. def meth8(self):
18 # 2. """test late disabling"""
19 # 3. pylint: disable=not-callable, useless-suppression
20 # 4. print(self.blip)
21 # 5. pylint: disable=no-member, useless-suppression
22 # 6. print(self.bla)
23 #
24 # E1102 should be disabled from line 1 to 6 while E1101 from line 5 to 6
25 #
26 # this is necessary to disable locally messages applying to class /
27 # function using their fromlineno
28 if (
29 isinstance(node, (nodes.Module, nodes.ClassDef, nodes.FunctionDef))
30 and node.body
31 ):
32 firstchildlineno = node.body[0].fromlineno
33 else:
34 firstchildlineno = node.tolineno
35 self._set_message_state_in_block(msg, msg_state, node, firstchildlineno)
Path 5: 328 calls (0.0)
MessageDefinitionStore (328)
ClassDef (326) Module (2)
MessageDefinition (328)
{1: False} (84) {2: False} (66) {3: False} (54) {4: False} (39) {85: False} (24) {} (13) {5: False} (9) {13: False} (3) {10: True} (3) {18: False} (3)...
1def _set_state_on_block_lines(
2 self,
3 msgs_store: MessageDefinitionStore,
4 node: nodes.NodeNG,
5 msg: MessageDefinition,
6 msg_state: dict[int, bool],
7 ) -> None:
8 """Recursively walk (depth first) AST to collect block level options
9 line numbers and set the state correctly.
10 """
11 for child in node.get_children():
12 self._set_state_on_block_lines(msgs_store, child, msg, msg_state)
13 # first child line number used to distinguish between disable
14 # which are the first child of scoped node with those defined later.
15 # For instance in the code below:
16 #
17 # 1. def meth8(self):
18 # 2. """test late disabling"""
19 # 3. pylint: disable=not-callable, useless-suppression
20 # 4. print(self.blip)
21 # 5. pylint: disable=no-member, useless-suppression
22 # 6. print(self.bla)
23 #
24 # E1102 should be disabled from line 1 to 6 while E1101 from line 5 to 6
25 #
26 # this is necessary to disable locally messages applying to class /
27 # function using their fromlineno
28 if (
29 isinstance(node, (nodes.Module, nodes.ClassDef, nodes.FunctionDef))
30 and node.body
31 ):
32 firstchildlineno = node.body[0].fromlineno
33 else:
34 firstchildlineno = node.tolineno
35 self._set_message_state_in_block(msg, msg_state, node, firstchildlineno)