partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
FormatChecker.visit_default
check the node line number and check it if not yet done
pylint/checkers/format.py
def visit_default(self, node): """check the node line number and check it if not yet done""" if not node.is_statement: return if not node.root().pure_python: return # XXX block visit of child nodes prev_sibl = node.previous_sibling() if prev_sibl is not N...
def visit_default(self, node): """check the node line number and check it if not yet done""" if not node.is_statement: return if not node.root().pure_python: return # XXX block visit of child nodes prev_sibl = node.previous_sibling() if prev_sibl is not N...
[ "check", "the", "node", "line", "number", "and", "check", "it", "if", "not", "yet", "done" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/format.py#L1166-L1205
[ "def", "visit_default", "(", "self", ",", "node", ")", ":", "if", "not", "node", ".", "is_statement", ":", "return", "if", "not", "node", ".", "root", "(", ")", ".", "pure_python", ":", "return", "# XXX block visit of child nodes", "prev_sibl", "=", "node", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
FormatChecker._check_multi_statement_line
Check for lines containing multiple statements.
pylint/checkers/format.py
def _check_multi_statement_line(self, node, line): """Check for lines containing multiple statements.""" # Do not warn about multiple nested context managers # in with statements. if isinstance(node, nodes.With): return # For try... except... finally..., the two nodes...
def _check_multi_statement_line(self, node, line): """Check for lines containing multiple statements.""" # Do not warn about multiple nested context managers # in with statements. if isinstance(node, nodes.With): return # For try... except... finally..., the two nodes...
[ "Check", "for", "lines", "containing", "multiple", "statements", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/format.py#L1207-L1232
[ "def", "_check_multi_statement_line", "(", "self", ",", "node", ",", "line", ")", ":", "# Do not warn about multiple nested context managers", "# in with statements.", "if", "isinstance", "(", "node", ",", "nodes", ".", "With", ")", ":", "return", "# For try... except.....
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
FormatChecker.check_lines
check lines have less than a maximum number of characters
pylint/checkers/format.py
def check_lines(self, lines, i): """check lines have less than a maximum number of characters """ max_chars = self.config.max_line_length ignore_long_line = self.config.ignore_long_lines def check_line(line, i): if not line.endswith("\n"): self.add_me...
def check_lines(self, lines, i): """check lines have less than a maximum number of characters """ max_chars = self.config.max_line_length ignore_long_line = self.config.ignore_long_lines def check_line(line, i): if not line.endswith("\n"): self.add_me...
[ "check", "lines", "have", "less", "than", "a", "maximum", "number", "of", "characters" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/format.py#L1234-L1297
[ "def", "check_lines", "(", "self", ",", "lines", ",", "i", ")", ":", "max_chars", "=", "self", ".", "config", ".", "max_line_length", "ignore_long_line", "=", "self", ".", "config", ".", "ignore_long_lines", "def", "check_line", "(", "line", ",", "i", ")",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
FormatChecker.check_indent_level
return the indent level of the string
pylint/checkers/format.py
def check_indent_level(self, string, expected, line_num): """return the indent level of the string """ indent = self.config.indent_string if indent == "\\t": # \t is not interpreted in the configuration file indent = "\t" level = 0 unit_size = len(indent) ...
def check_indent_level(self, string, expected, line_num): """return the indent level of the string """ indent = self.config.indent_string if indent == "\\t": # \t is not interpreted in the configuration file indent = "\t" level = 0 unit_size = len(indent) ...
[ "return", "the", "indent", "level", "of", "the", "string" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/format.py#L1299-L1330
[ "def", "check_indent_level", "(", "self", ",", "string", ",", "expected", ",", "line_num", ")", ":", "indent", "=", "self", ".", "config", ".", "indent_string", "if", "indent", "==", "\"\\\\t\"", ":", "# \\t is not interpreted in the configuration file", "indent", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_in_iterating_context
Check if the node is being used as an iterator. Definition is taken from lib2to3.fixer_util.in_special_context().
pylint/checkers/python3.py
def _in_iterating_context(node): """Check if the node is being used as an iterator. Definition is taken from lib2to3.fixer_util.in_special_context(). """ parent = node.parent # Since a call can't be the loop variant we only need to know if the node's # parent is a 'for' loop to know it's being ...
def _in_iterating_context(node): """Check if the node is being used as an iterator. Definition is taken from lib2to3.fixer_util.in_special_context(). """ parent = node.parent # Since a call can't be the loop variant we only need to know if the node's # parent is a 'for' loop to know it's being ...
[ "Check", "if", "the", "node", "is", "being", "used", "as", "an", "iterator", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/python3.py#L96-L150
[ "def", "_in_iterating_context", "(", "node", ")", ":", "parent", "=", "node", ".", "parent", "# Since a call can't be the loop variant we only need to know if the node's", "# parent is a 'for' loop to know it's being used as the iterator for the", "# loop.", "if", "isinstance", "(", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_is_conditional_import
Checks if an import node is in the context of a conditional.
pylint/checkers/python3.py
def _is_conditional_import(node): """Checks if an import node is in the context of a conditional. """ parent = node.parent return isinstance( parent, (astroid.TryExcept, astroid.ExceptHandler, astroid.If, astroid.IfExp) )
def _is_conditional_import(node): """Checks if an import node is in the context of a conditional. """ parent = node.parent return isinstance( parent, (astroid.TryExcept, astroid.ExceptHandler, astroid.If, astroid.IfExp) )
[ "Checks", "if", "an", "import", "node", "is", "in", "the", "context", "of", "a", "conditional", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/python3.py#L153-L159
[ "def", "_is_conditional_import", "(", "node", ")", ":", "parent", "=", "node", ".", "parent", "return", "isinstance", "(", "parent", ",", "(", "astroid", ".", "TryExcept", ",", "astroid", ".", "ExceptHandler", ",", "astroid", ".", "If", ",", "astroid", "."...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
Python3Checker.visit_name
Detect when a "bad" built-in is referenced.
pylint/checkers/python3.py
def visit_name(self, node): """Detect when a "bad" built-in is referenced.""" found_node, _ = node.lookup(node.name) if not _is_builtin(found_node): return if node.name not in self._bad_builtins: return if node_ignores_exception(node) or isinstance( ...
def visit_name(self, node): """Detect when a "bad" built-in is referenced.""" found_node, _ = node.lookup(node.name) if not _is_builtin(found_node): return if node.name not in self._bad_builtins: return if node_ignores_exception(node) or isinstance( ...
[ "Detect", "when", "a", "bad", "built", "-", "in", "is", "referenced", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/python3.py#L1001-L1014
[ "def", "visit_name", "(", "self", ",", "node", ")", ":", "found_node", ",", "_", "=", "node", ".", "lookup", "(", "node", ".", "name", ")", "if", "not", "_is_builtin", "(", "found_node", ")", ":", "return", "if", "node", ".", "name", "not", "in", "...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
Python3Checker.visit_subscript
Look for indexing exceptions.
pylint/checkers/python3.py
def visit_subscript(self, node): """ Look for indexing exceptions. """ try: for inferred in node.value.infer(): if not isinstance(inferred, astroid.Instance): continue if utils.inherit_from_std_ex(inferred): self.add_mes...
def visit_subscript(self, node): """ Look for indexing exceptions. """ try: for inferred in node.value.infer(): if not isinstance(inferred, astroid.Instance): continue if utils.inherit_from_std_ex(inferred): self.add_mes...
[ "Look", "for", "indexing", "exceptions", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/python3.py#L1226-L1235
[ "def", "visit_subscript", "(", "self", ",", "node", ")", ":", "try", ":", "for", "inferred", "in", "node", ".", "value", ".", "infer", "(", ")", ":", "if", "not", "isinstance", "(", "inferred", ",", "astroid", ".", "Instance", ")", ":", "continue", "...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
Python3Checker.visit_attribute
Look for removed attributes
pylint/checkers/python3.py
def visit_attribute(self, node): """Look for removed attributes""" if node.attrname == "xreadlines": self.add_message("xreadlines-attribute", node=node) return exception_message = "message" try: for inferred in node.expr.infer(): if is...
def visit_attribute(self, node): """Look for removed attributes""" if node.attrname == "xreadlines": self.add_message("xreadlines-attribute", node=node) return exception_message = "message" try: for inferred in node.expr.infer(): if is...
[ "Look", "for", "removed", "attributes" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/python3.py#L1245-L1268
[ "def", "visit_attribute", "(", "self", ",", "node", ")", ":", "if", "node", ".", "attrname", "==", "\"xreadlines\"", ":", "self", ".", "add_message", "(", "\"xreadlines-attribute\"", ",", "node", "=", "node", ")", "return", "exception_message", "=", "\"message...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
Python3Checker.visit_excepthandler
Visit an except handler block and check for exception unpacking.
pylint/checkers/python3.py
def visit_excepthandler(self, node): """Visit an except handler block and check for exception unpacking.""" def _is_used_in_except_block(node): scope = node.scope() current = node while ( current and current != scope an...
def visit_excepthandler(self, node): """Visit an except handler block and check for exception unpacking.""" def _is_used_in_except_block(node): scope = node.scope() current = node while ( current and current != scope an...
[ "Visit", "an", "except", "handler", "block", "and", "check", "for", "exception", "unpacking", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/python3.py#L1271-L1316
[ "def", "visit_excepthandler", "(", "self", ",", "node", ")", ":", "def", "_is_used_in_except_block", "(", "node", ")", ":", "scope", "=", "node", ".", "scope", "(", ")", "current", "=", "node", "while", "(", "current", "and", "current", "!=", "scope", "a...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
Python3Checker.visit_raise
Visit a raise statement and check for raising strings or old-raise-syntax.
pylint/checkers/python3.py
def visit_raise(self, node): """Visit a raise statement and check for raising strings or old-raise-syntax. """ # Ignore empty raise. if node.exc is None: return expr = node.exc if self._check_raise_value(node, expr): return try: ...
def visit_raise(self, node): """Visit a raise statement and check for raising strings or old-raise-syntax. """ # Ignore empty raise. if node.exc is None: return expr = node.exc if self._check_raise_value(node, expr): return try: ...
[ "Visit", "a", "raise", "statement", "and", "check", "for", "raising", "strings", "or", "old", "-", "raise", "-", "syntax", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/python3.py#L1323-L1338
[ "def", "visit_raise", "(", "self", ",", "node", ")", ":", "# Ignore empty raise.", "if", "node", ".", "exc", "is", "None", ":", "return", "expr", "=", "node", ".", "exc", "if", "self", ".", "_check_raise_value", "(", "node", ",", "expr", ")", ":", "ret...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
find_pylintrc
search the pylint rc file and return its path if it find it, else None
pylint/config.py
def find_pylintrc(): """search the pylint rc file and return its path if it find it, else None """ # is there a pylint rc file in the current directory ? if os.path.exists("pylintrc"): return os.path.abspath("pylintrc") if os.path.exists(".pylintrc"): return os.path.abspath(".pylintr...
def find_pylintrc(): """search the pylint rc file and return its path if it find it, else None """ # is there a pylint rc file in the current directory ? if os.path.exists("pylintrc"): return os.path.abspath("pylintrc") if os.path.exists(".pylintrc"): return os.path.abspath(".pylintr...
[ "search", "the", "pylint", "rc", "file", "and", "return", "its", "path", "if", "it", "find", "it", "else", "None" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L105-L136
[ "def", "find_pylintrc", "(", ")", ":", "# is there a pylint rc file in the current directory ?", "if", "os", ".", "path", ".", "exists", "(", "\"pylintrc\"", ")", ":", "return", "os", ".", "path", ".", "abspath", "(", "\"pylintrc\"", ")", "if", "os", ".", "pat...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_validate
return a validated value for an option according to its type optional argument name is only used for error message formatting
pylint/config.py
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: # FIXME return value return _call_validator(_type, o...
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: # FIXME return value return _call_validator(_type, o...
[ "return", "a", "validated", "value", "for", "an", "option", "according", "to", "its", "type" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L240-L250
[ "def", "_validate", "(", "value", ",", "optdict", ",", "name", "=", "\"\"", ")", ":", "try", ":", "_type", "=", "optdict", "[", "\"type\"", "]", "except", "KeyError", ":", "# FIXME", "return", "value", "return", "_call_validator", "(", "_type", ",", "opt...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_expand_default
Patch OptionParser.expand_default with custom behaviour This will handle defaults to avoid overriding values in the configuration file.
pylint/config.py
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...
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...
[ "Patch", "OptionParser", ".", "expand_default", "with", "custom", "behaviour" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L262-L282
[ "def", "_expand_default", "(", "self", ",", "option", ")", ":", "if", "self", ".", "parser", "is", "None", "or", "not", "self", ".", "default_tag", ":", "return", "option", ".", "help", "optname", "=", "option", ".", "_long_opts", "[", "0", "]", "[", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
OptionParser._match_long_opt
Disable abbreviations.
pylint/config.py
def _match_long_opt(self, opt): """Disable abbreviations.""" if opt not in self._long_opt: raise optparse.BadOptionError(opt) return opt
def _match_long_opt(self, opt): """Disable abbreviations.""" if opt not in self._long_opt: raise optparse.BadOptionError(opt) return opt
[ "Disable", "abbreviations", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L383-L387
[ "def", "_match_long_opt", "(", "self", ",", "opt", ")", ":", "if", "opt", "not", "in", "self", ".", "_long_opt", ":", "raise", "optparse", ".", "BadOptionError", "(", "opt", ")", "return", "opt" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
OptionsManagerMixIn.register_options_provider
register an options provider
pylint/config.py
def register_options_provider(self, provider, own_group=True): """register an options provider""" assert provider.priority <= 0, "provider's priority can't be >= 0" for i in range(len(self.options_providers)): if provider.priority > self.options_providers[i].priority: ...
def register_options_provider(self, provider, own_group=True): """register an options provider""" assert provider.priority <= 0, "provider's priority can't be >= 0" for i in range(len(self.options_providers)): if provider.priority > self.options_providers[i].priority: ...
[ "register", "an", "options", "provider" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L540-L570
[ "def", "register_options_provider", "(", "self", ",", "provider", ",", "own_group", "=", "True", ")", ":", "assert", "provider", ".", "priority", "<=", "0", ",", "\"provider's priority can't be >= 0\"", "for", "i", "in", "range", "(", "len", "(", "self", ".", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
OptionsManagerMixIn.optik_option
get our personal option definition and return a suitable form for use with optik/optparse
pylint/config.py
def optik_option(self, provider, opt, optdict): """get our personal option definition and return a suitable form for use with optik/optparse """ optdict = copy.copy(optdict) if "action" in optdict: self._nocallback_options[provider] = opt else: opt...
def optik_option(self, provider, opt, optdict): """get our personal option definition and return a suitable form for use with optik/optparse """ optdict = copy.copy(optdict) if "action" in optdict: self._nocallback_options[provider] = opt else: opt...
[ "get", "our", "personal", "option", "definition", "and", "return", "a", "suitable", "form", "for", "use", "with", "optik", "/", "optparse" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L599-L628
[ "def", "optik_option", "(", "self", ",", "provider", ",", "opt", ",", "optdict", ")", ":", "optdict", "=", "copy", ".", "copy", "(", "optdict", ")", "if", "\"action\"", "in", "optdict", ":", "self", ".", "_nocallback_options", "[", "provider", "]", "=", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
OptionsManagerMixIn.cb_set_provider_option
optik callback for option setting
pylint/config.py
def cb_set_provider_option(self, option, opt, value, parser): """optik callback for option setting""" if opt.startswith("--"): # remove -- on long option opt = opt[2:] else: # short option, get its long equivalent opt = self._short_options[opt[1:]]...
def cb_set_provider_option(self, option, opt, value, parser): """optik callback for option setting""" if opt.startswith("--"): # remove -- on long option opt = opt[2:] else: # short option, get its long equivalent opt = self._short_options[opt[1:]]...
[ "optik", "callback", "for", "option", "setting" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L630-L641
[ "def", "cb_set_provider_option", "(", "self", ",", "option", ",", "opt", ",", "value", ",", "parser", ")", ":", "if", "opt", ".", "startswith", "(", "\"--\"", ")", ":", "# remove -- on long option", "opt", "=", "opt", "[", "2", ":", "]", "else", ":", "...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
OptionsManagerMixIn.global_set_option
set option on the correct option provider
pylint/config.py
def global_set_option(self, opt, value): """set option on the correct option provider""" self._all_options[opt].set_option(opt, value)
def global_set_option(self, opt, value): """set option on the correct option provider""" self._all_options[opt].set_option(opt, value)
[ "set", "option", "on", "the", "correct", "option", "provider" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L643-L645
[ "def", "global_set_option", "(", "self", ",", "opt", ",", "value", ")", ":", "self", ".", "_all_options", "[", "opt", "]", ".", "set_option", "(", "opt", ",", "value", ")" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
OptionsManagerMixIn.generate_config
write a configuration file according to the current configuration into the given stream or stdout
pylint/config.py
def generate_config(self, stream=None, skipsections=(), encoding=None): """write a configuration file according to the current configuration into the given stream or stdout """ options_by_section = {} sections = [] for provider in self.options_providers: for s...
def generate_config(self, stream=None, skipsections=(), encoding=None): """write a configuration file according to the current configuration into the given stream or stdout """ options_by_section = {} sections = [] for provider in self.options_providers: for s...
[ "write", "a", "configuration", "file", "according", "to", "the", "current", "configuration", "into", "the", "given", "stream", "or", "stdout" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L647-L678
[ "def", "generate_config", "(", "self", ",", "stream", "=", "None", ",", "skipsections", "=", "(", ")", ",", "encoding", "=", "None", ")", ":", "options_by_section", "=", "{", "}", "sections", "=", "[", "]", "for", "provider", "in", "self", ".", "option...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
OptionsManagerMixIn.read_config_file
read the configuration file but do not load it (i.e. dispatching values to each options provider)
pylint/config.py
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" ...
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", ")" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L695-L742
[ "def", "read_config_file", "(", "self", ",", "config_file", "=", "None", ",", "verbose", "=", "None", ")", ":", "helplevel", "=", "1", "while", "helplevel", "<=", "self", ".", "_maxlevel", ":", "opt", "=", "\"-\"", ".", "join", "(", "[", "\"long\"", "]...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
OptionsManagerMixIn.load_config_file
dispatch values previously read from a configuration file to each options provider)
pylint/config.py
def load_config_file(self): """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): try: s...
def load_config_file(self): """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): try: s...
[ "dispatch", "values", "previously", "read", "from", "a", "configuration", "file", "to", "each", "options", "provider", ")" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L744-L755
[ "def", "load_config_file", "(", "self", ")", ":", "parser", "=", "self", ".", "cfgfile_parser", "for", "section", "in", "parser", ".", "sections", "(", ")", ":", "for", "option", ",", "value", "in", "parser", ".", "items", "(", "section", ")", ":", "tr...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
OptionsManagerMixIn.load_command_line_configuration
Override configuration according to command line parameters return additional arguments
pylint/config.py
def load_command_line_configuration(self, args=None): """Override configuration according to command line parameters return additional arguments """ with _patch_optparse(): if args is None: args = sys.argv[1:] else: args = list(arg...
def load_command_line_configuration(self, args=None): """Override configuration according to command line parameters return additional arguments """ with _patch_optparse(): if args is None: args = sys.argv[1:] else: args = list(arg...
[ "Override", "configuration", "according", "to", "command", "line", "parameters" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L767-L785
[ "def", "load_command_line_configuration", "(", "self", ",", "args", "=", "None", ")", ":", "with", "_patch_optparse", "(", ")", ":", "if", "args", "is", "None", ":", "args", "=", "sys", ".", "argv", "[", "1", ":", "]", "else", ":", "args", "=", "list...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
OptionsManagerMixIn.add_help_section
add a dummy option section for help purpose
pylint/config.py
def add_help_section(self, title, description, level=0): """add a dummy option section for help purpose """ group = optparse.OptionGroup( self.cmdline_parser, title=title.capitalize(), description=description ) group.level = level self._maxlevel = max(self._maxlevel, ...
def add_help_section(self, title, description, level=0): """add a dummy option section for help purpose """ group = optparse.OptionGroup( self.cmdline_parser, title=title.capitalize(), description=description ) group.level = level self._maxlevel = max(self._maxlevel, ...
[ "add", "a", "dummy", "option", "section", "for", "help", "purpose" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L787-L794
[ "def", "add_help_section", "(", "self", ",", "title", ",", "description", ",", "level", "=", "0", ")", ":", "group", "=", "optparse", ".", "OptionGroup", "(", "self", ".", "cmdline_parser", ",", "title", "=", "title", ".", "capitalize", "(", ")", ",", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
OptionsManagerMixIn.help
return the usage string for available options
pylint/config.py
def help(self, level=0): """return the usage string for available options """ self.cmdline_parser.formatter.output_level = level with _patch_optparse(): return self.cmdline_parser.format_help()
def help(self, level=0): """return the usage string for available options """ self.cmdline_parser.formatter.output_level = level with _patch_optparse(): return self.cmdline_parser.format_help()
[ "return", "the", "usage", "string", "for", "available", "options" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L796-L800
[ "def", "help", "(", "self", ",", "level", "=", "0", ")", ":", "self", ".", "cmdline_parser", ".", "formatter", ".", "output_level", "=", "level", "with", "_patch_optparse", "(", ")", ":", "return", "self", ".", "cmdline_parser", ".", "format_help", "(", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
OptionsProviderMixIn.load_defaults
initialize the provider using default values
pylint/config.py
def load_defaults(self): """initialize the provider using default values""" for opt, optdict in self.options: action = optdict.get("action") if action != "callback": # callback action have no default if optdict is None: optdict ...
def load_defaults(self): """initialize the provider using default values""" for opt, optdict in self.options: action = optdict.get("action") if action != "callback": # callback action have no default if optdict is None: optdict ...
[ "initialize", "the", "provider", "using", "default", "values" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L816-L825
[ "def", "load_defaults", "(", "self", ")", ":", "for", "opt", ",", "optdict", "in", "self", ".", "options", ":", "action", "=", "optdict", ".", "get", "(", "\"action\"", ")", "if", "action", "!=", "\"callback\"", ":", "# callback action have no default", "if"...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
OptionsProviderMixIn.option_attrname
get the config attribute corresponding to opt
pylint/config.py
def option_attrname(self, opt, optdict=None): """get the config attribute corresponding to opt""" if optdict is None: optdict = self.get_option_def(opt) return optdict.get("dest", opt.replace("-", "_"))
def option_attrname(self, opt, optdict=None): """get the config attribute corresponding to opt""" if optdict is None: optdict = self.get_option_def(opt) return optdict.get("dest", opt.replace("-", "_"))
[ "get", "the", "config", "attribute", "corresponding", "to", "opt" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L827-L831
[ "def", "option_attrname", "(", "self", ",", "opt", ",", "optdict", "=", "None", ")", ":", "if", "optdict", "is", "None", ":", "optdict", "=", "self", ".", "get_option_def", "(", "opt", ")", "return", "optdict", ".", "get", "(", "\"dest\"", ",", "opt", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
OptionsProviderMixIn.set_option
method called to set an option (registered in the options list)
pylint/config.py
def set_option(self, optname, value, action=None, optdict=None): """method called to set an option (registered in the options list)""" if optdict is None: optdict = self.get_option_def(optname) if value is not None: value = _validate(value, optdict, optname) if ac...
def set_option(self, optname, value, action=None, optdict=None): """method called to set an option (registered in the options list)""" if optdict is None: optdict = self.get_option_def(optname) if value is not None: value = _validate(value, optdict, optname) if ac...
[ "method", "called", "to", "set", "an", "option", "(", "registered", "in", "the", "options", "list", ")" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L837-L868
[ "def", "set_option", "(", "self", ",", "optname", ",", "value", ",", "action", "=", "None", ",", "optdict", "=", "None", ")", ":", "if", "optdict", "is", "None", ":", "optdict", "=", "self", ".", "get_option_def", "(", "optname", ")", "if", "value", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
OptionsProviderMixIn.get_option_def
return the dictionary defining an option given its name
pylint/config.py
def get_option_def(self, opt): """return the dictionary defining an option given its name""" assert self.options for option in self.options: if option[0] == opt: return option[1] raise optparse.OptionError( "no such option %s in section %r" % (opt,...
def get_option_def(self, opt): """return the dictionary defining an option given its name""" assert self.options for option in self.options: if option[0] == opt: return option[1] raise optparse.OptionError( "no such option %s in section %r" % (opt,...
[ "return", "the", "dictionary", "defining", "an", "option", "given", "its", "name" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L870-L878
[ "def", "get_option_def", "(", "self", ",", "opt", ")", ":", "assert", "self", ".", "options", "for", "option", "in", "self", ".", "options", ":", "if", "option", "[", "0", "]", "==", "opt", ":", "return", "option", "[", "1", "]", "raise", "optparse",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
OptionsProviderMixIn.options_by_section
return an iterator on options grouped by section (section, [list of (optname, optdict, optvalue)])
pylint/config.py
def options_by_section(self): """return an iterator on options grouped by section (section, [list of (optname, optdict, optvalue)]) """ sections = {} for optname, optdict in self.options: sections.setdefault(optdict.get("group"), []).append( (optname,...
def options_by_section(self): """return an iterator on options grouped by section (section, [list of (optname, optdict, optvalue)]) """ sections = {} for optname, optdict in self.options: sections.setdefault(optdict.get("group"), []).append( (optname,...
[ "return", "an", "iterator", "on", "options", "grouped", "by", "section" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/config.py#L880-L893
[ "def", "options_by_section", "(", "self", ")", ":", "sections", "=", "{", "}", "for", "optname", ",", "optdict", "in", "self", ".", "options", ":", "sections", ".", "setdefault", "(", "optdict", ".", "get", "(", "\"group\"", ")", ",", "[", "]", ")", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
is_method_call
Determines if a BoundMethod node represents a method call. Args: func (astroid.BoundMethod): The BoundMethod AST node to check. types (Optional[String]): Optional sequence of caller type names to restrict check. methods (Optional[String]): Optional sequence of method names to restrict check. ...
pylint/checkers/logging.py
def is_method_call(func, types=(), methods=()): """Determines if a BoundMethod node represents a method call. Args: func (astroid.BoundMethod): The BoundMethod AST node to check. types (Optional[String]): Optional sequence of caller type names to restrict check. methods (Optional[String]): Op...
def is_method_call(func, types=(), methods=()): """Determines if a BoundMethod node represents a method call. Args: func (astroid.BoundMethod): The BoundMethod AST node to check. types (Optional[String]): Optional sequence of caller type names to restrict check. methods (Optional[String]): Op...
[ "Determines", "if", "a", "BoundMethod", "node", "represents", "a", "method", "call", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/logging.py#L99-L116
[ "def", "is_method_call", "(", "func", ",", "types", "=", "(", ")", ",", "methods", "=", "(", ")", ")", ":", "return", "(", "isinstance", "(", "func", ",", "astroid", ".", "BoundMethod", ")", "and", "isinstance", "(", "func", ".", "bound", ",", "astro...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
is_complex_format_str
Checks if node represents a string with complex formatting specs. Args: node (astroid.node_classes.NodeNG): AST node to check Returns: bool: True if inferred string uses complex formatting, False otherwise
pylint/checkers/logging.py
def is_complex_format_str(node): """Checks if node represents a string with complex formatting specs. Args: node (astroid.node_classes.NodeNG): AST node to check Returns: bool: True if inferred string uses complex formatting, False otherwise """ inferred = utils.safe_infer(node) ...
def is_complex_format_str(node): """Checks if node represents a string with complex formatting specs. Args: node (astroid.node_classes.NodeNG): AST node to check Returns: bool: True if inferred string uses complex formatting, False otherwise """ inferred = utils.safe_infer(node) ...
[ "Checks", "if", "node", "represents", "a", "string", "with", "complex", "formatting", "specs", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/logging.py#L333-L352
[ "def", "is_complex_format_str", "(", "node", ")", ":", "inferred", "=", "utils", ".", "safe_infer", "(", "node", ")", "if", "inferred", "is", "None", "or", "not", "isinstance", "(", "inferred", ".", "value", ",", "str", ")", ":", "return", "True", "try",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
LoggingChecker.visit_module
Clears any state left in this checker from last module checked.
pylint/checkers/logging.py
def visit_module(self, node): # pylint: disable=unused-argument """Clears any state left in this checker from last module checked.""" # The code being checked can just as easily "import logging as foo", # so it is necessary to process the imports and store in this field # what name the ...
def visit_module(self, node): # pylint: disable=unused-argument """Clears any state left in this checker from last module checked.""" # The code being checked can just as easily "import logging as foo", # so it is necessary to process the imports and store in this field # what name the ...
[ "Clears", "any", "state", "left", "in", "this", "checker", "from", "last", "module", "checked", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/logging.py#L150-L164
[ "def", "visit_module", "(", "self", ",", "node", ")", ":", "# pylint: disable=unused-argument", "# The code being checked can just as easily \"import logging as foo\",", "# so it is necessary to process the imports and store in this field", "# what name the logging module is actually given.", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
LoggingChecker.visit_importfrom
Checks to see if a module uses a non-Python logging module.
pylint/checkers/logging.py
def visit_importfrom(self, node): """Checks to see if a module uses a non-Python logging module.""" try: logging_name = self._from_imports[node.modname] for module, as_name in node.names: if module == logging_name: self._logging_names.add(as_na...
def visit_importfrom(self, node): """Checks to see if a module uses a non-Python logging module.""" try: logging_name = self._from_imports[node.modname] for module, as_name in node.names: if module == logging_name: self._logging_names.add(as_na...
[ "Checks", "to", "see", "if", "a", "module", "uses", "a", "non", "-", "Python", "logging", "module", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/logging.py#L166-L174
[ "def", "visit_importfrom", "(", "self", ",", "node", ")", ":", "try", ":", "logging_name", "=", "self", ".", "_from_imports", "[", "node", ".", "modname", "]", "for", "module", ",", "as_name", "in", "node", ".", "names", ":", "if", "module", "==", "log...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
LoggingChecker.visit_import
Checks to see if this module uses Python's built-in logging.
pylint/checkers/logging.py
def visit_import(self, node): """Checks to see if this module uses Python's built-in logging.""" for module, as_name in node.names: if module in self._logging_modules: self._logging_names.add(as_name or module)
def visit_import(self, node): """Checks to see if this module uses Python's built-in logging.""" for module, as_name in node.names: if module in self._logging_modules: self._logging_names.add(as_name or module)
[ "Checks", "to", "see", "if", "this", "module", "uses", "Python", "s", "built", "-", "in", "logging", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/logging.py#L176-L180
[ "def", "visit_import", "(", "self", ",", "node", ")", ":", "for", "module", ",", "as_name", "in", "node", ".", "names", ":", "if", "module", "in", "self", ".", "_logging_modules", ":", "self", ".", "_logging_names", ".", "add", "(", "as_name", "or", "m...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
LoggingChecker.visit_call
Checks calls to logging methods.
pylint/checkers/logging.py
def visit_call(self, node): """Checks calls to logging methods.""" def is_logging_name(): return ( isinstance(node.func, astroid.Attribute) and isinstance(node.func.expr, astroid.Name) and node.func.expr.name in self._logging_names ...
def visit_call(self, node): """Checks calls to logging methods.""" def is_logging_name(): return ( isinstance(node.func, astroid.Attribute) and isinstance(node.func.expr, astroid.Name) and node.func.expr.name in self._logging_names ...
[ "Checks", "calls", "to", "logging", "methods", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/logging.py#L183-L216
[ "def", "visit_call", "(", "self", ",", "node", ")", ":", "def", "is_logging_name", "(", ")", ":", "return", "(", "isinstance", "(", "node", ".", "func", ",", "astroid", ".", "Attribute", ")", "and", "isinstance", "(", "node", ".", "func", ".", "expr", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
LoggingChecker._check_log_method
Checks calls to logging.log(level, format, *format_args).
pylint/checkers/logging.py
def _check_log_method(self, node, name): """Checks calls to logging.log(level, format, *format_args).""" if name == "log": if node.starargs or node.kwargs or len(node.args) < 2: # Either a malformed call, star args, or double-star args. Beyond # the scope of t...
def _check_log_method(self, node, name): """Checks calls to logging.log(level, format, *format_args).""" if name == "log": if node.starargs or node.kwargs or len(node.args) < 2: # Either a malformed call, star args, or double-star args. Beyond # the scope of t...
[ "Checks", "calls", "to", "logging", ".", "log", "(", "level", "format", "*", "format_args", ")", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/logging.py#L218-L254
[ "def", "_check_log_method", "(", "self", ",", "node", ",", "name", ")", ":", "if", "name", "==", "\"log\"", ":", "if", "node", ".", "starargs", "or", "node", ".", "kwargs", "or", "len", "(", "node", ".", "args", ")", "<", "2", ":", "# Either a malfor...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
LoggingChecker._check_call_func
Checks that function call is not format_string.format(). Args: node (astroid.node_classes.Call): Call AST node to be checked.
pylint/checkers/logging.py
def _check_call_func(self, node): """Checks that function call is not format_string.format(). Args: node (astroid.node_classes.Call): Call AST node to be checked. """ func = utils.safe_infer(node.func) types = ("str", "unicode") methods = ("format",...
def _check_call_func(self, node): """Checks that function call is not format_string.format(). Args: node (astroid.node_classes.Call): Call AST node to be checked. """ func = utils.safe_infer(node.func) types = ("str", "unicode") methods = ("format",...
[ "Checks", "that", "function", "call", "is", "not", "format_string", ".", "format", "()", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/logging.py#L263-L276
[ "def", "_check_call_func", "(", "self", ",", "node", ")", ":", "func", "=", "utils", ".", "safe_infer", "(", "node", ".", "func", ")", "types", "=", "(", "\"str\"", ",", "\"unicode\"", ")", "methods", "=", "(", "\"format\"", ",", ")", "if", "is_method_...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
LoggingChecker._check_format_string
Checks that format string tokens match the supplied arguments. Args: node (astroid.node_classes.NodeNG): AST node to be checked. format_arg (int): Index of the format string in the node arguments.
pylint/checkers/logging.py
def _check_format_string(self, node, format_arg): """Checks that format string tokens match the supplied arguments. Args: node (astroid.node_classes.NodeNG): AST node to be checked. format_arg (int): Index of the format string in the node arguments. """ num_args = _c...
def _check_format_string(self, node, format_arg): """Checks that format string tokens match the supplied arguments. Args: node (astroid.node_classes.NodeNG): AST node to be checked. format_arg (int): Index of the format string in the node arguments. """ num_args = _c...
[ "Checks", "that", "format", "string", "tokens", "match", "the", "supplied", "arguments", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/logging.py#L278-L330
[ "def", "_check_format_string", "(", "self", ",", "node", ",", "format_arg", ")", ":", "num_args", "=", "_count_supplied_tokens", "(", "node", ".", "args", "[", "format_arg", "+", "1", ":", "]", ")", "if", "not", "num_args", ":", "# If no args were supplied the...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_redefines_import
Detect that the given node (AssignName) is inside an exception handler and redefines an import from the tryexcept body. Returns True if the node redefines an import, False otherwise.
pylint/checkers/base.py
def _redefines_import(node): """ Detect that the given node (AssignName) is inside an exception handler and redefines an import from the tryexcept body. Returns True if the node redefines an import, False otherwise. """ current = node while current and not isinstance(current.parent, astroid.Exce...
def _redefines_import(node): """ Detect that the given node (AssignName) is inside an exception handler and redefines an import from the tryexcept body. Returns True if the node redefines an import, False otherwise. """ current = node while current and not isinstance(current.parent, astroid.Exce...
[ "Detect", "that", "the", "given", "node", "(", "AssignName", ")", "is", "inside", "an", "exception", "handler", "and", "redefines", "an", "import", "from", "the", "tryexcept", "body", ".", "Returns", "True", "if", "the", "node", "redefines", "an", "import", ...
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L178-L196
[ "def", "_redefines_import", "(", "node", ")", ":", "current", "=", "node", "while", "current", "and", "not", "isinstance", "(", "current", ".", "parent", ",", "astroid", ".", "ExceptHandler", ")", ":", "current", "=", "current", ".", "parent", "if", "not",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
in_loop
return True if the node is inside a kind of for loop
pylint/checkers/base.py
def in_loop(node): """return True if the node is inside a kind of for loop""" parent = node.parent while parent is not None: if isinstance( parent, ( astroid.For, astroid.ListComp, astroid.SetComp, astroid.DictCo...
def in_loop(node): """return True if the node is inside a kind of for loop""" parent = node.parent while parent is not None: if isinstance( parent, ( astroid.For, astroid.ListComp, astroid.SetComp, astroid.DictCo...
[ "return", "True", "if", "the", "node", "is", "inside", "a", "kind", "of", "for", "loop" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L199-L215
[ "def", "in_loop", "(", "node", ")", ":", "parent", "=", "node", ".", "parent", "while", "parent", "is", "not", "None", ":", "if", "isinstance", "(", "parent", ",", "(", "astroid", ".", "For", ",", "astroid", ".", "ListComp", ",", "astroid", ".", "Set...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
in_nested_list
return true if the object is an element of <nested_list> or of a nested list
pylint/checkers/base.py
def in_nested_list(nested_list, obj): """return true if the object is an element of <nested_list> or of a nested list """ for elmt in nested_list: if isinstance(elmt, (list, tuple)): if in_nested_list(elmt, obj): return True elif elmt == obj: retur...
def in_nested_list(nested_list, obj): """return true if the object is an element of <nested_list> or of a nested list """ for elmt in nested_list: if isinstance(elmt, (list, tuple)): if in_nested_list(elmt, obj): return True elif elmt == obj: retur...
[ "return", "true", "if", "the", "object", "is", "an", "element", "of", "<nested_list", ">", "or", "of", "a", "nested", "list" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L218-L228
[ "def", "in_nested_list", "(", "nested_list", ",", "obj", ")", ":", "for", "elmt", "in", "nested_list", ":", "if", "isinstance", "(", "elmt", ",", "(", "list", ",", "tuple", ")", ")", ":", "if", "in_nested_list", "(", "elmt", ",", "obj", ")", ":", "re...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_get_break_loop_node
Returns the loop node that holds the break node in arguments. Args: break_node (astroid.Break): the break node of interest. Returns: astroid.For or astroid.While: the loop node holding the break node.
pylint/checkers/base.py
def _get_break_loop_node(break_node): """ Returns the loop node that holds the break node in arguments. Args: break_node (astroid.Break): the break node of interest. Returns: astroid.For or astroid.While: the loop node holding the break node. """ loop_nodes = (astroid.For, astr...
def _get_break_loop_node(break_node): """ Returns the loop node that holds the break node in arguments. Args: break_node (astroid.Break): the break node of interest. Returns: astroid.For or astroid.While: the loop node holding the break node. """ loop_nodes = (astroid.For, astr...
[ "Returns", "the", "loop", "node", "that", "holds", "the", "break", "node", "in", "arguments", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L231-L250
[ "def", "_get_break_loop_node", "(", "break_node", ")", ":", "loop_nodes", "=", "(", "astroid", ".", "For", ",", "astroid", ".", "While", ")", "parent", "=", "break_node", ".", "parent", "while", "not", "isinstance", "(", "parent", ",", "loop_nodes", ")", "...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_loop_exits_early
Returns true if a loop may ends up in a break statement. Args: loop (astroid.For, astroid.While): the loop node inspected. Returns: bool: True if the loop may ends up in a break statement, False otherwise.
pylint/checkers/base.py
def _loop_exits_early(loop): """ Returns true if a loop may ends up in a break statement. Args: loop (astroid.For, astroid.While): the loop node inspected. Returns: bool: True if the loop may ends up in a break statement, False otherwise. """ loop_nodes = (astroid.For, astroid....
def _loop_exits_early(loop): """ Returns true if a loop may ends up in a break statement. Args: loop (astroid.For, astroid.While): the loop node inspected. Returns: bool: True if the loop may ends up in a break statement, False otherwise. """ loop_nodes = (astroid.For, astroid....
[ "Returns", "true", "if", "a", "loop", "may", "ends", "up", "in", "a", "break", "statement", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L253-L274
[ "def", "_loop_exits_early", "(", "loop", ")", ":", "loop_nodes", "=", "(", "astroid", ".", "For", ",", "astroid", ".", "While", ")", "definition_nodes", "=", "(", "astroid", ".", "FunctionDef", ",", "astroid", ".", "ClassDef", ")", "inner_loop_nodes", "=", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_get_properties
Returns a tuple of property classes and names. Property classes are fully qualified, such as 'abc.abstractproperty' and property names are the actual names, such as 'abstract_property'.
pylint/checkers/base.py
def _get_properties(config): """Returns a tuple of property classes and names. Property classes are fully qualified, such as 'abc.abstractproperty' and property names are the actual names, such as 'abstract_property'. """ property_classes = {BUILTIN_PROPERTY} property_names = set() # Not retur...
def _get_properties(config): """Returns a tuple of property classes and names. Property classes are fully qualified, such as 'abc.abstractproperty' and property names are the actual names, such as 'abstract_property'. """ property_classes = {BUILTIN_PROPERTY} property_names = set() # Not retur...
[ "Returns", "a", "tuple", "of", "property", "classes", "and", "names", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L289-L302
[ "def", "_get_properties", "(", "config", ")", ":", "property_classes", "=", "{", "BUILTIN_PROPERTY", "}", "property_names", "=", "set", "(", ")", "# Not returning 'property', it has its own check.", "if", "config", "is", "not", "None", ":", "property_classes", ".", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_determine_function_name_type
Determine the name type whose regex the a function's name should match. :param node: A function node. :type node: astroid.node_classes.NodeNG :param config: Configuration from which to pull additional property classes. :type config: :class:`optparse.Values` :returns: One of ('function', 'method', ...
pylint/checkers/base.py
def _determine_function_name_type(node, config=None): """Determine the name type whose regex the a function's name should match. :param node: A function node. :type node: astroid.node_classes.NodeNG :param config: Configuration from which to pull additional property classes. :type config: :class:`o...
def _determine_function_name_type(node, config=None): """Determine the name type whose regex the a function's name should match. :param node: A function node. :type node: astroid.node_classes.NodeNG :param config: Configuration from which to pull additional property classes. :type config: :class:`o...
[ "Determine", "the", "name", "type", "whose", "regex", "the", "a", "function", "s", "name", "should", "match", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L305-L340
[ "def", "_determine_function_name_type", "(", "node", ",", "config", "=", "None", ")", ":", "property_classes", ",", "property_names", "=", "_get_properties", "(", "config", ")", "if", "not", "node", ".", "is_method", "(", ")", ":", "return", "\"function\"", "i...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
report_by_type_stats
make a report of * percentage of different types documented * percentage of different types with a bad name
pylint/checkers/base.py
def report_by_type_stats(sect, stats, _): """make a report of * percentage of different types documented * percentage of different types with a bad name """ # percentage of different types documented and/or with a bad name nice_stats = {} for node_type in ("module", "class", "method", "func...
def report_by_type_stats(sect, stats, _): """make a report of * percentage of different types documented * percentage of different types with a bad name """ # percentage of different types documented and/or with a bad name nice_stats = {} for node_type in ("module", "class", "method", "func...
[ "make", "a", "report", "of" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L353-L390
[ "def", "report_by_type_stats", "(", "sect", ",", "stats", ",", "_", ")", ":", "# percentage of different types documented and/or with a bad name", "nice_stats", "=", "{", "}", "for", "node_type", "in", "(", "\"module\"", ",", "\"class\"", ",", "\"method\"", ",", "\"...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
redefined_by_decorator
return True if the object is a method redefined via decorator. For example: @property def x(self): return self._x @x.setter def x(self, value): self._x = value
pylint/checkers/base.py
def redefined_by_decorator(node): """return True if the object is a method redefined via decorator. For example: @property def x(self): return self._x @x.setter def x(self, value): self._x = value """ if node.decorators: for decorator in node.decorators.nodes: ...
def redefined_by_decorator(node): """return True if the object is a method redefined via decorator. For example: @property def x(self): return self._x @x.setter def x(self, value): self._x = value """ if node.decorators: for decorator in node.decorators.nodes: ...
[ "return", "True", "if", "the", "object", "is", "a", "method", "redefined", "via", "decorator", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L393-L409
[ "def", "redefined_by_decorator", "(", "node", ")", ":", "if", "node", ".", "decorators", ":", "for", "decorator", "in", "node", ".", "decorators", ".", "nodes", ":", "if", "(", "isinstance", "(", "decorator", ",", "astroid", ".", "Attribute", ")", "and", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_is_one_arg_pos_call
Is this a call with exactly 1 argument, where that argument is positional?
pylint/checkers/base.py
def _is_one_arg_pos_call(call): """Is this a call with exactly 1 argument, where that argument is positional? """ return isinstance(call, astroid.Call) and len(call.args) == 1 and not call.keywords
def _is_one_arg_pos_call(call): """Is this a call with exactly 1 argument, where that argument is positional? """ return isinstance(call, astroid.Call) and len(call.args) == 1 and not call.keywords
[ "Is", "this", "a", "call", "with", "exactly", "1", "argument", "where", "that", "argument", "is", "positional?" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L2021-L2025
[ "def", "_is_one_arg_pos_call", "(", "call", ")", ":", "return", "isinstance", "(", "call", ",", "astroid", ".", "Call", ")", "and", "len", "(", "call", ".", "args", ")", "==", "1", "and", "not", "call", ".", "keywords" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
register
required method to auto register this checker
pylint/checkers/base.py
def register(linter): """required method to auto register this checker""" linter.register_checker(BasicErrorChecker(linter)) linter.register_checker(BasicChecker(linter)) linter.register_checker(NameChecker(linter)) linter.register_checker(DocStringChecker(linter)) linter.register_checker(PassCh...
def register(linter): """required method to auto register this checker""" linter.register_checker(BasicErrorChecker(linter)) linter.register_checker(BasicChecker(linter)) linter.register_checker(NameChecker(linter)) linter.register_checker(DocStringChecker(linter)) linter.register_checker(PassCh...
[ "required", "method", "to", "auto", "register", "this", "checker" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L2236-L2243
[ "def", "register", "(", "linter", ")", ":", "linter", ".", "register_checker", "(", "BasicErrorChecker", "(", "linter", ")", ")", "linter", ".", "register_checker", "(", "BasicChecker", "(", "linter", ")", ")", "linter", ".", "register_checker", "(", "NameChec...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicErrorChecker.visit_starred
Check that a Starred expression is used in an assignment target.
pylint/checkers/base.py
def visit_starred(self, node): """Check that a Starred expression is used in an assignment target.""" if isinstance(node.parent, astroid.Call): # f(*args) is converted to Call(args=[Starred]), so ignore # them for this check. return if PY35 and isinstance( ...
def visit_starred(self, node): """Check that a Starred expression is used in an assignment target.""" if isinstance(node.parent, astroid.Call): # f(*args) is converted to Call(args=[Starred]), so ignore # them for this check. return if PY35 and isinstance( ...
[ "Check", "that", "a", "Starred", "expression", "is", "used", "in", "an", "assignment", "target", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L552-L569
[ "def", "visit_starred", "(", "self", ",", "node", ")", ":", "if", "isinstance", "(", "node", ".", "parent", ",", "astroid", ".", "Call", ")", ":", "# f(*args) is converted to Call(args=[Starred]), so ignore", "# them for this check.", "return", "if", "PY35", "and", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicErrorChecker._check_nonlocal_and_global
Check that a name is both nonlocal and global.
pylint/checkers/base.py
def _check_nonlocal_and_global(self, node): """Check that a name is both nonlocal and global.""" def same_scope(current): return current.scope() is node from_iter = itertools.chain.from_iterable nonlocals = set( from_iter( child.names ...
def _check_nonlocal_and_global(self, node): """Check that a name is both nonlocal and global.""" def same_scope(current): return current.scope() is node from_iter = itertools.chain.from_iterable nonlocals = set( from_iter( child.names ...
[ "Check", "that", "a", "name", "is", "both", "nonlocal", "and", "global", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L659-L685
[ "def", "_check_nonlocal_and_global", "(", "self", ",", "node", ")", ":", "def", "same_scope", "(", "current", ")", ":", "return", "current", ".", "scope", "(", ")", "is", "node", "from_iter", "=", "itertools", ".", "chain", ".", "from_iterable", "nonlocals",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicErrorChecker.visit_unaryop
check use of the non-existent ++ and -- operator operator
pylint/checkers/base.py
def visit_unaryop(self, node): """check use of the non-existent ++ and -- operator operator""" if ( (node.op in "+-") and isinstance(node.operand, astroid.UnaryOp) and (node.operand.op == node.op) ): self.add_message("nonexistent-operator", node=no...
def visit_unaryop(self, node): """check use of the non-existent ++ and -- operator operator""" if ( (node.op in "+-") and isinstance(node.operand, astroid.UnaryOp) and (node.operand.op == node.op) ): self.add_message("nonexistent-operator", node=no...
[ "check", "use", "of", "the", "non", "-", "existent", "++", "and", "--", "operator", "operator" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L717-L724
[ "def", "visit_unaryop", "(", "self", ",", "node", ")", ":", "if", "(", "(", "node", ".", "op", "in", "\"+-\"", ")", "and", "isinstance", "(", "node", ".", "operand", ",", "astroid", ".", "UnaryOp", ")", "and", "(", "node", ".", "operand", ".", "op"...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicErrorChecker.visit_call
Check instantiating abstract class with abc.ABCMeta as metaclass.
pylint/checkers/base.py
def visit_call(self, node): """ Check instantiating abstract class with abc.ABCMeta as metaclass. """ try: for inferred in node.func.infer(): self._check_inferred_class_is_abstract(inferred, node) except astroid.InferenceError: return
def visit_call(self, node): """ Check instantiating abstract class with abc.ABCMeta as metaclass. """ try: for inferred in node.func.infer(): self._check_inferred_class_is_abstract(inferred, node) except astroid.InferenceError: return
[ "Check", "instantiating", "abstract", "class", "with", "abc", ".", "ABCMeta", "as", "metaclass", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L752-L760
[ "def", "visit_call", "(", "self", ",", "node", ")", ":", "try", ":", "for", "inferred", "in", "node", ".", "func", ".", "infer", "(", ")", ":", "self", ".", "_check_inferred_class_is_abstract", "(", "inferred", ",", "node", ")", "except", "astroid", ".",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicErrorChecker._check_else_on_loop
Check that any loop with an else clause has a break statement.
pylint/checkers/base.py
def _check_else_on_loop(self, node): """Check that any loop with an else clause has a break statement.""" if node.orelse and not _loop_exits_early(node): self.add_message( "useless-else-on-loop", node=node, # This is not optimal, but the line p...
def _check_else_on_loop(self, node): """Check that any loop with an else clause has a break statement.""" if node.orelse and not _loop_exits_early(node): self.add_message( "useless-else-on-loop", node=node, # This is not optimal, but the line p...
[ "Check", "that", "any", "loop", "with", "an", "else", "clause", "has", "a", "break", "statement", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L803-L813
[ "def", "_check_else_on_loop", "(", "self", ",", "node", ")", ":", "if", "node", ".", "orelse", "and", "not", "_loop_exits_early", "(", "node", ")", ":", "self", ".", "add_message", "(", "\"useless-else-on-loop\"", ",", "node", "=", "node", ",", "# This is no...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicErrorChecker._check_in_loop
check that a node is inside a for or while loop
pylint/checkers/base.py
def _check_in_loop(self, node, node_name): """check that a node is inside a for or while loop""" _node = node.parent while _node: if isinstance(_node, (astroid.For, astroid.While)): if node not in _node.orelse: return if isinstance(_no...
def _check_in_loop(self, node, node_name): """check that a node is inside a for or while loop""" _node = node.parent while _node: if isinstance(_node, (astroid.For, astroid.While)): if node not in _node.orelse: return if isinstance(_no...
[ "check", "that", "a", "node", "is", "inside", "a", "for", "or", "while", "loop" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L815-L834
[ "def", "_check_in_loop", "(", "self", ",", "node", ",", "node_name", ")", ":", "_node", "=", "node", ".", "parent", "while", "_node", ":", "if", "isinstance", "(", "_node", ",", "(", "astroid", ".", "For", ",", "astroid", ".", "While", ")", ")", ":",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicErrorChecker._check_redefinition
check for redefinition of a function / method / class name
pylint/checkers/base.py
def _check_redefinition(self, redeftype, node): """check for redefinition of a function / method / class name""" parent_frame = node.parent.frame() defined_self = parent_frame[node.name] if defined_self is not node and not astroid.are_exclusive(node, defined_self): # Additio...
def _check_redefinition(self, redeftype, node): """check for redefinition of a function / method / class name""" parent_frame = node.parent.frame() defined_self = parent_frame[node.name] if defined_self is not node and not astroid.are_exclusive(node, defined_self): # Additio...
[ "check", "for", "redefinition", "of", "a", "function", "/", "method", "/", "class", "name" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L836-L859
[ "def", "_check_redefinition", "(", "self", ",", "redeftype", ",", "node", ")", ":", "parent_frame", "=", "node", ".", "parent", ".", "frame", "(", ")", "defined_self", "=", "parent_frame", "[", "node", ".", "name", "]", "if", "defined_self", "is", "not", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicChecker.open
initialize visit variables and statistics
pylint/checkers/base.py
def open(self): """initialize visit variables and statistics """ self._tryfinallys = [] self.stats = self.linter.add_stats(module=0, function=0, method=0, class_=0)
def open(self): """initialize visit variables and statistics """ self._tryfinallys = [] self.stats = self.linter.add_stats(module=0, function=0, method=0, class_=0)
[ "initialize", "visit", "variables", "and", "statistics" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L997-L1001
[ "def", "open", "(", "self", ")", ":", "self", ".", "_tryfinallys", "=", "[", "]", "self", ".", "stats", "=", "self", ".", "linter", ".", "add_stats", "(", "module", "=", "0", ",", "function", "=", "0", ",", "method", "=", "0", ",", "class_", "=",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicChecker.visit_expr
check for various kind of statements without effect
pylint/checkers/base.py
def visit_expr(self, node): """check for various kind of statements without effect""" expr = node.value if isinstance(expr, astroid.Const) and isinstance(expr.value, str): # treat string statement in a separated message # Handle PEP-257 attribute docstrings. #...
def visit_expr(self, node): """check for various kind of statements without effect""" expr = node.value if isinstance(expr, astroid.Const) and isinstance(expr.value, str): # treat string statement in a separated message # Handle PEP-257 attribute docstrings. #...
[ "check", "for", "various", "kind", "of", "statements", "without", "effect" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1081-L1124
[ "def", "visit_expr", "(", "self", ",", "node", ")", ":", "expr", "=", "node", ".", "value", "if", "isinstance", "(", "expr", ",", "astroid", ".", "Const", ")", "and", "isinstance", "(", "expr", ".", "value", ",", "str", ")", ":", "# treat string statem...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicChecker.visit_lambda
check whether or not the lambda is suspicious
pylint/checkers/base.py
def visit_lambda(self, node): """check whether or not the lambda is suspicious """ # if the body of the lambda is a call expression with the same # argument list as the lambda itself, then the lambda is # possibly unnecessary and at least suspicious. if node.args.defaults...
def visit_lambda(self, node): """check whether or not the lambda is suspicious """ # if the body of the lambda is a call expression with the same # argument list as the lambda itself, then the lambda is # possibly unnecessary and at least suspicious. if node.args.defaults...
[ "check", "whether", "or", "not", "the", "lambda", "is", "suspicious" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1153-L1211
[ "def", "visit_lambda", "(", "self", ",", "node", ")", ":", "# if the body of the lambda is a call expression with the same", "# argument list as the lambda itself, then the lambda is", "# possibly unnecessary and at least suspicious.", "if", "node", ".", "args", ".", "defaults", ":...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicChecker.visit_functiondef
check function name, docstring, arguments, redefinition, variable names, max locals
pylint/checkers/base.py
def visit_functiondef(self, node): """check function name, docstring, arguments, redefinition, variable names, max locals """ self.stats[node.is_method() and "method" or "function"] += 1 self._check_dangerous_default(node)
def visit_functiondef(self, node): """check function name, docstring, arguments, redefinition, variable names, max locals """ self.stats[node.is_method() and "method" or "function"] += 1 self._check_dangerous_default(node)
[ "check", "function", "name", "docstring", "arguments", "redefinition", "variable", "names", "max", "locals" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1214-L1219
[ "def", "visit_functiondef", "(", "self", ",", "node", ")", ":", "self", ".", "stats", "[", "node", ".", "is_method", "(", ")", "and", "\"method\"", "or", "\"function\"", "]", "+=", "1", "self", ".", "_check_dangerous_default", "(", "node", ")" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicChecker.visit_return
1 - check is the node has a right sibling (if so, that's some unreachable code) 2 - check is the node is inside the finally clause of a try...finally block
pylint/checkers/base.py
def visit_return(self, node): """1 - check is the node has a right sibling (if so, that's some unreachable code) 2 - check is the node is inside the finally clause of a try...finally block """ self._check_unreachable(node) # Is it inside final body of a try...fina...
def visit_return(self, node): """1 - check is the node has a right sibling (if so, that's some unreachable code) 2 - check is the node is inside the finally clause of a try...finally block """ self._check_unreachable(node) # Is it inside final body of a try...fina...
[ "1", "-", "check", "is", "the", "node", "has", "a", "right", "sibling", "(", "if", "so", "that", "s", "some", "unreachable", "code", ")", "2", "-", "check", "is", "the", "node", "is", "inside", "the", "finally", "clause", "of", "a", "try", "...", "...
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1262-L1270
[ "def", "visit_return", "(", "self", ",", "node", ")", ":", "self", ".", "_check_unreachable", "(", "node", ")", "# Is it inside final body of a try...finally bloc ?", "self", ".", "_check_not_in_finally", "(", "node", ",", "\"return\"", ",", "(", "astroid", ".", "...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicChecker.visit_break
1 - check is the node has a right sibling (if so, that's some unreachable code) 2 - check is the node is inside the finally clause of a try...finally block
pylint/checkers/base.py
def visit_break(self, node): """1 - check is the node has a right sibling (if so, that's some unreachable code) 2 - check is the node is inside the finally clause of a try...finally block """ # 1 - Is it right sibling ? self._check_unreachable(node) # 2 - ...
def visit_break(self, node): """1 - check is the node has a right sibling (if so, that's some unreachable code) 2 - check is the node is inside the finally clause of a try...finally block """ # 1 - Is it right sibling ? self._check_unreachable(node) # 2 - ...
[ "1", "-", "check", "is", "the", "node", "has", "a", "right", "sibling", "(", "if", "so", "that", "s", "some", "unreachable", "code", ")", "2", "-", "check", "is", "the", "node", "is", "inside", "the", "finally", "clause", "of", "a", "try", "...", "...
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1280-L1289
[ "def", "visit_break", "(", "self", ",", "node", ")", ":", "# 1 - Is it right sibling ?", "self", ".", "_check_unreachable", "(", "node", ")", "# 2 - Is it inside final body of a try...finally bloc ?", "self", ".", "_check_not_in_finally", "(", "node", ",", "\"break\"", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicChecker.visit_call
visit a Call node -> check if this is not a blacklisted builtin call and check for * or ** use
pylint/checkers/base.py
def visit_call(self, node): """visit a Call node -> check if this is not a blacklisted builtin call and check for * or ** use """ self._check_misplaced_format_function(node) if isinstance(node.func, astroid.Name): name = node.func.name # ignore the name if...
def visit_call(self, node): """visit a Call node -> check if this is not a blacklisted builtin call and check for * or ** use """ self._check_misplaced_format_function(node) if isinstance(node.func, astroid.Name): name = node.func.name # ignore the name if...
[ "visit", "a", "Call", "node", "-", ">", "check", "if", "this", "is", "not", "a", "blacklisted", "builtin", "call", "and", "check", "for", "*", "or", "**", "use" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1327-L1342
[ "def", "visit_call", "(", "self", ",", "node", ")", ":", "self", ".", "_check_misplaced_format_function", "(", "node", ")", "if", "isinstance", "(", "node", ".", "func", ",", "astroid", ".", "Name", ")", ":", "name", "=", "node", ".", "func", ".", "nam...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicChecker.visit_assert
check the use of an assert statement on a tuple.
pylint/checkers/base.py
def visit_assert(self, node): """check the use of an assert statement on a tuple.""" if ( node.fail is None and isinstance(node.test, astroid.Tuple) and len(node.test.elts) == 2 ): self.add_message("assert-on-tuple", node=node)
def visit_assert(self, node): """check the use of an assert statement on a tuple.""" if ( node.fail is None and isinstance(node.test, astroid.Tuple) and len(node.test.elts) == 2 ): self.add_message("assert-on-tuple", node=node)
[ "check", "the", "use", "of", "an", "assert", "statement", "on", "a", "tuple", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1345-L1352
[ "def", "visit_assert", "(", "self", ",", "node", ")", ":", "if", "(", "node", ".", "fail", "is", "None", "and", "isinstance", "(", "node", ".", "test", ",", "astroid", ".", "Tuple", ")", "and", "len", "(", "node", ".", "test", ".", "elts", ")", "...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicChecker.visit_dict
check duplicate key in dictionary
pylint/checkers/base.py
def visit_dict(self, node): """check duplicate key in dictionary""" keys = set() for k, _ in node.items: if isinstance(k, astroid.Const): key = k.value if key in keys: self.add_message("duplicate-key", node=node, args=key) ...
def visit_dict(self, node): """check duplicate key in dictionary""" keys = set() for k, _ in node.items: if isinstance(k, astroid.Const): key = k.value if key in keys: self.add_message("duplicate-key", node=node, args=key) ...
[ "check", "duplicate", "key", "in", "dictionary" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1355-L1363
[ "def", "visit_dict", "(", "self", ",", "node", ")", ":", "keys", "=", "set", "(", ")", "for", "k", ",", "_", "in", "node", ".", "items", ":", "if", "isinstance", "(", "k", ",", "astroid", ".", "Const", ")", ":", "key", "=", "k", ".", "value", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicChecker._check_unreachable
check unreachable code
pylint/checkers/base.py
def _check_unreachable(self, node): """check unreachable code""" unreach_stmt = node.next_sibling() if unreach_stmt is not None: self.add_message("unreachable", node=unreach_stmt)
def _check_unreachable(self, node): """check unreachable code""" unreach_stmt = node.next_sibling() if unreach_stmt is not None: self.add_message("unreachable", node=unreach_stmt)
[ "check", "unreachable", "code" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1373-L1377
[ "def", "_check_unreachable", "(", "self", ",", "node", ")", ":", "unreach_stmt", "=", "node", ".", "next_sibling", "(", ")", "if", "unreach_stmt", "is", "not", "None", ":", "self", ".", "add_message", "(", "\"unreachable\"", ",", "node", "=", "unreach_stmt",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicChecker._check_not_in_finally
check that a node is not inside a finally clause of a try...finally statement. If we found before a try...finally bloc a parent which its type is in breaker_classes, we skip the whole check.
pylint/checkers/base.py
def _check_not_in_finally(self, node, node_name, breaker_classes=()): """check that a node is not inside a finally clause of a try...finally statement. If we found before a try...finally bloc a parent which its type is in breaker_classes, we skip the whole check.""" # if self._tr...
def _check_not_in_finally(self, node, node_name, breaker_classes=()): """check that a node is not inside a finally clause of a try...finally statement. If we found before a try...finally bloc a parent which its type is in breaker_classes, we skip the whole check.""" # if self._tr...
[ "check", "that", "a", "node", "is", "not", "inside", "a", "finally", "clause", "of", "a", "try", "...", "finally", "statement", ".", "If", "we", "found", "before", "a", "try", "...", "finally", "bloc", "a", "parent", "which", "its", "type", "is", "in",...
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1379-L1395
[ "def", "_check_not_in_finally", "(", "self", ",", "node", ",", "node_name", ",", "breaker_classes", "=", "(", ")", ")", ":", "# if self._tryfinallys is empty, we're not an in try...finally block", "if", "not", "self", ".", "_tryfinallys", ":", "return", "# the node coul...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BasicChecker._check_reversed
check that the argument to `reversed` is a sequence
pylint/checkers/base.py
def _check_reversed(self, node): """ check that the argument to `reversed` is a sequence """ try: argument = utils.safe_infer(utils.get_argument_from_call(node, position=0)) except utils.NoSuchArgumentError: pass else: if argument is astroid.Uninferabl...
def _check_reversed(self, node): """ check that the argument to `reversed` is a sequence """ try: argument = utils.safe_infer(utils.get_argument_from_call(node, position=0)) except utils.NoSuchArgumentError: pass else: if argument is astroid.Uninferabl...
[ "check", "that", "the", "argument", "to", "reversed", "is", "a", "sequence" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1397-L1454
[ "def", "_check_reversed", "(", "self", ",", "node", ")", ":", "try", ":", "argument", "=", "utils", ".", "safe_infer", "(", "utils", ".", "get_argument_from_call", "(", "node", ",", "position", "=", "0", ")", ")", "except", "utils", ".", "NoSuchArgumentErr...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
NameChecker.visit_assignname
check module level assigned names
pylint/checkers/base.py
def visit_assignname(self, node): """check module level assigned names""" self._check_assign_to_new_keyword_violation(node.name, node) frame = node.frame() assign_type = node.assign_type() if isinstance(assign_type, astroid.Comprehension): self._check_name("inlinevar"...
def visit_assignname(self, node): """check module level assigned names""" self._check_assign_to_new_keyword_violation(node.name, node) frame = node.frame() assign_type = node.assign_type() if isinstance(assign_type, astroid.Comprehension): self._check_name("inlinevar"...
[ "check", "module", "level", "assigned", "names" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1759-L1784
[ "def", "visit_assignname", "(", "self", ",", "node", ")", ":", "self", ".", "_check_assign_to_new_keyword_violation", "(", "node", ".", "name", ",", "node", ")", "frame", "=", "node", ".", "frame", "(", ")", "assign_type", "=", "node", ".", "assign_type", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
NameChecker._recursive_check_names
check names in a possibly recursive list <arg>
pylint/checkers/base.py
def _recursive_check_names(self, args, node): """check names in a possibly recursive list <arg>""" for arg in args: if isinstance(arg, astroid.AssignName): self._check_name("argument", arg.name, node) else: self._recursive_check_names(arg.elts, nod...
def _recursive_check_names(self, args, node): """check names in a possibly recursive list <arg>""" for arg in args: if isinstance(arg, astroid.AssignName): self._check_name("argument", arg.name, node) else: self._recursive_check_names(arg.elts, nod...
[ "check", "names", "in", "a", "possibly", "recursive", "list", "<arg", ">" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1786-L1792
[ "def", "_recursive_check_names", "(", "self", ",", "args", ",", "node", ")", ":", "for", "arg", "in", "args", ":", "if", "isinstance", "(", "arg", ",", "astroid", ".", "AssignName", ")", ":", "self", ".", "_check_name", "(", "\"argument\"", ",", "arg", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
NameChecker._check_name
check for a name using the type's regexp
pylint/checkers/base.py
def _check_name(self, node_type, name, node, confidence=interfaces.HIGH): """check for a name using the type's regexp""" def _should_exempt_from_invalid_name(node): if node_type == "variable": inferred = utils.safe_infer(node) if isinstance(inferred, astroid....
def _check_name(self, node_type, name, node, confidence=interfaces.HIGH): """check for a name using the type's regexp""" def _should_exempt_from_invalid_name(node): if node_type == "variable": inferred = utils.safe_infer(node) if isinstance(inferred, astroid....
[ "check", "for", "a", "name", "using", "the", "type", "s", "regexp" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1807-L1837
[ "def", "_check_name", "(", "self", ",", "node_type", ",", "name", ",", "node", ",", "confidence", "=", "interfaces", ".", "HIGH", ")", ":", "def", "_should_exempt_from_invalid_name", "(", "node", ")", ":", "if", "node_type", "==", "\"variable\"", ":", "infer...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
DocStringChecker._check_docstring
check the node has a non empty docstring
pylint/checkers/base.py
def _check_docstring( self, node_type, node, report_missing=True, confidence=interfaces.HIGH ): """check the node has a non empty docstring""" docstring = node.doc if docstring is None: if not report_missing: return lines = utils.get_node_last_...
def _check_docstring( self, node_type, node, report_missing=True, confidence=interfaces.HIGH ): """check the node has a non empty docstring""" docstring = node.doc if docstring is None: if not report_missing: return lines = utils.get_node_last_...
[ "check", "the", "node", "has", "a", "non", "empty", "docstring" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1957-L1998
[ "def", "_check_docstring", "(", "self", ",", "node_type", ",", "node", ",", "report_missing", "=", "True", ",", "confidence", "=", "interfaces", ".", "HIGH", ")", ":", "docstring", "=", "node", ".", "doc", "if", "docstring", "is", "None", ":", "if", "not...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ComparisonChecker._check_literal_comparison
Check if we compare to a literal, which is usually what we do not want to do.
pylint/checkers/base.py
def _check_literal_comparison(self, literal, node): """Check if we compare to a literal, which is usually what we do not want to do.""" nodes = (astroid.List, astroid.Tuple, astroid.Dict, astroid.Set) is_other_literal = isinstance(literal, nodes) is_const = False if isinstance(li...
def _check_literal_comparison(self, literal, node): """Check if we compare to a literal, which is usually what we do not want to do.""" nodes = (astroid.List, astroid.Tuple, astroid.Dict, astroid.Set) is_other_literal = isinstance(literal, nodes) is_const = False if isinstance(li...
[ "Check", "if", "we", "compare", "to", "a", "literal", "which", "is", "usually", "what", "we", "do", "not", "want", "to", "do", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L2107-L2119
[ "def", "_check_literal_comparison", "(", "self", ",", "literal", ",", "node", ")", ":", "nodes", "=", "(", "astroid", ".", "List", ",", "astroid", ".", "Tuple", ",", "astroid", ".", "Dict", ",", "astroid", ".", "Set", ")", "is_other_literal", "=", "isins...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ComparisonChecker._check_logical_tautology
Check if identifier is compared against itself. :param node: Compare node :type node: astroid.node_classes.Compare :Example: val = 786 if val == val: # [comparison-with-itself] pass
pylint/checkers/base.py
def _check_logical_tautology(self, node): """Check if identifier is compared against itself. :param node: Compare node :type node: astroid.node_classes.Compare :Example: val = 786 if val == val: # [comparison-with-itself] pass """ left_operand...
def _check_logical_tautology(self, node): """Check if identifier is compared against itself. :param node: Compare node :type node: astroid.node_classes.Compare :Example: val = 786 if val == val: # [comparison-with-itself] pass """ left_operand...
[ "Check", "if", "identifier", "is", "compared", "against", "itself", ".", ":", "param", "node", ":", "Compare", "node", ":", "type", "node", ":", "astroid", ".", "node_classes", ".", "Compare", ":", "Example", ":", "val", "=", "786", "if", "val", "==", ...
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L2128-L2153
[ "def", "_check_logical_tautology", "(", "self", ",", "node", ")", ":", "left_operand", "=", "node", ".", "left", "right_operand", "=", "node", ".", "ops", "[", "0", "]", "[", "1", "]", "operator", "=", "node", ".", "ops", "[", "0", "]", "[", "0", "...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ComparisonChecker._check_type_x_is_y
Check for expressions like type(x) == Y.
pylint/checkers/base.py
def _check_type_x_is_y(self, node, left, operator, right): """Check for expressions like type(x) == Y.""" left_func = utils.safe_infer(left.func) if not ( isinstance(left_func, astroid.ClassDef) and left_func.qname() == TYPE_QNAME ): return if operator in...
def _check_type_x_is_y(self, node, left, operator, right): """Check for expressions like type(x) == Y.""" left_func = utils.safe_infer(left.func) if not ( isinstance(left_func, astroid.ClassDef) and left_func.qname() == TYPE_QNAME ): return if operator in...
[ "Check", "for", "expressions", "like", "type", "(", "x", ")", "==", "Y", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L2214-L2233
[ "def", "_check_type_x_is_y", "(", "self", ",", "node", ",", "left", ",", "operator", ",", "right", ")", ":", "left_func", "=", "utils", ".", "safe_infer", "(", "left", ".", "func", ")", "if", "not", "(", "isinstance", "(", "left_func", ",", "astroid", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
PathGraphingAstVisitor._subgraph
create the subgraphs representing any `if` and `for` statements
pylint/extensions/mccabe.py
def _subgraph(self, node, name, extra_blocks=()): """create the subgraphs representing any `if` and `for` statements""" if self.graph is None: # global loop self.graph = PathGraph(node) self._subgraph_parse(node, node, extra_blocks) self.graphs["%s%s" % (s...
def _subgraph(self, node, name, extra_blocks=()): """create the subgraphs representing any `if` and `for` statements""" if self.graph is None: # global loop self.graph = PathGraph(node) self._subgraph_parse(node, node, extra_blocks) self.graphs["%s%s" % (s...
[ "create", "the", "subgraphs", "representing", "any", "if", "and", "for", "statements" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/extensions/mccabe.py#L107-L117
[ "def", "_subgraph", "(", "self", ",", "node", ",", "name", ",", "extra_blocks", "=", "(", ")", ")", ":", "if", "self", ".", "graph", "is", "None", ":", "# global loop", "self", ".", "graph", "=", "PathGraph", "(", "node", ")", "self", ".", "_subgraph...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
PathGraphingAstVisitor._subgraph_parse
parse the body and any `else` block of `if` and `for` statements
pylint/extensions/mccabe.py
def _subgraph_parse( self, node, pathnode, extra_blocks ): # pylint: disable=unused-argument """parse the body and any `else` block of `if` and `for` statements""" loose_ends = [] self.tail = node self.dispatch_list(node.body) loose_ends.append(self.tail) for...
def _subgraph_parse( self, node, pathnode, extra_blocks ): # pylint: disable=unused-argument """parse the body and any `else` block of `if` and `for` statements""" loose_ends = [] self.tail = node self.dispatch_list(node.body) loose_ends.append(self.tail) for...
[ "parse", "the", "body", "and", "any", "else", "block", "of", "if", "and", "for", "statements" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/extensions/mccabe.py#L119-L142
[ "def", "_subgraph_parse", "(", "self", ",", "node", ",", "pathnode", ",", "extra_blocks", ")", ":", "# pylint: disable=unused-argument", "loose_ends", "=", "[", "]", "self", ".", "tail", "=", "node", "self", ".", "dispatch_list", "(", "node", ".", "body", ")...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
McCabeMethodChecker.visit_module
visit an astroid.Module node to check too complex rating and add message if is greather than max_complexity stored from options
pylint/extensions/mccabe.py
def visit_module(self, node): """visit an astroid.Module node to check too complex rating and add message if is greather than max_complexity stored from options""" visitor = PathGraphingAstVisitor() for child in node.body: visitor.preorder(child, visitor) for graph in...
def visit_module(self, node): """visit an astroid.Module node to check too complex rating and add message if is greather than max_complexity stored from options""" visitor = PathGraphingAstVisitor() for child in node.body: visitor.preorder(child, visitor) for graph in...
[ "visit", "an", "astroid", ".", "Module", "node", "to", "check", "too", "complex", "rating", "and", "add", "message", "if", "is", "greather", "than", "max_complexity", "stored", "from", "options" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/extensions/mccabe.py#L174-L191
[ "def", "visit_module", "(", "self", ",", "node", ")", ":", "visitor", "=", "PathGraphingAstVisitor", "(", ")", "for", "child", "in", "node", ".", "body", ":", "visitor", ".", "preorder", "(", "child", ",", "visitor", ")", "for", "graph", "in", "visitor",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ASTWalker.add_checker
walk to the checker's dir and collect visit and leave methods
pylint/utils/ast_walker.py
def add_checker(self, checker): """walk to the checker's dir and collect visit and leave methods""" # XXX : should be possible to merge needed_checkers and add_checker vcids = set() lcids = set() visits = self.visit_events leaves = self.leave_events for member in ...
def add_checker(self, checker): """walk to the checker's dir and collect visit and leave methods""" # XXX : should be possible to merge needed_checkers and add_checker vcids = set() lcids = set() visits = self.visit_events leaves = self.leave_events for member in ...
[ "walk", "to", "the", "checker", "s", "dir", "and", "collect", "visit", "and", "leave", "methods" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/ast_walker.py#L27-L55
[ "def", "add_checker", "(", "self", ",", "checker", ")", ":", "# XXX : should be possible to merge needed_checkers and add_checker", "vcids", "=", "set", "(", ")", "lcids", "=", "set", "(", ")", "visits", "=", "self", ".", "visit_events", "leaves", "=", "self", "...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ASTWalker.walk
call visit events of astroid checkers for the given node, recurse on its children, then leave events.
pylint/utils/ast_walker.py
def walk(self, astroid): """call visit events of astroid checkers for the given node, recurse on its children, then leave events. """ cid = astroid.__class__.__name__.lower() # Detect if the node is a new name for a deprecated alias. # In this case, favour the methods fo...
def walk(self, astroid): """call visit events of astroid checkers for the given node, recurse on its children, then leave events. """ cid = astroid.__class__.__name__.lower() # Detect if the node is a new name for a deprecated alias. # In this case, favour the methods fo...
[ "call", "visit", "events", "of", "astroid", "checkers", "for", "the", "given", "node", "recurse", "on", "its", "children", "then", "leave", "events", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/ast_walker.py#L58-L80
[ "def", "walk", "(", "self", ",", "astroid", ")", ":", "cid", "=", "astroid", ".", "__class__", ".", "__name__", ".", "lower", "(", ")", "# Detect if the node is a new name for a deprecated alias.", "# In this case, favour the methods for the deprecated", "# alias if any, i...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassDiagram.add_relationship
create a relation ship
pylint/pyreverse/diagrams.py
def add_relationship(self, from_object, to_object, relation_type, name=None): """create a relation ship """ rel = Relationship(from_object, to_object, relation_type, name) self.relationships.setdefault(relation_type, []).append(rel)
def add_relationship(self, from_object, to_object, relation_type, name=None): """create a relation ship """ rel = Relationship(from_object, to_object, relation_type, name) self.relationships.setdefault(relation_type, []).append(rel)
[ "create", "a", "relation", "ship" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L68-L72
[ "def", "add_relationship", "(", "self", ",", "from_object", ",", "to_object", ",", "relation_type", ",", "name", "=", "None", ")", ":", "rel", "=", "Relationship", "(", "from_object", ",", "to_object", ",", "relation_type", ",", "name", ")", "self", ".", "...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassDiagram.get_relationship
return a relation ship or None
pylint/pyreverse/diagrams.py
def get_relationship(self, from_object, relation_type): """return a relation ship or None """ for rel in self.relationships.get(relation_type, ()): if rel.from_object is from_object: return rel raise KeyError(relation_type)
def get_relationship(self, from_object, relation_type): """return a relation ship or None """ for rel in self.relationships.get(relation_type, ()): if rel.from_object is from_object: return rel raise KeyError(relation_type)
[ "return", "a", "relation", "ship", "or", "None" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L74-L80
[ "def", "get_relationship", "(", "self", ",", "from_object", ",", "relation_type", ")", ":", "for", "rel", "in", "self", ".", "relationships", ".", "get", "(", "relation_type", ",", "(", ")", ")", ":", "if", "rel", ".", "from_object", "is", "from_object", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassDiagram.get_attrs
return visible attributes, possibly with class name
pylint/pyreverse/diagrams.py
def get_attrs(self, node): """return visible attributes, possibly with class name""" attrs = [] properties = [ (n, m) for n, m in node.items() if isinstance(m, astroid.FunctionDef) and decorated_with_property(m) ] for node_name, associated_node...
def get_attrs(self, node): """return visible attributes, possibly with class name""" attrs = [] properties = [ (n, m) for n, m in node.items() if isinstance(m, astroid.FunctionDef) and decorated_with_property(m) ] for node_name, associated_node...
[ "return", "visible", "attributes", "possibly", "with", "class", "name" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L82-L101
[ "def", "get_attrs", "(", "self", ",", "node", ")", ":", "attrs", "=", "[", "]", "properties", "=", "[", "(", "n", ",", "m", ")", "for", "n", ",", "m", "in", "node", ".", "items", "(", ")", "if", "isinstance", "(", "m", ",", "astroid", ".", "F...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassDiagram.get_methods
return visible methods
pylint/pyreverse/diagrams.py
def get_methods(self, node): """return visible methods""" methods = [ m for m in node.values() if isinstance(m, astroid.FunctionDef) and not decorated_with_property(m) and self.show_attr(m.name) ] return sorted(methods, key=lamb...
def get_methods(self, node): """return visible methods""" methods = [ m for m in node.values() if isinstance(m, astroid.FunctionDef) and not decorated_with_property(m) and self.show_attr(m.name) ] return sorted(methods, key=lamb...
[ "return", "visible", "methods" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L103-L112
[ "def", "get_methods", "(", "self", ",", "node", ")", ":", "methods", "=", "[", "m", "for", "m", "in", "node", ".", "values", "(", ")", "if", "isinstance", "(", "m", ",", "astroid", ".", "FunctionDef", ")", "and", "not", "decorated_with_property", "(", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassDiagram.add_object
create a diagram object
pylint/pyreverse/diagrams.py
def add_object(self, title, node): """create a diagram object """ assert node not in self._nodes ent = DiagramEntity(title, node) self._nodes[node] = ent self.objects.append(ent)
def add_object(self, title, node): """create a diagram object """ assert node not in self._nodes ent = DiagramEntity(title, node) self._nodes[node] = ent self.objects.append(ent)
[ "create", "a", "diagram", "object" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L114-L120
[ "def", "add_object", "(", "self", ",", "title", ",", "node", ")", ":", "assert", "node", "not", "in", "self", ".", "_nodes", "ent", "=", "DiagramEntity", "(", "title", ",", "node", ")", "self", ".", "_nodes", "[", "node", "]", "=", "ent", "self", "...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassDiagram.class_names
return class names if needed in diagram
pylint/pyreverse/diagrams.py
def class_names(self, nodes): """return class names if needed in diagram""" names = [] for node in nodes: if isinstance(node, astroid.Instance): node = node._proxied if ( isinstance(node, astroid.ClassDef) and hasattr(node, ...
def class_names(self, nodes): """return class names if needed in diagram""" names = [] for node in nodes: if isinstance(node, astroid.Instance): node = node._proxied if ( isinstance(node, astroid.ClassDef) and hasattr(node, ...
[ "return", "class", "names", "if", "needed", "in", "diagram" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L122-L136
[ "def", "class_names", "(", "self", ",", "nodes", ")", ":", "names", "=", "[", "]", "for", "node", "in", "nodes", ":", "if", "isinstance", "(", "node", ",", "astroid", ".", "Instance", ")", ":", "node", "=", "node", ".", "_proxied", "if", "(", "isin...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassDiagram.classes
return all class nodes in the diagram
pylint/pyreverse/diagrams.py
def classes(self): """return all class nodes in the diagram""" return [o for o in self.objects if isinstance(o.node, astroid.ClassDef)]
def classes(self): """return all class nodes in the diagram""" return [o for o in self.objects if isinstance(o.node, astroid.ClassDef)]
[ "return", "all", "class", "nodes", "in", "the", "diagram" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L153-L155
[ "def", "classes", "(", "self", ")", ":", "return", "[", "o", "for", "o", "in", "self", ".", "objects", "if", "isinstance", "(", "o", ".", "node", ",", "astroid", ".", "ClassDef", ")", "]" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassDiagram.classe
return a class by its name, raise KeyError if not found
pylint/pyreverse/diagrams.py
def classe(self, name): """return a class by its name, raise KeyError if not found """ for klass in self.classes(): if klass.node.name == name: return klass raise KeyError(name)
def classe(self, name): """return a class by its name, raise KeyError if not found """ for klass in self.classes(): if klass.node.name == name: return klass raise KeyError(name)
[ "return", "a", "class", "by", "its", "name", "raise", "KeyError", "if", "not", "found" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L157-L163
[ "def", "classe", "(", "self", ",", "name", ")", ":", "for", "klass", "in", "self", ".", "classes", "(", ")", ":", "if", "klass", ".", "node", ".", "name", "==", "name", ":", "return", "klass", "raise", "KeyError", "(", "name", ")" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassDiagram.extract_relationships
extract relation ships between nodes in the diagram
pylint/pyreverse/diagrams.py
def extract_relationships(self): """extract relation ships between nodes in the diagram """ for obj in self.classes(): node = obj.node obj.attrs = self.get_attrs(node) obj.methods = self.get_methods(node) # shape if is_interface(node): ...
def extract_relationships(self): """extract relation ships between nodes in the diagram """ for obj in self.classes(): node = obj.node obj.attrs = self.get_attrs(node) obj.methods = self.get_methods(node) # shape if is_interface(node): ...
[ "extract", "relation", "ships", "between", "nodes", "in", "the", "diagram" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L165-L204
[ "def", "extract_relationships", "(", "self", ")", ":", "for", "obj", "in", "self", ".", "classes", "(", ")", ":", "node", "=", "obj", ".", "node", "obj", ".", "attrs", "=", "self", ".", "get_attrs", "(", "node", ")", "obj", ".", "methods", "=", "se...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
PackageDiagram.modules
return all module nodes in the diagram
pylint/pyreverse/diagrams.py
def modules(self): """return all module nodes in the diagram""" return [o for o in self.objects if isinstance(o.node, astroid.Module)]
def modules(self): """return all module nodes in the diagram""" return [o for o in self.objects if isinstance(o.node, astroid.Module)]
[ "return", "all", "module", "nodes", "in", "the", "diagram" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L213-L215
[ "def", "modules", "(", "self", ")", ":", "return", "[", "o", "for", "o", "in", "self", ".", "objects", "if", "isinstance", "(", "o", ".", "node", ",", "astroid", ".", "Module", ")", "]" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
PackageDiagram.module
return a module by its name, raise KeyError if not found
pylint/pyreverse/diagrams.py
def module(self, name): """return a module by its name, raise KeyError if not found """ for mod in self.modules(): if mod.node.name == name: return mod raise KeyError(name)
def module(self, name): """return a module by its name, raise KeyError if not found """ for mod in self.modules(): if mod.node.name == name: return mod raise KeyError(name)
[ "return", "a", "module", "by", "its", "name", "raise", "KeyError", "if", "not", "found" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L217-L223
[ "def", "module", "(", "self", ",", "name", ")", ":", "for", "mod", "in", "self", ".", "modules", "(", ")", ":", "if", "mod", ".", "node", ".", "name", "==", "name", ":", "return", "mod", "raise", "KeyError", "(", "name", ")" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
PackageDiagram.get_module
return a module by its name, looking also for relative imports; raise KeyError if not found
pylint/pyreverse/diagrams.py
def get_module(self, name, node): """return a module by its name, looking also for relative imports; raise KeyError if not found """ for mod in self.modules(): mod_name = mod.node.name if mod_name == name: return mod # search for fullna...
def get_module(self, name, node): """return a module by its name, looking also for relative imports; raise KeyError if not found """ for mod in self.modules(): mod_name = mod.node.name if mod_name == name: return mod # search for fullna...
[ "return", "a", "module", "by", "its", "name", "looking", "also", "for", "relative", "imports", ";", "raise", "KeyError", "if", "not", "found" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L225-L239
[ "def", "get_module", "(", "self", ",", "name", ",", "node", ")", ":", "for", "mod", "in", "self", ".", "modules", "(", ")", ":", "mod_name", "=", "mod", ".", "node", ".", "name", "if", "mod_name", "==", "name", ":", "return", "mod", "# search for ful...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
PackageDiagram.add_from_depend
add dependencies created by from-imports
pylint/pyreverse/diagrams.py
def add_from_depend(self, node, from_module): """add dependencies created by from-imports """ mod_name = node.root().name obj = self.module(mod_name) if from_module not in obj.node.depends: obj.node.depends.append(from_module)
def add_from_depend(self, node, from_module): """add dependencies created by from-imports """ mod_name = node.root().name obj = self.module(mod_name) if from_module not in obj.node.depends: obj.node.depends.append(from_module)
[ "add", "dependencies", "created", "by", "from", "-", "imports" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L241-L247
[ "def", "add_from_depend", "(", "self", ",", "node", ",", "from_module", ")", ":", "mod_name", "=", "node", ".", "root", "(", ")", ".", "name", "obj", "=", "self", ".", "module", "(", "mod_name", ")", "if", "from_module", "not", "in", "obj", ".", "nod...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
PackageDiagram.extract_relationships
extract relation ships between nodes in the diagram
pylint/pyreverse/diagrams.py
def extract_relationships(self): """extract relation ships between nodes in the diagram """ ClassDiagram.extract_relationships(self) for obj in self.classes(): # ownership try: mod = self.object_from_node(obj.node.root()) self.add_r...
def extract_relationships(self): """extract relation ships between nodes in the diagram """ ClassDiagram.extract_relationships(self) for obj in self.classes(): # ownership try: mod = self.object_from_node(obj.node.root()) self.add_r...
[ "extract", "relation", "ships", "between", "nodes", "in", "the", "diagram" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/pyreverse/diagrams.py#L249-L268
[ "def", "extract_relationships", "(", "self", ")", ":", "ClassDiagram", ".", "extract_relationships", "(", "self", ")", "for", "obj", "in", "self", ".", "classes", "(", ")", ":", "# ownership", "try", ":", "mod", "=", "self", ".", "object_from_node", "(", "...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
DocstringParameterChecker.visit_functiondef
Called for function and method definitions (def). :param node: Node for a function or method definition in the AST :type node: :class:`astroid.scoped_nodes.Function`
pylint/extensions/docparams.py
def visit_functiondef(self, node): """Called for function and method definitions (def). :param node: Node for a function or method definition in the AST :type node: :class:`astroid.scoped_nodes.Function` """ node_doc = utils.docstringify(node.doc, self.config.default_docstring_t...
def visit_functiondef(self, node): """Called for function and method definitions (def). :param node: Node for a function or method definition in the AST :type node: :class:`astroid.scoped_nodes.Function` """ node_doc = utils.docstringify(node.doc, self.config.default_docstring_t...
[ "Called", "for", "function", "and", "method", "definitions", "(", "def", ")", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/extensions/docparams.py#L188-L197
[ "def", "visit_functiondef", "(", "self", ",", "node", ")", ":", "node_doc", "=", "utils", ".", "docstringify", "(", "node", ".", "doc", ",", "self", ".", "config", ".", "default_docstring_type", ")", "self", ".", "check_functiondef_params", "(", "node", ",",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
DocstringParameterChecker.check_arguments_in_docstring
Check that all parameters in a function, method or class constructor on the one hand and the parameters mentioned in the parameter documentation (e.g. the Sphinx tags 'param' and 'type') on the other hand are consistent with each other. * Undocumented parameters except 'self' are notice...
pylint/extensions/docparams.py
def check_arguments_in_docstring( self, doc, arguments_node, warning_node, accept_no_param_doc=None ): """Check that all parameters in a function, method or class constructor on the one hand and the parameters mentioned in the parameter documentation (e.g. the Sphinx tags 'param' and...
def check_arguments_in_docstring( self, doc, arguments_node, warning_node, accept_no_param_doc=None ): """Check that all parameters in a function, method or class constructor on the one hand and the parameters mentioned in the parameter documentation (e.g. the Sphinx tags 'param' and...
[ "Check", "that", "all", "parameters", "in", "a", "function", "method", "or", "class", "constructor", "on", "the", "one", "hand", "and", "the", "parameters", "mentioned", "in", "the", "parameter", "documentation", "(", "e", ".", "g", ".", "the", "Sphinx", "...
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/extensions/docparams.py#L327-L454
[ "def", "check_arguments_in_docstring", "(", "self", ",", "doc", ",", "arguments_node", ",", "warning_node", ",", "accept_no_param_doc", "=", "None", ")", ":", "# Tolerate missing param or type declarations if there is a link to", "# another method carrying the same name.", "if", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
DocstringParameterChecker._add_raise_message
Adds a message on :param:`node` for the missing exception type. :param missing_excs: A list of missing exception types. :type missing_excs: set(str) :param node: The node show the message on. :type node: astroid.node_classes.NodeNG
pylint/extensions/docparams.py
def _add_raise_message(self, missing_excs, node): """ Adds a message on :param:`node` for the missing exception type. :param missing_excs: A list of missing exception types. :type missing_excs: set(str) :param node: The node show the message on. :type node: astroid.node...
def _add_raise_message(self, missing_excs, node): """ Adds a message on :param:`node` for the missing exception type. :param missing_excs: A list of missing exception types. :type missing_excs: set(str) :param node: The node show the message on. :type node: astroid.node...
[ "Adds", "a", "message", "on", ":", "param", ":", "node", "for", "the", "missing", "exception", "type", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/extensions/docparams.py#L468-L489
[ "def", "_add_raise_message", "(", "self", ",", "missing_excs", ",", "node", ")", ":", "if", "node", ".", "is_abstract", "(", ")", ":", "try", ":", "missing_excs", ".", "remove", "(", "\"NotImplementedError\"", ")", "except", "KeyError", ":", "pass", "if", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
bind_cache_grant
Configures an :class:`OAuth2Provider` instance to use various caching systems to get and set the grant token. This removes the need to register :func:`grantgetter` and :func:`grantsetter` yourself. :param app: Flask application instance :param provider: :class:`OAuth2Provider` instance :param curre...
flask_oauthlib/contrib/oauth2.py
def bind_cache_grant(app, provider, current_user, config_prefix='OAUTH2'): """Configures an :class:`OAuth2Provider` instance to use various caching systems to get and set the grant token. This removes the need to register :func:`grantgetter` and :func:`grantsetter` yourself. :param app: Flask applicati...
def bind_cache_grant(app, provider, current_user, config_prefix='OAUTH2'): """Configures an :class:`OAuth2Provider` instance to use various caching systems to get and set the grant token. This removes the need to register :func:`grantgetter` and :func:`grantsetter` yourself. :param app: Flask applicati...
[ "Configures", "an", ":", "class", ":", "OAuth2Provider", "instance", "to", "use", "various", "caching", "systems", "to", "get", "and", "set", "the", "grant", "token", ".", "This", "removes", "the", "need", "to", "register", ":", "func", ":", "grantgetter", ...
lepture/flask-oauthlib
python
https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/contrib/oauth2.py#L66-L118
[ "def", "bind_cache_grant", "(", "app", ",", "provider", ",", "current_user", ",", "config_prefix", "=", "'OAUTH2'", ")", ":", "cache", "=", "Cache", "(", "app", ",", "config_prefix", ")", "@", "provider", ".", "grantsetter", "def", "create_grant", "(", "clie...
9e6f152a5bb360e7496210da21561c3e6d41b0e1
test
bind_sqlalchemy
Configures the given :class:`OAuth2Provider` instance with the required getters and setters for persistence with SQLAlchemy. An example of using all models:: oauth = OAuth2Provider(app) bind_sqlalchemy(oauth, session, user=User, client=Client, token=Token, grant=Grant,...
flask_oauthlib/contrib/oauth2.py
def bind_sqlalchemy(provider, session, user=None, client=None, token=None, grant=None, current_user=None): """Configures the given :class:`OAuth2Provider` instance with the required getters and setters for persistence with SQLAlchemy. An example of using all models:: oauth = OA...
def bind_sqlalchemy(provider, session, user=None, client=None, token=None, grant=None, current_user=None): """Configures the given :class:`OAuth2Provider` instance with the required getters and setters for persistence with SQLAlchemy. An example of using all models:: oauth = OA...
[ "Configures", "the", "given", ":", "class", ":", "OAuth2Provider", "instance", "with", "the", "required", "getters", "and", "setters", "for", "persistence", "with", "SQLAlchemy", "." ]
lepture/flask-oauthlib
python
https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/contrib/oauth2.py#L121-L188
[ "def", "bind_sqlalchemy", "(", "provider", ",", "session", ",", "user", "=", "None", ",", "client", "=", "None", ",", "token", "=", "None", ",", "grant", "=", "None", ",", "current_user", "=", "None", ")", ":", "if", "user", ":", "user_binding", "=", ...
9e6f152a5bb360e7496210da21561c3e6d41b0e1