Skip to content

Commit 49b2c77

Browse files
committed
Fixed up docstrings
1 parent eb488dd commit 49b2c77

File tree

1 file changed

+49
-30
lines changed

1 file changed

+49
-30
lines changed

pylint/config.py

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,11 @@ def save_results(results, base):
7777

7878
def find_pylintrc_in(search_dir):
7979
"""Find a pylintrc file in the given directory.
80+
8081
:param search_dir: The directory to search.
8182
:type search_dir: str
82-
:returns: The path to the pylintrc file, if found.
83-
Otherwise None.
83+
84+
:returns: The path to the pylintrc file, if found. Otherwise None.
8485
:rtype: str or None
8586
"""
8687
path = None
@@ -96,8 +97,10 @@ def find_pylintrc_in(search_dir):
9697

9798
def find_nearby_pylintrc(search_dir=''):
9899
"""Search for the nearest pylint rc file.
100+
99101
:param search_dir: The directory to search.
100102
:type search_dir: str
103+
101104
:returns: The absolute path to the pylintrc file, if found.
102105
Otherwise None
103106
:rtype: str or None
@@ -121,8 +124,8 @@ def find_nearby_pylintrc(search_dir=''):
121124

122125
def find_global_pylintrc():
123126
"""Search for the global pylintrc file.
124-
:returns: The absolute path to the pylintrc file, if found.
125-
Otherwise None.
127+
128+
:returns: The absolute path to the pylintrc file, if found. Otherwise None.
126129
:rtype: str or None
127130
"""
128131
pylintrc = None
@@ -149,8 +152,8 @@ def find_pylintrc():
149152
- The current user's home directory
150153
- The `.config` folder in the current user's home directory
151154
- /etc/pylintrc
152-
:returns: The path to the pylintrc file,
153-
or None if one was not found.
155+
156+
:returns: The path to the pylintrc file, or None if one was not found.
154157
:rtype: str or None
155158
"""
156159
# TODO: Find nearby pylintrc files as well
@@ -717,6 +720,7 @@ def __iadd__(self, other):
717720
class ConfigurationStore(object):
718721
def __init__(self, global_config):
719722
"""A class to store configuration objects for many paths.
723+
720724
:param global_config: The global configuration object.
721725
:type global_config: Configuration
722726
"""
@@ -727,6 +731,7 @@ def __init__(self, global_config):
727731

728732
def add_config_for(self, path, config):
729733
"""Add a configuration object to the store.
734+
730735
:param path: The path to add the config for.
731736
:type path: str
732737
:param config: The config object for the given path.
@@ -740,8 +745,10 @@ def add_config_for(self, path, config):
740745

741746
def _get_parent_configs(self, path):
742747
"""Get the config objects for all parent directories.
748+
743749
:param path: The absolute path to get the parent configs for.
744750
:type path: str
751+
745752
:returns: The config objects for all parent directories.
746753
:rtype: generator(Configuration)
747754
"""
@@ -756,8 +763,10 @@ def get_config_for(self, path):
756763
"""Get the configuration object for a file or directory.
757764
This will merge the global config with all of the config objects from
758765
the root directory to the given path.
766+
759767
:param path: The file or directory to the get configuration object for.
760768
:type path: str
769+
761770
:returns: The configuration object for the given file or directory.
762771
:rtype: Configuration
763772
"""
@@ -811,9 +820,11 @@ def add_option_definition(self, option_definition):
811820
@abc.abstractmethod
812821
def parse(self, to_parse, config):
813822
"""Parse the given object into the config object.
814-
Args:
815-
to_parse (object): The object to parse.
816-
config (Configuration): The config object to parse into.
823+
824+
:param to_parse: The object to parse.
825+
:type to_parse: object
826+
:param config: The config object to parse into.
827+
:type config: Configuration
817828
"""
818829

819830

@@ -851,16 +862,16 @@ def add_option_definitions(self, option_definitions):
851862
def _convert_definition(option, definition):
852863
"""Convert an option definition to a set of arguments for add_argument.
853864
854-
Args:
855-
option (str): The name of the option
856-
definition (dict): The argument definition to convert.
865+
:param option: The name of the option
866+
:type option: str
867+
:param definition: The argument definition to convert.
868+
:type definition: dict
857869
858-
Returns:
859-
tuple(str, list, dict): A tuple of the group to add the argument to,
870+
:returns: A tuple of the group to add the argument to,
860871
plus the args and kwargs for :func:`ArgumentParser.add_argument`.
872+
:rtype: tuple(str, list, dict)
861873
862-
Raises:
863-
Exception: When the definition is invalid.
874+
:raises ConfigurationError: When the definition is invalid.
864875
"""
865876
args = []
866877

@@ -897,20 +908,24 @@ def _convert_definition(option, definition):
897908

898909
def parse(self, argv, config):
899910
"""Parse the command line arguments into the given config object.
900-
Args:
901-
argv (list(str)): The command line arguments to parse.
902-
config (Configuration): The config object to parse
903-
the command line into.
911+
912+
:param argv: The command line arguments to parse.
913+
:type argv: list(str)
914+
:param config: The config object to parse the command line into.
915+
:type config: Configuration
904916
"""
905917
self._parser.parse_args(argv, config)
906918

907919
def preprocess(self, argv, *options):
908920
"""Do some guess work to get a value for the specified option.
909-
Args:
910-
argv (list(str)): The command line arguments to parse.
911-
*options (str): The names of the options to look for.
912-
Returns:
913-
Configuration: A config with the processed options.
921+
922+
:param argv: The command line arguments to parse.
923+
:type argv: list(str)
924+
:param options: The names of the options to look for.
925+
:type options: str
926+
927+
:returns: A config with the processed options.
928+
:rtype: Configuration
914929
"""
915930
config = Config()
916931
config.add_options(self._option_definitions)
@@ -955,9 +970,13 @@ def add_option_definitions(self, option_definitions):
955970
def _convert_definition(option, definition):
956971
"""Convert an option definition to a set of arguments for the parser.
957972
958-
Args:
959-
option (str): The name of the option.
960-
definition (dict): The argument definition to convert.
973+
:param option: The name of the option.
974+
:type option: str
975+
:param definition: The argument definition to convert.
976+
:type definition: dict
977+
978+
:returns: The converted definition.
979+
:rtype: tuple(str, dict)
961980
"""
962981
default = {option: definition.get('default')}
963982

@@ -1072,8 +1091,8 @@ def add_argument(self, *args, **kwargs):
10721091
10731092
Patches in the level to each created action instance.
10741093
1075-
Returns:
1076-
argparse.Action: The created action.
1094+
:returns: The created action.
1095+
:rtype: argparse.Action
10771096
"""
10781097
level = kwargs.pop('level', 0)
10791098
action = super(LongHelpArgumentParser, self).add_argument(*args, **kwargs)

0 commit comments

Comments
 (0)