class ConsiderUsingAnyOrAllChecker(BaseChecker): (source)
Undocumented
Method | visit |
Undocumented |
Class Variable | msgs |
Undocumented |
Class Variable | name |
Name of the provider. |
Static Method | _assigned |
Detect boolean-assign, for-loop, re-assign, return pattern: |
Static Method | _build |
When a nodes.For node can be rewritten as an any/all statement, return a suggestion for that statement. |
Static Method | _if |
Detect for-loop, if-statement, return pattern: |
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 |
Undocumented |
Method | check |
Check the consistency of msgid. |
Method | close |
Called after visiting project (i.e set of modules). |
Method | create |
Undocumented |
Method | get |
Undocumented |
Method | get |
Undocumented |
Method | get |
Undocumented |
Method | open |
Called before visiting project (i.e. set of modules). |
Method | reduce |
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 |
DEPRECATED: Return the dictionary defining an option given its name. |
Method | level |
Undocumented |
Method | load |
DEPRECATED: Initialize the provider using default values. |
Method | option |
DEPRECATED: Get the config attribute corresponding to opt. |
Method | option |
DEPRECATED: Get the current value for the given option. |
Method | options |
DEPRECATED. |
Method | options |
DEPRECATED: Return an iterator on options grouped by section. |
Method | set |
DEPRECATED: Method called to set an option (registered in the options list). |
Class Variable | option |
Option groups of this provider and their descriptions. |
Property | config |
Undocumented |
Property | level |
Undocumented |
Instance Variable | _arguments |
The manager that will parse and register any options provided. |
Instance Variable | _level |
Undocumented |
def visit_for(self, node:
nodes.For
):
(source)
¶
Undocumented
def _assigned_reassigned_returned(node:
nodes.For
, if_children: list[ nodes.NodeNG]
, node_after_loop: nodes.NodeNG
) -> bool
:
(source)
¶
Detect boolean-assign, for-loop, re-assign, return pattern: Ex: def check_lines(lines, max_chars): long_line = False for line in lines: if len(line) > max_chars: long_line = True # no elif / else statement return long_line
def _build_suggested_string(node:
nodes.For
, final_return_bool: bool
) -> str
:
(source)
¶
When a nodes.For node can be rewritten as an any/all statement, return a suggestion for that statement. 'final_return_bool' is the boolean literal returned after the for loop if all conditions fail.
def _if_statement_returns_bool(if_children:
list[ nodes.NodeNG]
, node_after_loop: nodes.NodeNG
) -> bool
:
(source)
¶
Detect for-loop, if-statement, return pattern: Ex: def any_uneven(items): for item in items: if not item % 2 == 0: return True return False