pydocstyle and flake8 fixes
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Joshua Storck · committed by Joshua Storck · parent 73f470e · Browse files · 1 file·+30 added−18 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+30 added−18 removed
- other:+30 added−18 removed
Provenance
- Commit
64bbbe4- Tree
a889420- Author
Joshua Storck <joshua.storck@twosigma.com>- Committer
Joshua Storck <joshua.storck@twosigma.com>- Parent
73f470e
1 file changed+30 added−18 removed
modified:click/core.py+30 added-18 removed
128 unmodified lines129 130 return sorted(declaration_order, key=sort_key)131 132 class ParameterSource(object):133+ """This is an enum that indicates the source of a command line option.134+135+ The enum has one of the following values: COMMANDLINE,136+ ENVIRONMENT, DEFAULT, DEFAULT_MAP. The DEFAULT indicates that the137+ default value in the decorator was used. This class should be138+ converted to an enum when Python 2 support is dropped.139 """134- This is an enum that indicates the source of a command line option,135- which is one of the following: COMMANDLINE, ENVIRONMENT, DEFAULT, DEFAULT_MAP.136- The DEFAULT indicates that the default value in the decorator was used.137- This class should be converted to an enum when Python 2 support is138- dropped.139- """140+141 COMMANDLINE = "COMMANDLINE"142 ENVIRONMENT = "ENVIRONMENT"143 DEFAULT = "DEFAULT"144 DEFAULT_MAP = "DEFAULT_MAP"1 unmodified line146 VALUES = [COMMANDLINE, ENVIRONMENT, DEFAULT, DEFAULT_MAP]147 148 @classmethod149 def validate(clz, value):150+ """Validate that the specified value is a valid enum.151+152+ This method will raise a ValueError if the value is153+ not a valid enum.154+155+ :param clz: ParameterSource.class156+ :param value: the string value to verify157+ """158 if value not in clz.VALUES:159 raise ValueError("Invalid ParameterSource value: '{}'. Valid "160 "values are: {}".format(",".join(VALUES)))161 441 unmodified lines603 604 return self.invoke(cmd, **kwargs)605 606 def set_parameter_source(self, name, source):598- """Sets the `source` of a parameter. This indicates the 599- location from which the value of the parameter was obtained.607+ """Set the source of a parameter.608 609+ This indicates the location from which the value of the610+ parameter was obtained.611+612 :param name: the name of the command line parameter602- :param source: the source of the the command line parameter,603- which should be a valid ParameterSource value613+ :param source: the source of the command line parameter, which614+ should be a valid ParameterSource value615 """616 ParameterSource.validate(source)617 self._parameter_sources[name] = source618 619 def get_parameter_source(self, name):609- """Get the `source` of a parameter. This indicates the 610- location from which the value of the parameter was obtained.611- This can be useful for determining when a user specified612- an option on the command line that is the same as the default.613- In that case, the source would be ParameterSource.COMMANDLINE,614- even though the value of the parameter was equivalent to the615- default.620+ """Get the `source` of a parameter.621 622+ This indicates the location from which the value of the623+ parameter was obtained. This can be useful for determining624+ when a user specified an option on the command line that is625+ the same as the default. In that case, the source would be626+ ParameterSource.COMMANDLINE, even though the value of the627+ parameter was equivalent to the default.628+629 :param name: the name of the command line parameter630 :returns: the source631 :rtype: ParameterSource632 """633 return self._parameter_sources.get(name)622- 634 635+636 class BaseCommand(object):637 """The base command implements the minimal API contract of commands.638 Most code will never use this as it does not implement a lot of useful639 functionality but it can act as the direct subclass of alternative1289 unmodified lines