From 0a042a8a42b7ade556b4eaf028bb2bc073227918 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Mon, 20 Dec 2021 15:33:31 +0100 Subject: Fix some typoes before adding typing for checker registering --- examples/custom.py | 10 +++------- pylint/checkers/classes/special_methods_checker.py | 2 +- pylint/checkers/refactoring/implicit_booleaness_checker.py | 2 +- pylint/interfaces.py | 14 +++++--------- tests/test_check_parallel.py | 8 ++++---- 5 files changed, 14 insertions(+), 22 deletions(-) diff --git a/examples/custom.py b/examples/custom.py index bd9797e2a..c7429f629 100644 --- a/examples/custom.py +++ b/examples/custom.py @@ -7,7 +7,7 @@ from pylint.interfaces import IAstroidChecker # This is our checker class. # Checkers should always inherit from `BaseChecker`. class MyAstroidChecker(BaseChecker): - """Add class member attributes to the class locals dictionary.""" + """Add class member attributes to the class local's dictionary.""" # This class variable defines the type of checker that we are implementing. # In this case, we are implementing an AST checker. @@ -31,8 +31,7 @@ class MyAstroidChecker(BaseChecker): options = ( # Each option definition has a name which is used on the command line # and in config files, and a dictionary of arguments - # (similar to those to those to - # argparse.ArgumentParser.add_argument). + # (similar to argparse.ArgumentParser.add_argument). ( "store-locals-indicator", { @@ -48,10 +47,7 @@ class MyAstroidChecker(BaseChecker): def visit_call(self, node: nodes.Call) -> None: """Called when a :class:`.nodes.Call` node is visited. - See :mod:`astroid` for the description of available nodes. - - :param node: The node to check. - """ + See :mod:`astroid` for the description of available nodes.""" if not ( isinstance(node.func, nodes.Attribute) and isinstance(node.func.expr, nodes.Name) diff --git a/pylint/checkers/classes/special_methods_checker.py b/pylint/checkers/classes/special_methods_checker.py index adfb7b3f1..51c52b3ae 100644 --- a/pylint/checkers/classes/special_methods_checker.py +++ b/pylint/checkers/classes/special_methods_checker.py @@ -25,7 +25,7 @@ def _safe_infer_call_result(node, caller, context=None): Safely infer the return value of a function. Returns None if inference failed or if there is some ambiguity (more than - one node has been inferred). Otherwise returns inferred value. + one node has been inferred). Otherwise, returns inferred value. """ try: inferit = node.infer_call_result(caller, context=context) diff --git a/pylint/checkers/refactoring/implicit_booleaness_checker.py b/pylint/checkers/refactoring/implicit_booleaness_checker.py index 02e5d8257..29277e3a2 100644 --- a/pylint/checkers/refactoring/implicit_booleaness_checker.py +++ b/pylint/checkers/refactoring/implicit_booleaness_checker.py @@ -149,7 +149,7 @@ class ImplicitBooleanessChecker(checkers.BaseChecker): node.left ) or utils.is_empty_dict_literal(node.left) - # Check both left hand side and right hand side for literals + # Check both left-hand side and right-hand side for literals for operator, comparator in node.ops: is_right_empty_literal = utils.is_base_container( comparator diff --git a/pylint/interfaces.py b/pylint/interfaces.py index eef47449c..8fd61589f 100644 --- a/pylint/interfaces.py +++ b/pylint/interfaces.py @@ -64,9 +64,7 @@ def implements( obj: "BaseChecker", interface: Union[Type["Interface"], Tuple[Type["Interface"], ...]], ) -> bool: - """Return whether the given object (maybe an instance or class) implements - the interface. - """ + """Does the given object (maybe an instance or class) implements the interface.""" kimplements = getattr(obj, "__implements__", ()) if not isinstance(kimplements, (list, tuple)): kimplements = (kimplements,) @@ -74,9 +72,7 @@ def implements( class IChecker(Interface): - """This is a base interface, not designed to be used elsewhere than for - sub interfaces definition. - """ + """Base interface, not to be used elsewhere than for sub interfaces definition.""" def open(self): """called before visiting project (i.e. set of modules)""" @@ -86,12 +82,12 @@ class IChecker(Interface): class IRawChecker(IChecker): - """interface for checker which need to parse the raw file""" + """Interface for checker which need to parse the raw file""" def process_module(self, node: nodes.Module) -> None: """process a module - the module's content is accessible via ``astroid.stream`` + The module's content is accessible via ``astroid.stream`` """ @@ -101,7 +97,7 @@ class ITokenChecker(IChecker): def process_tokens(self, tokens): """Process a module. - tokens is a list of all source code tokens in the file. + Tokens is a list of all source code tokens in the file. """ diff --git a/tests/test_check_parallel.py b/tests/test_check_parallel.py index d1b5a6489..01fc352dc 100644 --- a/tests/test_check_parallel.py +++ b/tests/test_check_parallel.py @@ -82,7 +82,7 @@ class ParallelTestChecker(BaseChecker, MapReduceMixin): On non-parallel builds: it works on all the files in a single run. - On parallel builds: lint.parallel calls ``open`` once per file. + On parallel builds: ``lint.parallel`` calls ``open`` once per file. So if files are treated by separate processes, no messages will be raised from the individual process, all messages will be raised @@ -274,7 +274,7 @@ class TestCheckParallel: """Tests original basic types of checker works as expected in -jN This means that a sequential checker should return the same data for a given - file-stream irrespective of whether its run in -j1 or -jN + file-stream irrespective of whether it's run in -j1 or -jN """ linter = PyLinter(reporter=Reporter()) @@ -443,7 +443,7 @@ class TestCheckParallel: file_infos = _gen_file_datas(num_files) - # Loop for single-proc and mult-proc so we can ensure the same linter-config + # Loop for single-proc and mult-proc, so we can ensure the same linter-config for do_single_proc in range(2): linter = PyLinter(reporter=Reporter()) @@ -515,7 +515,7 @@ class TestCheckParallel: # with the number of files. file_infos = _gen_file_datas(num_files) - # Loop for single-proc and mult-proc so we can ensure the same linter-config + # Loop for single-proc and mult-proc, so we can ensure the same linter-config for do_single_proc in range(2): linter = PyLinter(reporter=Reporter()) -- cgit v1.2.1