From e73f7624be58caf03fb3c8248b1311dd21a32772 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Thu, 1 Apr 2021 06:45:31 +0200 Subject: Fix some typo and create better docstrings --- pylint/config/option_manager_mixin.py | 29 +++++++++++++++-------------- pylint/lint/pylinter.py | 14 +++++--------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/pylint/config/option_manager_mixin.py b/pylint/config/option_manager_mixin.py index 5ccdbb408..cd3849474 100644 --- a/pylint/config/option_manager_mixin.py +++ b/pylint/config/option_manager_mixin.py @@ -236,22 +236,24 @@ class OptionsManagerMixIn: provider.load_defaults() def read_config_file(self, config_file=None, verbose=None): - """read the configuration file but do not load it (i.e. dispatching - values to each options provider) - """ - helplevel = 1 - while helplevel <= self._maxlevel: - opt = "-".join(["long"] * helplevel) + "-help" + """Read the configuration file but do not load it (i.e. dispatching + values to each options provider)""" + help_level = 1 + while help_level <= self._maxlevel: + opt = "-".join(["long"] * help_level) + "-help" if opt in self._all_options: break # already processed - - helpfunc = functools.partial(self.helpfunc, level=helplevel) - helpmsg = "%s verbose help." % " ".join(["more"] * helplevel) - optdict = {"action": "callback", "callback": helpfunc, "help": helpmsg} + help_function = functools.partial(self.helpfunc, level=help_level) + help_msg = "%s verbose help." % " ".join(["more"] * help_level) + optdict = { + "action": "callback", + "callback": help_function, + "help": help_msg, + } provider = self.options_providers[0] self.add_optik_option(provider, self.cmdline_parser, opt, optdict) provider.options += ((opt, optdict),) - helplevel += 1 + help_level += 1 if config_file is None: config_file = self.config_file if config_file is not None: @@ -303,9 +305,8 @@ class OptionsManagerMixIn: print(msg, file=sys.stderr) def load_config_file(self): - """dispatch values previously read from a configuration file to each - options provider) - """ + """Dispatch values previously read from a configuration file to each + options provider)""" parser = self.cfgfile_parser for section in parser.sections(): for option, value in parser.items(section): diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py index 67431e14d..1fe6f96be 100644 --- a/pylint/lint/pylinter.py +++ b/pylint/lint/pylinter.py @@ -436,9 +436,8 @@ class PyLinter( ) def __init__(self, options=(), reporter=None, option_groups=(), pylintrc=None): - # some stuff has to be done before ancestors initialization... - # - # messages store / checkers / reporter / astroid manager + """Some stuff has to be done before ancestors initialization... + messages store / checkers / reporter / astroid manager""" self.msgs_store = MessageDefinitionStore() self.reporter = None self._reporter_name = None @@ -690,13 +689,11 @@ class PyLinter( print("") # block level option handling ############################################# - # # see func_block_disable_msg.py test case for expected behaviour def process_tokens(self, tokens): - """process tokens from the current module to search for module/block - level options - """ + """Process tokens from the current module to search for module/block level + options.""" control_pragmas = {"disable", "enable"} prev_line = None saw_newline = True @@ -715,7 +712,6 @@ class PyLinter( match = OPTION_PO.search(content) if match is None: continue - try: for pragma_repr in parse_pragma(match.group(2)): if pragma_repr.action in ("disable-all", "skip-file"): @@ -826,7 +822,7 @@ class PyLinter( :param str modname: The name of the module to be checked. :param str path: The full path to the source code of the module. - :param bool is_argument: Whetter the file is an argument to pylint or not. + :param bool is_argument: Whether the file is an argument to pylint or not. Files which respect this property are always checked, since the user requested it explicitly. :returns: True if the module should be checked. -- cgit v1.2.1