fname stringlengths 63 176 | rel_fname stringclasses 706
values | line int64 -1 4.5k | name stringlengths 1 81 | kind stringclasses 2
values | category stringclasses 2
values | info stringlengths 0 77.9k ⌀ |
|---|---|---|---|---|---|---|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/__init__.py | pylint/config/__init__.py | 85 | exists | ref | function | if os.path.exists(old_home) and not os.path.exists(spam_prevention_file):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/__init__.py | pylint/config/__init__.py | 85 | exists | ref | function | if os.path.exists(old_home) and not os.path.exists(spam_prevention_file):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/__init__.py | pylint/config/__init__.py | 92 | exists | ref | function | if os.path.exists(PYLINT_HOME):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/__init__.py | pylint/config/__init__.py | 113 | _get_pdata_path | def | function | def _get_pdata_path(base_name, recurs):
base_name = base_name.replace(os.sep, "_")
return os.path.join(PYLINT_HOME, f"{base_name}{recurs}.stats")
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/__init__.py | pylint/config/__init__.py | 118 | load_results | def | function | def load_results(base):
data_file = _get_pdata_path(base, 1)
try:
with open(data_file, "rb") as stream:
data = pickle.load(stream)
if not isinstance(data, LinterStats):
raise TypeError
return data
except Exception: # pylint: disable=broad-except
return None
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/__init__.py | pylint/config/__init__.py | 119 | _get_pdata_path | ref | function | data_file = _get_pdata_path(base, 1)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/__init__.py | pylint/config/__init__.py | 130 | save_results | def | function | def save_results(results, base):
if not os.path.exists(PYLINT_HOME):
try:
os.makedirs(PYLINT_HOME)
except OSError:
print(f"Unable to create directory {PYLINT_HOME}", file=sys.stderr)
data_file = _get_pdata_path(base, 1)
try:
with open(data_file, "wb") as stream:
pickle.dump(results, stream)
except OSError as ex:
print(f"Unable to create file {data_file}: {ex}", file=sys.stderr)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/__init__.py | pylint/config/__init__.py | 131 | exists | ref | function | if not os.path.exists(PYLINT_HOME):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/__init__.py | pylint/config/__init__.py | 136 | _get_pdata_path | ref | function | data_file = _get_pdata_path(base, 1)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/__init__.py | pylint/config/__init__.py | 144 | find_pylintrc | ref | function | PYLINTRC = find_pylintrc()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/config_initialization.py | pylint/config/config_initialization.py | 14 | _config_initialization | def | function | def _config_initialization(
linter: "PyLinter",
args_list: List[str],
reporter: Union[reporters.BaseReporter, reporters.MultiReporter, None] = None,
config_file: Union[None, str, Path] = None,
verbose_mode: Optional[bool] = None,
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/config_initialization.py | pylint/config/config_initialization.py | 27 | read_config_file | ref | function | linter.read_config_file(config_file=config_file, verbose=verbose_mode)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/config_initialization.py | pylint/config/config_initialization.py | 34 | has_option | ref | function | if config_parser.has_option("MASTER", "init-hook"):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/config_initialization.py | pylint/config/config_initialization.py | 36 | _unquote | ref | function | utils._unquote(config_parser.get("MASTER", "init-hook"))
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/config_initialization.py | pylint/config/config_initialization.py | 40 | has_option | ref | function | if config_parser.has_option("MASTER", "load-plugins"):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/config_initialization.py | pylint/config/config_initialization.py | 41 | _splitstrip | ref | function | plugins = utils._splitstrip(config_parser.get("MASTER", "load-plugins"))
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/config_initialization.py | pylint/config/config_initialization.py | 42 | load_plugin_modules | ref | function | linter.load_plugin_modules(plugins)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/config_initialization.py | pylint/config/config_initialization.py | 46 | load_config_file | ref | function | linter.load_config_file()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/config_initialization.py | pylint/config/config_initialization.py | 52 | set_reporter | ref | function | linter.set_reporter(reporter)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/config_initialization.py | pylint/config/config_initialization.py | 56 | load_command_line_configuration | ref | function | args_list = linter.load_command_line_configuration(args_list)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/config_initialization.py | pylint/config/config_initialization.py | 70 | load_plugin_configuration | ref | function | linter.load_plugin_configuration()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/config_initialization.py | pylint/config/config_initialization.py | 73 | enable_fail_on_messages | ref | function | linter.enable_fail_on_messages()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/configuration_mixin.py | pylint/config/configuration_mixin.py | 7 | ConfigurationMixIn | def | class | __init__ |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/configuration_mixin.py | pylint/config/configuration_mixin.py | 26 | register_options_provider | ref | function | self.register_options_provider(self, own_group=False)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 11 | _toml_has_config | def | function | def _toml_has_config(path):
with open(path, encoding="utf-8") as toml_handle:
try:
content = toml.load(toml_handle)
except TomlDecodeError as error:
print(f"Failed to load '{path}': {error}")
return _False
try:
content["tool"]["pylint"]
except KeyError:
return _False
return _True
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 27 | _cfg_has_config | def | function | def _cfg_has_config(path):
parser = configparser.ConfigParser()
parser.read(path, encoding="utf-8")
return any(section.startswith("pylint.") for section in parser.sections())
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 30 | sections | ref | function | return any(section.startswith("pylint.") for section in parser.sections())
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 33 | find_default_config_files | def | function | def find_default_config_files() -> Iterator[str]:
"""Find all possible config files."""
rc_names = ("pylintrc", ".pylintrc")
config_names = rc_names + ("pyproject.toml", "setup.cfg")
for config_name in config_names:
if os.path.isfile(config_name):
if config_name.endswith(".toml") and not _toml_has_config(config_name):
continue
if config_name.endswith(".cfg") and not _cfg_has_config(config_name):
continue
yield os.path.abspath(config_name)
if os.path.isfile("__init__.py"):
curdir = os.path.abspath(os.getcwd())
while os.path.isfile(os.path.join(curdir, "__init__.py")):
curdir = os.path.abspath(os.path.join(curdir, ".."))
for rc_name in rc_names:
rc_path = os.path.join(curdir, rc_name)
if os.path.isfile(rc_path):
yield rc_path
if "PYLINTRC" in os.environ and os.path.exists(os.environ["PYLINTRC"]):
if os.path.isfile(os.environ["PYLINTRC"]):
yield os.environ["PYLINTRC"]
else:
user_home = os.path.expanduser("~")
if user_home not in ("~", "/root"):
home_rc = os.path.join(user_home, ".pylintrc")
if os.path.isfile(home_rc):
yield home_rc
home_rc = os.path.join(user_home, ".config", "pylintrc")
if os.path.isfile(home_rc):
yield home_rc
if os.path.isfile("/etc/pylintrc"):
yield "/etc/pylintrc"
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 38 | isfile | ref | function | if os.path.isfile(config_name):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 39 | _toml_has_config | ref | function | if config_name.endswith(".toml") and not _toml_has_config(config_name):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 41 | _cfg_has_config | ref | function | if config_name.endswith(".cfg") and not _cfg_has_config(config_name):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 44 | abspath | ref | function | yield os.path.abspath(config_name)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 46 | isfile | ref | function | if os.path.isfile("__init__.py"):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 47 | abspath | ref | function | curdir = os.path.abspath(os.getcwd())
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 48 | isfile | ref | function | while os.path.isfile(os.path.join(curdir, "__init__.py")):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 49 | abspath | ref | function | curdir = os.path.abspath(os.path.join(curdir, ".."))
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 52 | isfile | ref | function | if os.path.isfile(rc_path):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 55 | exists | ref | function | if "PYLINTRC" in os.environ and os.path.exists(os.environ["PYLINTRC"]):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 56 | isfile | ref | function | if os.path.isfile(os.environ["PYLINTRC"]):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 59 | expanduser | ref | function | user_home = os.path.expanduser("~")
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 62 | isfile | ref | function | if os.path.isfile(home_rc):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 65 | isfile | ref | function | if os.path.isfile(home_rc):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 68 | isfile | ref | function | if os.path.isfile("/etc/pylintrc"):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 72 | find_pylintrc | def | function | def find_pylintrc() -> Optional[str]:
"""Search the pylint rc file and return its path if it finds it, else return None."""
for config_file in find_default_config_files():
if config_file.endswith("pylintrc"):
return config_file
return None
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/find_default_config_files.py | pylint/config/find_default_config_files.py | 74 | find_default_config_files | ref | function | for config_file in find_default_config_files():
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 8 | _ManHelpFormatter | def | class | __init__ format_heading format_description format_option format_head format_title format_short_description format_synopsis format_long_description format_tail format_usage |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 15 | format_heading | def | function | def format_heading(self, heading):
return f".SH {heading.upper()}\n"
def format_description(self, description):
return description
def format_option(self, option):
try:
optstring = option.option_strings
except AttributeError:
optstring = self.format_option_strings(option)
if option.help:
help_text = self.expand_default(option)
help_string = " ".join(line.strip() for line in help_text.splitlines())
help_string = help_string.replace("\\", "\\\\")
help_string = help_string.replace("[current:", "[default:")
else:
help_string = ""
return f""".IP "{optstring}"
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 18 | format_description | def | function | def format_description(self, description):
return description
def format_option(self, option):
try:
optstring = option.option_strings
except AttributeError:
optstring = self.format_option_strings(option)
if option.help:
help_text = self.expand_default(option)
help_string = " ".join(line.strip() for line in help_text.splitlines())
help_string = help_string.replace("\\", "\\\\")
help_string = help_string.replace("[current:", "[default:")
else:
help_string = ""
return f""".IP "{optstring}"
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 21 | format_option | def | function | def format_option(self, option):
try:
optstring = option.option_strings
except AttributeError:
optstring = self.format_option_strings(option)
if option.help:
help_text = self.expand_default(option)
help_string = " ".join(line.strip() for line in help_text.splitlines())
help_string = help_string.replace("\\", "\\\\")
help_string = help_string.replace("[current:", "[default:")
else:
help_string = ""
return f""".IP "{optstring}"
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 25 | format_option_strings | ref | function | optstring = self.format_option_strings(option)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 27 | expand_default | ref | function | help_text = self.expand_default(option)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 37 | format_head | def | function | def format_head(self, optparser, pkginfo, section=1):
long_desc = ""
try:
pgm = optparser._get_prog_name()
except AttributeError:
# py >= 2.4.X (dunno which X exactly, at least 2)
pgm = optparser.get_prog_name()
short_desc = self.format_short_description(pgm, pkginfo.description)
if hasattr(pkginfo, "long_desc"):
long_desc = self.format_long_description(pgm, pkginfo.long_desc)
return f"""{self.format_title(pgm, section)}
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 40 | _get_prog_name | ref | function | pgm = optparser._get_prog_name()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 43 | get_prog_name | ref | function | pgm = optparser.get_prog_name()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 44 | format_short_description | ref | function | short_desc = self.format_short_description(pgm, pkginfo.description)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 46 | format_long_description | ref | function | long_desc = self.format_long_description(pgm, pkginfo.long_desc)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 47 | format_title | ref | function | return f"""{self.format_title(pgm, section)}
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 49 | format_synopsis | ref | function | {self.format_synopsis(pgm)}
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 53 | format_title | def | function | def format_title(pgm, section):
date = (
"%d-%02d-%02d" # pylint: disable=consider-using-f-string
% time.localtime()[:3]
)
return f'.TH {pgm} {section} "{date}" {pgm}'
@staticmethod
def format_short_description(pgm, short_desc):
return f""".SH NAME
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 61 | format_short_description | def | function | def format_short_description(pgm, short_desc):
return f""".SH NAME
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 68 | format_synopsis | def | function | def format_synopsis(pgm):
return f""".SH SYNOPSIS
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 79 | format_long_description | def | function | def format_long_description(pgm, long_desc):
long_desc = "\n".join(line.lstrip() for line in long_desc.splitlines())
long_desc = long_desc.replace("\n.\n", "\n\n")
if long_desc.lower().startswith(pgm):
long_desc = long_desc[len(pgm) :]
return f""".SH DESCRIPTION
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 90 | format_tail | def | function | def format_tail(pkginfo):
tail = f""".SH SEE ALSO
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 108 | format_usage | def | function | def format_usage(self, usage):
"""Taken from optparse.IndentedHelpFormatter."""
return f"Usage: {usage}\n"
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 113 | _generate_manpage | def | function | def _generate_manpage(optparser, pkginfo, section=1, stream=sys.stdout, level=0):
formatter = _ManHelpFormatter()
formatter.output_level = level
formatter.parser = optparser
print(formatter.format_head(optparser, pkginfo, section), file=stream)
print(optparser.format_option_help(formatter), file=stream)
print(formatter.format_tail(pkginfo), file=stream)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 114 | _ManHelpFormatter | ref | function | formatter = _ManHelpFormatter()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 117 | format_head | ref | function | print(formatter.format_head(optparser, pkginfo, section), file=stream)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 118 | format_option_help | ref | function | print(optparser.format_option_help(formatter), file=stream)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/man_help_formatter.py | pylint/config/man_help_formatter.py | 119 | format_tail | ref | function | print(formatter.format_tail(pkginfo), file=stream)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 13 | _csv_validator | def | function | def _csv_validator(_, name, value):
return utils._check_csv(value)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 14 | _check_csv | ref | function | return utils._check_csv(value)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 18 | _regexp_validator | def | function | def _regexp_validator(_, name, value):
if hasattr(value, "pattern"):
return value
return re.compile(value)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 25 | _regexp_csv_validator | def | function | def _regexp_csv_validator(_, name, value):
return [_regexp_validator(_, name, val) for val in _csv_validator(_, name, value)]
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 26 | _regexp_validator | ref | function | return [_regexp_validator(_, name, val) for val in _csv_validator(_, name, value)]
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 26 | _csv_validator | ref | function | return [_regexp_validator(_, name, val) for val in _csv_validator(_, name, value)]
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 29 | _regexp_paths_csv_validator | def | function | def _regexp_paths_csv_validator(
_, name: str, value: Union[str, List[Pattern[str]]]
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 35 | _csv_validator | ref | function | for val in _csv_validator(_, name, value):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 40 | as_posix | ref | function | + pathlib.PureWindowsPath(val).as_posix()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 46 | _choice_validator | def | function | def _choice_validator(choices, name, value):
if value not in choices:
msg = "option %s: invalid value: %r, should be in %s"
raise optparse.OptionValueError(msg % (name, value, choices))
return value
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 53 | _yn_validator | def | function | def _yn_validator(opt, _, value):
if isinstance(value, int):
return bool(value)
if isinstance(value, str):
value = value.lower()
if value in {"y", "yes", "true"}:
return _True
if value in {"n", "no", "false"}:
return _False
msg = "option %s: invalid yn value %r, should be in (y, yes, true, n, no, false)"
raise optparse.OptionValueError(msg % (opt, value))
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 66 | _multiple_choice_validator | def | function | def _multiple_choice_validator(choices, name, value):
values = utils._check_csv(value)
for csv_value in values:
if csv_value not in choices:
msg = "option %s: invalid value: %r, should be in %s"
raise optparse.OptionValueError(msg % (name, csv_value, choices))
return values
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 67 | _check_csv | ref | function | values = utils._check_csv(value)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 75 | _non_empty_string_validator | def | function | def _non_empty_string_validator(opt, _, value):
if not value:
msg = "indent string can't be empty."
raise optparse.OptionValueError(msg)
return utils._unquote(value)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 79 | _unquote | ref | function | return utils._unquote(value)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 82 | _multiple_choices_validating_option | def | function | def _multiple_choices_validating_option(opt, name, value):
return _multiple_choice_validator(opt.choices, name, value)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 83 | _multiple_choice_validator | ref | function | return _multiple_choice_validator(opt.choices, name, value)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 86 | _py_version_validator | def | function | def _py_version_validator(_, name, value):
if not isinstance(value, tuple):
try:
value = tuple(int(val) for val in value.split("."))
except (ValueError, AttributeError):
raise optparse.OptionValueError(
f"Invalid format for {name}, should be version string. E.g., '3.8'"
) from None
return value
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 106 | _choice_validator | ref | function | "choice": lambda opt, name, value: _choice_validator(opt["choices"], name, value),
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 107 | _multiple_choice_validator | ref | function | "multiple_choice": lambda opt, name, value: _multiple_choice_validator(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 115 | _call_validator | def | function | def _call_validator(opttype, optdict, option, value):
if opttype not in VALIDATORS:
raise Exception(f'Unsupported type "{opttype}"')
try:
return VALIDATORS[opttype](optdict, option, value)
except TypeError:
try:
return VALIDATORS[opttype](value)
except Exception as e:
raise optparse.OptionValueError(
f"{option} value ({value!r}) should be of type {opttype}"
) from e
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 129 | _validate | def | function | def _validate(value, optdict, name=""):
"""Return a validated value for an option according to its type.
optional argument name is only used for error message formatting
"""
try:
_type = optdict["type"]
except KeyError:
return value
return _call_validator(_type, optdict, name, value)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 138 | _call_validator | ref | function | return _call_validator(_type, optdict, name, value)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 169 | _check_choice | def | function | def _check_choice(self):
if self.type in {"choice", "multiple_choice"}:
if self.choices is None:
raise optparse.OptionError(
"must supply a list of choices for type 'choice'", self
)
if not isinstance(self.choices, (tuple, list)):
raise optparse.OptionError(
# pylint: disable-next=consider-using-f-string
"choices must be a list of strings ('%s' supplied)"
% str(type(self.choices)).split("'")[1],
self,
)
elif self.choices is not None:
raise optparse.OptionError(
f"must not supply choices for type {self.type!r}", self
)
optparse.Option.CHECK_METHODS[2] = _check_choice # type: ignore[index]
def process(self, opt, value, values, parser):
# First, convert the value(s) to the right type. Howl if any
# value(s) are bogus.
value = self.convert_value(opt, value)
if self.type == "named":
existent = getattr(values, self.dest)
if existent:
existent.update(value)
value = existent
# And then take whatever action is expected of us.
# This is a separate method to make life easier for
# subclasses to add new actions.
return self.take_action(self.action, self.dest, opt, value, values, parser)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 189 | process | def | function | def process(self, opt, value, values, parser):
# First, convert the value(s) to the right type. Howl if any
# value(s) are bogus.
value = self.convert_value(opt, value)
if self.type == "named":
existent = getattr(values, self.dest)
if existent:
existent.update(value)
value = existent
# And then take whatever action is expected of us.
# This is a separate method to make life easier for
# subclasses to add new actions.
return self.take_action(self.action, self.dest, opt, value, values, parser)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 192 | convert_value | ref | function | value = self.convert_value(opt, value)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option.py | pylint/config/option.py | 201 | take_action | ref | function | return self.take_action(self.action, self.dest, opt, value, values, parser)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option_manager_mixin.py | pylint/config/option_manager_mixin.py | 24 | _expand_default | def | function | def _expand_default(self, option):
"""Patch OptionParser.expand_default with custom behaviour.
This will handle defaults to avoid overriding values in the
configuration file.
"""
if self.parser is None or not self.default_tag:
return option.help
optname = option._long_opts[0][2:]
try:
provider = self.parser.options_manager._all_options[optname]
except KeyError:
value = None
else:
optdict = provider.get_option_def(optname)
optname = provider.option_attrname(optname, optdict)
value = getattr(provider.config, optname, optdict)
value = utils._format_option_value(optdict, value)
if value is optparse.NO_DEFAULT or not value:
value = self.NO_DEFAULT_VALUE
return option.help.replace(self.default_tag, str(value))
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option_manager_mixin.py | pylint/config/option_manager_mixin.py | 38 | get_option_def | ref | function | optdict = provider.get_option_def(optname)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option_manager_mixin.py | pylint/config/option_manager_mixin.py | 39 | option_attrname | ref | function | optname = provider.option_attrname(optname, optdict)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/config/option_manager_mixin.py | pylint/config/option_manager_mixin.py | 41 | _format_option_value | ref | function | value = utils._format_option_value(optdict, value)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.