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
Run.cb_list_groups
List all the check groups that pylint knows about These should be useful to know what check groups someone can disable or enable.
pylint/lint.py
def cb_list_groups(self, *args, **kwargs): """List all the check groups that pylint knows about These should be useful to know what check groups someone can disable or enable. """ for check in self.linter.get_checker_names(): print(check) sys.exit(0)
def cb_list_groups(self, *args, **kwargs): """List all the check groups that pylint knows about These should be useful to know what check groups someone can disable or enable. """ for check in self.linter.get_checker_names(): print(check) sys.exit(0)
[ "List", "all", "the", "check", "groups", "that", "pylint", "knows", "about" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/lint.py#L1737-L1745
[ "def", "cb_list_groups", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "check", "in", "self", ".", "linter", ".", "get_checker_names", "(", ")", ":", "print", "(", "check", ")", "sys", ".", "exit", "(", "0", ")" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
normalize_text
Wrap the text on the given line length.
pylint/utils/utils.py
def normalize_text(text, line_len=80, indent=""): """Wrap the text on the given line length.""" return "\n".join( textwrap.wrap( text, width=line_len, initial_indent=indent, subsequent_indent=indent ) )
def normalize_text(text, line_len=80, indent=""): """Wrap the text on the given line length.""" return "\n".join( textwrap.wrap( text, width=line_len, initial_indent=indent, subsequent_indent=indent ) )
[ "Wrap", "the", "text", "on", "the", "given", "line", "length", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/utils.py#L21-L27
[ "def", "normalize_text", "(", "text", ",", "line_len", "=", "80", ",", "indent", "=", "\"\"", ")", ":", "return", "\"\\n\"", ".", "join", "(", "textwrap", ".", "wrap", "(", "text", ",", "width", "=", "line_len", ",", "initial_indent", "=", "indent", ",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
get_module_and_frameid
return the module name and the frame id in the module
pylint/utils/utils.py
def get_module_and_frameid(node): """return the module name and the frame id in the module""" frame = node.frame() module, obj = "", [] while frame: if isinstance(frame, Module): module = frame.name else: obj.append(getattr(frame, "name", "<lambda>")) try:...
def get_module_and_frameid(node): """return the module name and the frame id in the module""" frame = node.frame() module, obj = "", [] while frame: if isinstance(frame, Module): module = frame.name else: obj.append(getattr(frame, "name", "<lambda>")) try:...
[ "return", "the", "module", "name", "and", "the", "frame", "id", "in", "the", "module" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/utils.py#L30-L44
[ "def", "get_module_and_frameid", "(", "node", ")", ":", "frame", "=", "node", ".", "frame", "(", ")", "module", ",", "obj", "=", "\"\"", ",", "[", "]", "while", "frame", ":", "if", "isinstance", "(", "frame", ",", "Module", ")", ":", "module", "=", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
safe_decode
return decoded line from encoding or decode with default encoding
pylint/utils/utils.py
def safe_decode(line, encoding, *args, **kwargs): """return decoded line from encoding or decode with default encoding""" try: return line.decode(encoding or sys.getdefaultencoding(), *args, **kwargs) except LookupError: return line.decode(sys.getdefaultencoding(), *args, **kwargs)
def safe_decode(line, encoding, *args, **kwargs): """return decoded line from encoding or decode with default encoding""" try: return line.decode(encoding or sys.getdefaultencoding(), *args, **kwargs) except LookupError: return line.decode(sys.getdefaultencoding(), *args, **kwargs)
[ "return", "decoded", "line", "from", "encoding", "or", "decode", "with", "default", "encoding" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/utils.py#L54-L59
[ "def", "safe_decode", "(", "line", ",", "encoding", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "line", ".", "decode", "(", "encoding", "or", "sys", ".", "getdefaultencoding", "(", ")", ",", "*", "args", ",", "*", "*"...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_basename_in_blacklist_re
Determines if the basename is matched in a regex blacklist :param str base_name: The basename of the file :param list black_list_re: A collection of regex patterns to match against. Successful matches are blacklisted. :returns: `True` if the basename is blacklisted, `False` otherwise. :rtype: ...
pylint/utils/utils.py
def _basename_in_blacklist_re(base_name, black_list_re): """Determines if the basename is matched in a regex blacklist :param str base_name: The basename of the file :param list black_list_re: A collection of regex patterns to match against. Successful matches are blacklisted. :returns: `True`...
def _basename_in_blacklist_re(base_name, black_list_re): """Determines if the basename is matched in a regex blacklist :param str base_name: The basename of the file :param list black_list_re: A collection of regex patterns to match against. Successful matches are blacklisted. :returns: `True`...
[ "Determines", "if", "the", "basename", "is", "matched", "in", "a", "regex", "blacklist" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/utils.py#L76-L89
[ "def", "_basename_in_blacklist_re", "(", "base_name", ",", "black_list_re", ")", ":", "for", "file_pattern", "in", "black_list_re", ":", "if", "file_pattern", ".", "match", "(", "base_name", ")", ":", "return", "True", "return", "False" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
expand_modules
take a list of files/modules/packages and return the list of tuple (file, module name) which have to be actually checked
pylint/utils/utils.py
def expand_modules(files_or_modules, black_list, black_list_re): """take a list of files/modules/packages and return the list of tuple (file, module name) which have to be actually checked """ result = [] errors = [] for something in files_or_modules: if basename(something) in black_list...
def expand_modules(files_or_modules, black_list, black_list_re): """take a list of files/modules/packages and return the list of tuple (file, module name) which have to be actually checked """ result = [] errors = [] for something in files_or_modules: if basename(something) in black_list...
[ "take", "a", "list", "of", "files", "/", "modules", "/", "packages", "and", "return", "the", "list", "of", "tuple", "(", "file", "module", "name", ")", "which", "have", "to", "be", "actually", "checked" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/utils.py#L101-L184
[ "def", "expand_modules", "(", "files_or_modules", ",", "black_list", ",", "black_list_re", ")", ":", "result", "=", "[", "]", "errors", "=", "[", "]", "for", "something", "in", "files_or_modules", ":", "if", "basename", "(", "something", ")", "in", "black_li...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
register_plugins
load all module and package in the given directory, looking for a 'register' function in each one, used to register pylint checkers
pylint/utils/utils.py
def register_plugins(linter, directory): """load all module and package in the given directory, looking for a 'register' function in each one, used to register pylint checkers """ imported = {} for filename in listdir(directory): base, extension = splitext(filename) if base in import...
def register_plugins(linter, directory): """load all module and package in the given directory, looking for a 'register' function in each one, used to register pylint checkers """ imported = {} for filename in listdir(directory): base, extension = splitext(filename) if base in import...
[ "load", "all", "module", "and", "package", "in", "the", "given", "directory", "looking", "for", "a", "register", "function", "in", "each", "one", "used", "to", "register", "pylint", "checkers" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/utils.py#L187-L213
[ "def", "register_plugins", "(", "linter", ",", "directory", ")", ":", "imported", "=", "{", "}", "for", "filename", "in", "listdir", "(", "directory", ")", ":", "base", ",", "extension", "=", "splitext", "(", "filename", ")", "if", "base", "in", "importe...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
get_global_option
Retrieve an option defined by the given *checker* or by all known option providers. It will look in the list of all options providers until the given *option* will be found. If the option wasn't found, the *default* value will be returned.
pylint/utils/utils.py
def get_global_option(checker, option, default=None): """ Retrieve an option defined by the given *checker* or by all known option providers. It will look in the list of all options providers until the given *option* will be found. If the option wasn't found, the *default* value will be returned. ...
def get_global_option(checker, option, default=None): """ Retrieve an option defined by the given *checker* or by all known option providers. It will look in the list of all options providers until the given *option* will be found. If the option wasn't found, the *default* value will be returned. ...
[ "Retrieve", "an", "option", "defined", "by", "the", "given", "*", "checker", "*", "or", "by", "all", "known", "option", "providers", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/utils.py#L216-L235
[ "def", "get_global_option", "(", "checker", ",", "option", ",", "default", "=", "None", ")", ":", "# First, try in the given checker's config.", "# After that, look in the options providers.", "try", ":", "return", "getattr", "(", "checker", ".", "config", ",", "option"...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_splitstrip
return a list of stripped string by splitting the string given as argument on `sep` (',' by default). Empty string are discarded. >>> _splitstrip('a, b, c , 4,,') ['a', 'b', 'c', '4'] >>> _splitstrip('a') ['a'] >>> _splitstrip('a,\nb,\nc,') ['a', 'b', 'c'] :type string: str or unico...
pylint/utils/utils.py
def _splitstrip(string, sep=","): """return a list of stripped string by splitting the string given as argument on `sep` (',' by default). Empty string are discarded. >>> _splitstrip('a, b, c , 4,,') ['a', 'b', 'c', '4'] >>> _splitstrip('a') ['a'] >>> _splitstrip('a,\nb,\nc,') ['a', ...
def _splitstrip(string, sep=","): """return a list of stripped string by splitting the string given as argument on `sep` (',' by default). Empty string are discarded. >>> _splitstrip('a, b, c , 4,,') ['a', 'b', 'c', '4'] >>> _splitstrip('a') ['a'] >>> _splitstrip('a,\nb,\nc,') ['a', ...
[ "return", "a", "list", "of", "stripped", "string", "by", "splitting", "the", "string", "given", "as", "argument", "on", "sep", "(", "by", "default", ")", ".", "Empty", "string", "are", "discarded", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/utils.py#L258-L278
[ "def", "_splitstrip", "(", "string", ",", "sep", "=", "\",\"", ")", ":", "return", "[", "word", ".", "strip", "(", ")", "for", "word", "in", "string", ".", "split", "(", "sep", ")", "if", "word", ".", "strip", "(", ")", "]" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_unquote
remove optional quotes (simple or double) from the string :type string: str or unicode :param string: an optionally quoted string :rtype: str or unicode :return: the unquoted string (or the input string if it wasn't quoted)
pylint/utils/utils.py
def _unquote(string): """remove optional quotes (simple or double) from the string :type string: str or unicode :param string: an optionally quoted string :rtype: str or unicode :return: the unquoted string (or the input string if it wasn't quoted) """ if not string: return string ...
def _unquote(string): """remove optional quotes (simple or double) from the string :type string: str or unicode :param string: an optionally quoted string :rtype: str or unicode :return: the unquoted string (or the input string if it wasn't quoted) """ if not string: return string ...
[ "remove", "optional", "quotes", "(", "simple", "or", "double", ")", "from", "the", "string" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/utils.py#L281-L296
[ "def", "_unquote", "(", "string", ")", ":", "if", "not", "string", ":", "return", "string", "if", "string", "[", "0", "]", "in", "\"\\\"'\"", ":", "string", "=", "string", "[", "1", ":", "]", "if", "string", "[", "-", "1", "]", "in", "\"\\\"'\"", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_comment
return string as a comment
pylint/utils/utils.py
def _comment(string): """return string as a comment""" lines = [line.strip() for line in string.splitlines()] return "# " + ("%s# " % linesep).join(lines)
def _comment(string): """return string as a comment""" lines = [line.strip() for line in string.splitlines()] return "# " + ("%s# " % linesep).join(lines)
[ "return", "string", "as", "a", "comment" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/utils.py#L305-L308
[ "def", "_comment", "(", "string", ")", ":", "lines", "=", "[", "line", ".", "strip", "(", ")", "for", "line", "in", "string", ".", "splitlines", "(", ")", "]", "return", "\"# \"", "+", "(", "\"%s# \"", "%", "linesep", ")", ".", "join", "(", "lines"...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_format_option_value
return the user input's value from a 'compiled' value
pylint/utils/utils.py
def _format_option_value(optdict, value): """return the user input's value from a 'compiled' value""" if isinstance(value, (list, tuple)): value = ",".join(_format_option_value(optdict, item) for item in value) elif isinstance(value, dict): value = ",".join("%s:%s" % (k, v) for k, v in value...
def _format_option_value(optdict, value): """return the user input's value from a 'compiled' value""" if isinstance(value, (list, tuple)): value = ",".join(_format_option_value(optdict, item) for item in value) elif isinstance(value, dict): value = ",".join("%s:%s" % (k, v) for k, v in value...
[ "return", "the", "user", "input", "s", "value", "from", "a", "compiled", "value" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/utils.py#L311-L324
[ "def", "_format_option_value", "(", "optdict", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "(", "list", ",", "tuple", ")", ")", ":", "value", "=", "\",\"", ".", "join", "(", "_format_option_value", "(", "optdict", ",", "item", ")", "...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
format_section
format an options section using the INI format
pylint/utils/utils.py
def format_section(stream, section, options, doc=None): """format an options section using the INI format""" if doc: print(_comment(doc), file=stream) print("[%s]" % section, file=stream) _ini_format(stream, options)
def format_section(stream, section, options, doc=None): """format an options section using the INI format""" if doc: print(_comment(doc), file=stream) print("[%s]" % section, file=stream) _ini_format(stream, options)
[ "format", "an", "options", "section", "using", "the", "INI", "format" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/utils.py#L327-L332
[ "def", "format_section", "(", "stream", ",", "section", ",", "options", ",", "doc", "=", "None", ")", ":", "if", "doc", ":", "print", "(", "_comment", "(", "doc", ")", ",", "file", "=", "stream", ")", "print", "(", "\"[%s]\"", "%", "section", ",", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_ini_format
format options using the INI format
pylint/utils/utils.py
def _ini_format(stream, options): """format options using the INI format""" for optname, optdict, value in options: value = _format_option_value(optdict, value) help_opt = optdict.get("help") if help_opt: help_opt = normalize_text(help_opt, line_len=79, indent="# ") ...
def _ini_format(stream, options): """format options using the INI format""" for optname, optdict, value in options: value = _format_option_value(optdict, value) help_opt = optdict.get("help") if help_opt: help_opt = normalize_text(help_opt, line_len=79, indent="# ") ...
[ "format", "options", "using", "the", "INI", "format" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/utils.py#L335-L355
[ "def", "_ini_format", "(", "stream", ",", "options", ")", ":", "for", "optname", ",", "optdict", ",", "value", "in", "options", ":", "value", "=", "_format_option_value", "(", "optdict", ",", "value", ")", "help_opt", "=", "optdict", ".", "get", "(", "\"...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
VNode.insert
insert a child node
pylint/reporters/ureports/nodes.py
def insert(self, index, child): """insert a child node""" self.children.insert(index, child) child.parent = self
def insert(self, index, child): """insert a child node""" self.children.insert(index, child) child.parent = self
[ "insert", "a", "child", "node" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/ureports/nodes.py#L30-L33
[ "def", "insert", "(", "self", ",", "index", ",", "child", ")", ":", "self", ".", "children", ".", "insert", "(", "index", ",", "child", ")", "child", ".", "parent", "=", "self" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
VNode._get_visit_name
return the visit name for the mixed class. When calling 'accept', the method <'visit_' + name returned by this method> will be called on the visitor
pylint/reporters/ureports/nodes.py
def _get_visit_name(self): """ return the visit name for the mixed class. When calling 'accept', the method <'visit_' + name returned by this method> will be called on the visitor """ try: # pylint: disable=no-member return self.TYPE.replace("-", "...
def _get_visit_name(self): """ return the visit name for the mixed class. When calling 'accept', the method <'visit_' + name returned by this method> will be called on the visitor """ try: # pylint: disable=no-member return self.TYPE.replace("-", "...
[ "return", "the", "visit", "name", "for", "the", "mixed", "class", ".", "When", "calling", "accept", "the", "method", "<", "visit_", "+", "name", "returned", "by", "this", "method", ">", "will", "be", "called", "on", "the", "visitor" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/ureports/nodes.py#L35-L46
[ "def", "_get_visit_name", "(", "self", ")", ":", "try", ":", "# pylint: disable=no-member", "return", "self", ".", "TYPE", ".", "replace", "(", "\"-\"", ",", "\"_\"", ")", "# pylint: disable=broad-except", "except", "Exception", ":", "return", "self", ".", "__cl...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BaseLayout.append
overridden to detect problems easily
pylint/reporters/ureports/nodes.py
def append(self, child): """overridden to detect problems easily""" assert child not in self.parents() VNode.append(self, child)
def append(self, child): """overridden to detect problems easily""" assert child not in self.parents() VNode.append(self, child)
[ "overridden", "to", "detect", "problems", "easily" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/ureports/nodes.py#L72-L75
[ "def", "append", "(", "self", ",", "child", ")", ":", "assert", "child", "not", "in", "self", ".", "parents", "(", ")", "VNode", ".", "append", "(", "self", ",", "child", ")" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BaseLayout.parents
return the ancestor nodes
pylint/reporters/ureports/nodes.py
def parents(self): """return the ancestor nodes""" assert self.parent is not self if self.parent is None: return [] return [self.parent] + self.parent.parents()
def parents(self): """return the ancestor nodes""" assert self.parent is not self if self.parent is None: return [] return [self.parent] + self.parent.parents()
[ "return", "the", "ancestor", "nodes" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/ureports/nodes.py#L77-L82
[ "def", "parents", "(", "self", ")", ":", "assert", "self", ".", "parent", "is", "not", "self", "if", "self", ".", "parent", "is", "None", ":", "return", "[", "]", "return", "[", "self", ".", "parent", "]", "+", "self", ".", "parent", ".", "parents"...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BaseWriter.format
format and write the given layout into the stream object unicode policy: unicode strings may be found in the layout; try to call stream.write with it, but give it back encoded using the given encoding if it fails
pylint/reporters/ureports/__init__.py
def format(self, layout, stream=None, encoding=None): """format and write the given layout into the stream object unicode policy: unicode strings may be found in the layout; try to call stream.write with it, but give it back encoded using the given encoding if it fails """ ...
def format(self, layout, stream=None, encoding=None): """format and write the given layout into the stream object unicode policy: unicode strings may be found in the layout; try to call stream.write with it, but give it back encoded using the given encoding if it fails """ ...
[ "format", "and", "write", "the", "given", "layout", "into", "the", "stream", "object" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/ureports/__init__.py#L22-L37
[ "def", "format", "(", "self", ",", "layout", ",", "stream", "=", "None", ",", "encoding", "=", "None", ")", ":", "if", "stream", "is", "None", ":", "stream", "=", "sys", ".", "stdout", "if", "not", "encoding", ":", "encoding", "=", "getattr", "(", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BaseWriter.get_table_content
trick to get table content without actually writing it return an aligned list of lists containing table cells values as string
pylint/reporters/ureports/__init__.py
def get_table_content(self, table): """trick to get table content without actually writing it return an aligned list of lists containing table cells values as string """ result = [[]] cols = table.cols for cell in self.compute_content(table): if cols == 0: ...
def get_table_content(self, table): """trick to get table content without actually writing it return an aligned list of lists containing table cells values as string """ result = [[]] cols = table.cols for cell in self.compute_content(table): if cols == 0: ...
[ "trick", "to", "get", "table", "content", "without", "actually", "writing", "it" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/ureports/__init__.py#L61-L77
[ "def", "get_table_content", "(", "self", ",", "table", ")", ":", "result", "=", "[", "[", "]", "]", "cols", "=", "table", ".", "cols", "for", "cell", "in", "self", ".", "compute_content", "(", "table", ")", ":", "if", "cols", "==", "0", ":", "resul...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
BaseWriter.compute_content
trick to compute the formatting of children layout before actually writing it return an iterator on strings (one for each child element)
pylint/reporters/ureports/__init__.py
def compute_content(self, layout): """trick to compute the formatting of children layout before actually writing it return an iterator on strings (one for each child element) """ # Patch the underlying output stream with a fresh-generated stream, # which is used to store...
def compute_content(self, layout): """trick to compute the formatting of children layout before actually writing it return an iterator on strings (one for each child element) """ # Patch the underlying output stream with a fresh-generated stream, # which is used to store...
[ "trick", "to", "compute", "the", "formatting", "of", "children", "layout", "before", "actually", "writing", "it" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/ureports/__init__.py#L79-L96
[ "def", "compute_content", "(", "self", ",", "layout", ")", ":", "# Patch the underlying output stream with a fresh-generated stream,", "# which is used to store a temporary representation of a child", "# node.", "out", "=", "self", ".", "out", "try", ":", "for", "child", "in"...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
FileState.collect_block_lines
Walk the AST to collect block level options line numbers.
pylint/utils/file_state.py
def collect_block_lines(self, msgs_store, module_node): """Walk the AST to collect block level options line numbers.""" for msg, lines in self._module_msgs_state.items(): self._raw_module_msgs_state[msg] = lines.copy() orig_state = self._module_msgs_state.copy() self._module_...
def collect_block_lines(self, msgs_store, module_node): """Walk the AST to collect block level options line numbers.""" for msg, lines in self._module_msgs_state.items(): self._raw_module_msgs_state[msg] = lines.copy() orig_state = self._module_msgs_state.copy() self._module_...
[ "Walk", "the", "AST", "to", "collect", "block", "level", "options", "line", "numbers", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/file_state.py#L24-L32
[ "def", "collect_block_lines", "(", "self", ",", "msgs_store", ",", "module_node", ")", ":", "for", "msg", ",", "lines", "in", "self", ".", "_module_msgs_state", ".", "items", "(", ")", ":", "self", ".", "_raw_module_msgs_state", "[", "msg", "]", "=", "line...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
FileState._collect_block_lines
Recursively walk (depth first) AST to collect block level options line numbers.
pylint/utils/file_state.py
def _collect_block_lines(self, msgs_store, node, msg_state): """Recursively walk (depth first) AST to collect block level options line numbers. """ for child in node.get_children(): self._collect_block_lines(msgs_store, child, msg_state) first = node.fromlineno ...
def _collect_block_lines(self, msgs_store, node, msg_state): """Recursively walk (depth first) AST to collect block level options line numbers. """ for child in node.get_children(): self._collect_block_lines(msgs_store, child, msg_state) first = node.fromlineno ...
[ "Recursively", "walk", "(", "depth", "first", ")", "AST", "to", "collect", "block", "level", "options", "line", "numbers", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/file_state.py#L34-L93
[ "def", "_collect_block_lines", "(", "self", ",", "msgs_store", ",", "node", ",", "msg_state", ")", ":", "for", "child", "in", "node", ".", "get_children", "(", ")", ":", "self", ".", "_collect_block_lines", "(", "msgs_store", ",", "child", ",", "msg_state", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
FileState.set_msg_status
Set status (enabled/disable) for a given message at a given line
pylint/utils/file_state.py
def set_msg_status(self, msg, line, status): """Set status (enabled/disable) for a given message at a given line""" assert line > 0 try: self._module_msgs_state[msg.msgid][line] = status except KeyError: self._module_msgs_state[msg.msgid] = {line: status}
def set_msg_status(self, msg, line, status): """Set status (enabled/disable) for a given message at a given line""" assert line > 0 try: self._module_msgs_state[msg.msgid][line] = status except KeyError: self._module_msgs_state[msg.msgid] = {line: status}
[ "Set", "status", "(", "enabled", "/", "disable", ")", "for", "a", "given", "message", "at", "a", "given", "line" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/file_state.py#L95-L101
[ "def", "set_msg_status", "(", "self", ",", "msg", ",", "line", ",", "status", ")", ":", "assert", "line", ">", "0", "try", ":", "self", ".", "_module_msgs_state", "[", "msg", ".", "msgid", "]", "[", "line", "]", "=", "status", "except", "KeyError", "...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
FileState.handle_ignored_message
Report an ignored message. state_scope is either MSG_STATE_SCOPE_MODULE or MSG_STATE_SCOPE_CONFIG, depending on whether the message was disabled locally in the module, or globally. The other arguments are the same as for add_message.
pylint/utils/file_state.py
def handle_ignored_message( self, state_scope, msgid, line, node, args, confidence ): # pylint: disable=unused-argument """Report an ignored message. state_scope is either MSG_STATE_SCOPE_MODULE or MSG_STATE_SCOPE_CONFIG, depending on whether the message was disabled locally in the...
def handle_ignored_message( self, state_scope, msgid, line, node, args, confidence ): # pylint: disable=unused-argument """Report an ignored message. state_scope is either MSG_STATE_SCOPE_MODULE or MSG_STATE_SCOPE_CONFIG, depending on whether the message was disabled locally in the...
[ "Report", "an", "ignored", "message", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/utils/file_state.py#L103-L117
[ "def", "handle_ignored_message", "(", "self", ",", "state_scope", ",", "msgid", ",", "line", ",", "node", ",", "args", ",", "confidence", ")", ":", "# pylint: disable=unused-argument", "if", "state_scope", "==", "MSG_STATE_SCOPE_MODULE", ":", "try", ":", "orig_lin...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ReportsHandlerMixIn.register_report
register a report reportid is the unique identifier for the report r_title the report's title r_cb the method to call to make the report checker is the checker defining the report
pylint/reporters/reports_handler_mix_in.py
def register_report(self, reportid, r_title, r_cb, checker): """register a report reportid is the unique identifier for the report r_title the report's title r_cb the method to call to make the report checker is the checker defining the report """ reportid = repo...
def register_report(self, reportid, r_title, r_cb, checker): """register a report reportid is the unique identifier for the report r_title the report's title r_cb the method to call to make the report checker is the checker defining the report """ reportid = repo...
[ "register", "a", "report" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/reports_handler_mix_in.py#L27-L36
[ "def", "register_report", "(", "self", ",", "reportid", ",", "r_title", ",", "r_cb", ",", "checker", ")", ":", "reportid", "=", "reportid", ".", "upper", "(", ")", "self", ".", "_reports", "[", "checker", "]", ".", "append", "(", "(", "reportid", ",", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ReportsHandlerMixIn.enable_report
disable the report of the given id
pylint/reporters/reports_handler_mix_in.py
def enable_report(self, reportid): """disable the report of the given id""" reportid = reportid.upper() self._reports_state[reportid] = True
def enable_report(self, reportid): """disable the report of the given id""" reportid = reportid.upper() self._reports_state[reportid] = True
[ "disable", "the", "report", "of", "the", "given", "id" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/reports_handler_mix_in.py#L38-L41
[ "def", "enable_report", "(", "self", ",", "reportid", ")", ":", "reportid", "=", "reportid", ".", "upper", "(", ")", "self", ".", "_reports_state", "[", "reportid", "]", "=", "True" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ReportsHandlerMixIn.disable_report
disable the report of the given id
pylint/reporters/reports_handler_mix_in.py
def disable_report(self, reportid): """disable the report of the given id""" reportid = reportid.upper() self._reports_state[reportid] = False
def disable_report(self, reportid): """disable the report of the given id""" reportid = reportid.upper() self._reports_state[reportid] = False
[ "disable", "the", "report", "of", "the", "given", "id" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/reports_handler_mix_in.py#L43-L46
[ "def", "disable_report", "(", "self", ",", "reportid", ")", ":", "reportid", "=", "reportid", ".", "upper", "(", ")", "self", ".", "_reports_state", "[", "reportid", "]", "=", "False" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ReportsHandlerMixIn.make_reports
render registered reports
pylint/reporters/reports_handler_mix_in.py
def make_reports(self, stats, old_stats): """render registered reports""" sect = Section("Report", "%s statements analysed." % (self.stats["statement"])) for checker in self.report_order(): for reportid, r_title, r_cb in self._reports[checker]: if not self.report_is_e...
def make_reports(self, stats, old_stats): """render registered reports""" sect = Section("Report", "%s statements analysed." % (self.stats["statement"])) for checker in self.report_order(): for reportid, r_title, r_cb in self._reports[checker]: if not self.report_is_e...
[ "render", "registered", "reports" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/reports_handler_mix_in.py#L54-L68
[ "def", "make_reports", "(", "self", ",", "stats", ",", "old_stats", ")", ":", "sect", "=", "Section", "(", "\"Report\"", ",", "\"%s statements analysed.\"", "%", "(", "self", ".", "stats", "[", "\"statement\"", "]", ")", ")", "for", "checker", "in", "self"...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ReportsHandlerMixIn.add_stats
add some stats entries to the statistic dictionary raise an AssertionError if there is a key conflict
pylint/reporters/reports_handler_mix_in.py
def add_stats(self, **kwargs): """add some stats entries to the statistic dictionary raise an AssertionError if there is a key conflict """ for key, value in kwargs.items(): if key[-1] == "_": key = key[:-1] assert key not in self.stats ...
def add_stats(self, **kwargs): """add some stats entries to the statistic dictionary raise an AssertionError if there is a key conflict """ for key, value in kwargs.items(): if key[-1] == "_": key = key[:-1] assert key not in self.stats ...
[ "add", "some", "stats", "entries", "to", "the", "statistic", "dictionary", "raise", "an", "AssertionError", "if", "there", "is", "a", "key", "conflict" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/reporters/reports_handler_mix_in.py#L70-L79
[ "def", "add_stats", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "key", ",", "value", "in", "kwargs", ".", "items", "(", ")", ":", "if", "key", "[", "-", "1", "]", "==", "\"_\"", ":", "key", "=", "key", "[", ":", "-", "1", "]", "a...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
get_setters_property_name
Get the name of the property that the given node is a setter for. :param node: The node to get the property name for. :type node: str :rtype: str or None :returns: The name of the property that the node is a setter for, or None if one could not be found.
pylint/extensions/_check_docs_utils.py
def get_setters_property_name(node): """Get the name of the property that the given node is a setter for. :param node: The node to get the property name for. :type node: str :rtype: str or None :returns: The name of the property that the node is a setter for, or None if one could not be fo...
def get_setters_property_name(node): """Get the name of the property that the given node is a setter for. :param node: The node to get the property name for. :type node: str :rtype: str or None :returns: The name of the property that the node is a setter for, or None if one could not be fo...
[ "Get", "the", "name", "of", "the", "property", "that", "the", "given", "node", "is", "a", "setter", "for", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/extensions/_check_docs_utils.py#L39-L57
[ "def", "get_setters_property_name", "(", "node", ")", ":", "decorators", "=", "node", ".", "decorators", ".", "nodes", "if", "node", ".", "decorators", "else", "[", "]", "for", "decorator", "in", "decorators", ":", "if", "(", "isinstance", "(", "decorator", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
get_setters_property
Get the property node for the given setter node. :param node: The node to get the property for. :type node: astroid.FunctionDef :rtype: astroid.FunctionDef or None :returns: The node relating to the property of the given setter node, or None if one could not be found.
pylint/extensions/_check_docs_utils.py
def get_setters_property(node): """Get the property node for the given setter node. :param node: The node to get the property for. :type node: astroid.FunctionDef :rtype: astroid.FunctionDef or None :returns: The node relating to the property of the given setter node, or None if one could ...
def get_setters_property(node): """Get the property node for the given setter node. :param node: The node to get the property for. :type node: astroid.FunctionDef :rtype: astroid.FunctionDef or None :returns: The node relating to the property of the given setter node, or None if one could ...
[ "Get", "the", "property", "node", "for", "the", "given", "setter", "node", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/extensions/_check_docs_utils.py#L60-L81
[ "def", "get_setters_property", "(", "node", ")", ":", "property_", "=", "None", "property_name", "=", "get_setters_property_name", "(", "node", ")", "class_node", "=", "utils", ".", "node_frame_class", "(", "node", ")", "if", "property_name", "and", "class_node", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
returns_something
Check if a return node returns a value other than None. :param return_node: The return node to check. :type return_node: astroid.Return :rtype: bool :return: True if the return node returns a value other than None, False otherwise.
pylint/extensions/_check_docs_utils.py
def returns_something(return_node): """Check if a return node returns a value other than None. :param return_node: The return node to check. :type return_node: astroid.Return :rtype: bool :return: True if the return node returns a value other than None, False otherwise. """ returns...
def returns_something(return_node): """Check if a return node returns a value other than None. :param return_node: The return node to check. :type return_node: astroid.Return :rtype: bool :return: True if the return node returns a value other than None, False otherwise. """ returns...
[ "Check", "if", "a", "return", "node", "returns", "a", "value", "other", "than", "None", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/extensions/_check_docs_utils.py#L84-L99
[ "def", "returns_something", "(", "return_node", ")", ":", "returns", "=", "return_node", ".", "value", "if", "returns", "is", "None", ":", "return", "False", "return", "not", "(", "isinstance", "(", "returns", ",", "astroid", ".", "Const", ")", "and", "ret...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
possible_exc_types
Gets all of the possible raised exception types for the given raise node. .. note:: Caught exception types are ignored. :param node: The raise node to find exception types for. :type node: astroid.node_classes.NodeNG :returns: A list of exception types possibly raised by :param:`node`. ...
pylint/extensions/_check_docs_utils.py
def possible_exc_types(node): """ Gets all of the possible raised exception types for the given raise node. .. note:: Caught exception types are ignored. :param node: The raise node to find exception types for. :type node: astroid.node_classes.NodeNG :returns: A list of exception ty...
def possible_exc_types(node): """ Gets all of the possible raised exception types for the given raise node. .. note:: Caught exception types are ignored. :param node: The raise node to find exception types for. :type node: astroid.node_classes.NodeNG :returns: A list of exception ty...
[ "Gets", "all", "of", "the", "possible", "raised", "exception", "types", "for", "the", "given", "raise", "node", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/extensions/_check_docs_utils.py#L110-L159
[ "def", "possible_exc_types", "(", "node", ")", ":", "excs", "=", "[", "]", "if", "isinstance", "(", "node", ".", "exc", ",", "astroid", ".", "Name", ")", ":", "inferred", "=", "utils", ".", "safe_infer", "(", "node", ".", "exc", ")", "if", "inferred"...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
register
required method to auto register this checker
pylint/checkers/misc.py
def register(linter): """required method to auto register this checker""" linter.register_checker(EncodingChecker(linter)) linter.register_checker(ByIdManagedMessagesChecker(linter))
def register(linter): """required method to auto register this checker""" linter.register_checker(EncodingChecker(linter)) linter.register_checker(ByIdManagedMessagesChecker(linter))
[ "required", "method", "to", "auto", "register", "this", "checker" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/misc.py#L179-L182
[ "def", "register", "(", "linter", ")", ":", "linter", ".", "register_checker", "(", "EncodingChecker", "(", "linter", ")", ")", "linter", ".", "register_checker", "(", "ByIdManagedMessagesChecker", "(", "linter", ")", ")" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ByIdManagedMessagesChecker.process_module
inspect the source file to find messages activated or deactivated by id.
pylint/checkers/misc.py
def process_module(self, module): """inspect the source file to find messages activated or deactivated by id.""" managed_msgs = MessagesHandlerMixIn.get_by_id_managed_msgs() for (mod_name, msg_id, msg_symbol, lineno, is_disabled) in managed_msgs: if mod_name == module.name: ...
def process_module(self, module): """inspect the source file to find messages activated or deactivated by id.""" managed_msgs = MessagesHandlerMixIn.get_by_id_managed_msgs() for (mod_name, msg_id, msg_symbol, lineno, is_disabled) in managed_msgs: if mod_name == module.name: ...
[ "inspect", "the", "source", "file", "to", "find", "messages", "activated", "or", "deactivated", "by", "id", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/misc.py#L50-L64
[ "def", "process_module", "(", "self", ",", "module", ")", ":", "managed_msgs", "=", "MessagesHandlerMixIn", ".", "get_by_id_managed_msgs", "(", ")", "for", "(", "mod_name", ",", "msg_id", ",", "msg_symbol", ",", "lineno", ",", "is_disabled", ")", "in", "manage...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
EncodingChecker.process_module
inspect the source file to find encoding problem
pylint/checkers/misc.py
def process_module(self, module): """inspect the source file to find encoding problem""" if module.file_encoding: encoding = module.file_encoding else: encoding = "ascii" with module.stream() as stream: for lineno, line in enumerate(stream): ...
def process_module(self, module): """inspect the source file to find encoding problem""" if module.file_encoding: encoding = module.file_encoding else: encoding = "ascii" with module.stream() as stream: for lineno, line in enumerate(stream): ...
[ "inspect", "the", "source", "file", "to", "find", "encoding", "problem" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/misc.py#L130-L139
[ "def", "process_module", "(", "self", ",", "module", ")", ":", "if", "module", ".", "file_encoding", ":", "encoding", "=", "module", ".", "file_encoding", "else", ":", "encoding", "=", "\"ascii\"", "with", "module", ".", "stream", "(", ")", "as", "stream",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
EncodingChecker.process_tokens
inspect the source to find fixme problems
pylint/checkers/misc.py
def process_tokens(self, tokens): """inspect the source to find fixme problems""" if not self.config.notes: return comments = ( token_info for token_info in tokens if token_info.type == tokenize.COMMENT ) for comment in comments: comment_text =...
def process_tokens(self, tokens): """inspect the source to find fixme problems""" if not self.config.notes: return comments = ( token_info for token_info in tokens if token_info.type == tokenize.COMMENT ) for comment in comments: comment_text =...
[ "inspect", "the", "source", "to", "find", "fixme", "problems" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/misc.py#L141-L176
[ "def", "process_tokens", "(", "self", ",", "tokens", ")", ":", "if", "not", "self", ".", "config", ".", "notes", ":", "return", "comments", "=", "(", "token_info", "for", "token_info", "in", "tokens", "if", "token_info", ".", "type", "==", "tokenize", "....
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_is_from_future_import
Check if the name is a future import from another module.
pylint/checkers/variables.py
def _is_from_future_import(stmt, name): """Check if the name is a future import from another module.""" try: module = stmt.do_import_module(stmt.modname) except astroid.AstroidBuildingException: return None for local_node in module.locals.get(name, []): if isinstance(local_node,...
def _is_from_future_import(stmt, name): """Check if the name is a future import from another module.""" try: module = stmt.do_import_module(stmt.modname) except astroid.AstroidBuildingException: return None for local_node in module.locals.get(name, []): if isinstance(local_node,...
[ "Check", "if", "the", "name", "is", "a", "future", "import", "from", "another", "module", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L67-L77
[ "def", "_is_from_future_import", "(", "stmt", ",", "name", ")", ":", "try", ":", "module", "=", "stmt", ".", "do_import_module", "(", "stmt", ".", "modname", ")", "except", "astroid", ".", "AstroidBuildingException", ":", "return", "None", "for", "local_node",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
in_for_else_branch
Returns True if stmt in inside the else branch for a parent For stmt.
pylint/checkers/variables.py
def in_for_else_branch(parent, stmt): """Returns True if stmt in inside the else branch for a parent For stmt.""" return isinstance(parent, astroid.For) and any( else_stmt.parent_of(stmt) or else_stmt == stmt for else_stmt in parent.orelse )
def in_for_else_branch(parent, stmt): """Returns True if stmt in inside the else branch for a parent For stmt.""" return isinstance(parent, astroid.For) and any( else_stmt.parent_of(stmt) or else_stmt == stmt for else_stmt in parent.orelse )
[ "Returns", "True", "if", "stmt", "in", "inside", "the", "else", "branch", "for", "a", "parent", "For", "stmt", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L80-L84
[ "def", "in_for_else_branch", "(", "parent", ",", "stmt", ")", ":", "return", "isinstance", "(", "parent", ",", "astroid", ".", "For", ")", "and", "any", "(", "else_stmt", ".", "parent_of", "(", "stmt", ")", "or", "else_stmt", "==", "stmt", "for", "else_s...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
overridden_method
get overridden method if any
pylint/checkers/variables.py
def overridden_method(klass, name): """get overridden method if any""" try: parent = next(klass.local_attr_ancestors(name)) except (StopIteration, KeyError): return None try: meth_node = parent[name] except KeyError: # We have found an ancestor defining <name> but it'...
def overridden_method(klass, name): """get overridden method if any""" try: parent = next(klass.local_attr_ancestors(name)) except (StopIteration, KeyError): return None try: meth_node = parent[name] except KeyError: # We have found an ancestor defining <name> but it'...
[ "get", "overridden", "method", "if", "any" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L88-L102
[ "def", "overridden_method", "(", "klass", ",", "name", ")", ":", "try", ":", "parent", "=", "next", "(", "klass", ".", "local_attr_ancestors", "(", "name", ")", ")", "except", "(", "StopIteration", ",", "KeyError", ")", ":", "return", "None", "try", ":",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_get_unpacking_extra_info
return extra information to add to the message for unpacking-non-sequence and unbalanced-tuple-unpacking errors
pylint/checkers/variables.py
def _get_unpacking_extra_info(node, infered): """return extra information to add to the message for unpacking-non-sequence and unbalanced-tuple-unpacking errors """ more = "" infered_module = infered.root().name if node.root().name == infered_module: if node.lineno == infered.lineno: ...
def _get_unpacking_extra_info(node, infered): """return extra information to add to the message for unpacking-non-sequence and unbalanced-tuple-unpacking errors """ more = "" infered_module = infered.root().name if node.root().name == infered_module: if node.lineno == infered.lineno: ...
[ "return", "extra", "information", "to", "add", "to", "the", "message", "for", "unpacking", "-", "non", "-", "sequence", "and", "unbalanced", "-", "tuple", "-", "unpacking", "errors" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L105-L118
[ "def", "_get_unpacking_extra_info", "(", "node", ",", "infered", ")", ":", "more", "=", "\"\"", "infered_module", "=", "infered", ".", "root", "(", ")", ".", "name", "if", "node", ".", "root", "(", ")", ".", "name", "==", "infered_module", ":", "if", "...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_detect_global_scope
Detect that the given frames shares a global scope. Two frames shares a global scope when neither of them are hidden under a function scope, as well as any of parent scope of them, until the root scope. In this case, depending from something defined later on will not work, because it is still u...
pylint/checkers/variables.py
def _detect_global_scope(node, frame, defframe): """ Detect that the given frames shares a global scope. Two frames shares a global scope when neither of them are hidden under a function scope, as well as any of parent scope of them, until the root scope. In this case, depending from something ...
def _detect_global_scope(node, frame, defframe): """ Detect that the given frames shares a global scope. Two frames shares a global scope when neither of them are hidden under a function scope, as well as any of parent scope of them, until the root scope. In this case, depending from something ...
[ "Detect", "that", "the", "given", "frames", "shares", "a", "global", "scope", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L121-L183
[ "def", "_detect_global_scope", "(", "node", ",", "frame", ",", "defframe", ")", ":", "def_scope", "=", "scope", "=", "None", "if", "frame", "and", "frame", ".", "parent", ":", "scope", "=", "frame", ".", "parent", ".", "scope", "(", ")", "if", "deffram...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_fix_dot_imports
Try to fix imports with multiple dots, by returning a dictionary with the import names expanded. The function unflattens root imports, like 'xml' (when we have both 'xml.etree' and 'xml.sax'), to 'xml.etree' and 'xml.sax' respectively.
pylint/checkers/variables.py
def _fix_dot_imports(not_consumed): """ Try to fix imports with multiple dots, by returning a dictionary with the import names expanded. The function unflattens root imports, like 'xml' (when we have both 'xml.etree' and 'xml.sax'), to 'xml.etree' and 'xml.sax' respectively. """ # TODO: this sho...
def _fix_dot_imports(not_consumed): """ Try to fix imports with multiple dots, by returning a dictionary with the import names expanded. The function unflattens root imports, like 'xml' (when we have both 'xml.etree' and 'xml.sax'), to 'xml.etree' and 'xml.sax' respectively. """ # TODO: this sho...
[ "Try", "to", "fix", "imports", "with", "multiple", "dots", "by", "returning", "a", "dictionary", "with", "the", "import", "names", "expanded", ".", "The", "function", "unflattens", "root", "imports", "like", "xml", "(", "when", "we", "have", "both", "xml", ...
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L192-L232
[ "def", "_fix_dot_imports", "(", "not_consumed", ")", ":", "# TODO: this should be improved in issue astroid #46", "names", "=", "{", "}", "for", "name", ",", "stmts", "in", "not_consumed", ".", "items", "(", ")", ":", "if", "any", "(", "isinstance", "(", "stmt",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_find_frame_imports
Detect imports in the frame, with the required *name*. Such imports can be considered assignments. Returns True if an import for the given name was found.
pylint/checkers/variables.py
def _find_frame_imports(name, frame): """ Detect imports in the frame, with the required *name*. Such imports can be considered assignments. Returns True if an import for the given name was found. """ imports = frame.nodes_of_class((astroid.Import, astroid.ImportFrom)) for import_node in imp...
def _find_frame_imports(name, frame): """ Detect imports in the frame, with the required *name*. Such imports can be considered assignments. Returns True if an import for the given name was found. """ imports = frame.nodes_of_class((astroid.Import, astroid.ImportFrom)) for import_node in imp...
[ "Detect", "imports", "in", "the", "frame", "with", "the", "required", "*", "name", "*", ".", "Such", "imports", "can", "be", "considered", "assignments", ".", "Returns", "True", "if", "an", "import", "for", "the", "given", "name", "was", "found", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L235-L251
[ "def", "_find_frame_imports", "(", "name", ",", "frame", ")", ":", "imports", "=", "frame", ".", "nodes_of_class", "(", "(", "astroid", ".", "Import", ",", "astroid", ".", "ImportFrom", ")", ")", "for", "import_node", "in", "imports", ":", "for", "import_n...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_assigned_locally
Checks if name_node has corresponding assign statement in same scope
pylint/checkers/variables.py
def _assigned_locally(name_node): """ Checks if name_node has corresponding assign statement in same scope """ assign_stmts = name_node.scope().nodes_of_class(astroid.AssignName) return any(a.name == name_node.name for a in assign_stmts)
def _assigned_locally(name_node): """ Checks if name_node has corresponding assign statement in same scope """ assign_stmts = name_node.scope().nodes_of_class(astroid.AssignName) return any(a.name == name_node.name for a in assign_stmts)
[ "Checks", "if", "name_node", "has", "corresponding", "assign", "statement", "in", "same", "scope" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L271-L276
[ "def", "_assigned_locally", "(", "name_node", ")", ":", "assign_stmts", "=", "name_node", ".", "scope", "(", ")", ".", "nodes_of_class", "(", "astroid", ".", "AssignName", ")", "return", "any", "(", "a", ".", "name", "==", "name_node", ".", "name", "for", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
NamesConsumer.mark_as_consumed
Mark the name as consumed and delete it from the to_consume dictionary
pylint/checkers/variables.py
def mark_as_consumed(self, name, new_node): """ Mark the name as consumed and delete it from the to_consume dictionary """ self.consumed[name] = new_node del self.to_consume[name]
def mark_as_consumed(self, name, new_node): """ Mark the name as consumed and delete it from the to_consume dictionary """ self.consumed[name] = new_node del self.to_consume[name]
[ "Mark", "the", "name", "as", "consumed", "and", "delete", "it", "from", "the", "to_consume", "dictionary" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L477-L483
[ "def", "mark_as_consumed", "(", "self", ",", "name", ",", "new_node", ")", ":", "self", ".", "consumed", "[", "name", "]", "=", "new_node", "del", "self", ".", "to_consume", "[", "name", "]" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
VariablesChecker.visit_module
visit module : update consumption analysis variable checks globals doesn't overrides builtins
pylint/checkers/variables.py
def visit_module(self, node): """visit module : update consumption analysis variable checks globals doesn't overrides builtins """ self._to_consume = [NamesConsumer(node, "module")] self._postponed_evaluation_enabled = is_postponed_evaluation_enabled(node) for name, stmt...
def visit_module(self, node): """visit module : update consumption analysis variable checks globals doesn't overrides builtins """ self._to_consume = [NamesConsumer(node, "module")] self._postponed_evaluation_enabled = is_postponed_evaluation_enabled(node) for name, stmt...
[ "visit", "module", ":", "update", "consumption", "analysis", "variable", "checks", "globals", "doesn", "t", "overrides", "builtins" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L648-L659
[ "def", "visit_module", "(", "self", ",", "node", ")", ":", "self", ".", "_to_consume", "=", "[", "NamesConsumer", "(", "node", ",", "\"module\"", ")", "]", "self", ".", "_postponed_evaluation_enabled", "=", "is_postponed_evaluation_enabled", "(", "node", ")", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
VariablesChecker.leave_module
leave module: check globals
pylint/checkers/variables.py
def leave_module(self, node): """leave module: check globals """ assert len(self._to_consume) == 1 not_consumed = self._to_consume.pop().to_consume # attempt to check for __all__ if defined if "__all__" in node.locals: self._check_all(node, not_consumed) ...
def leave_module(self, node): """leave module: check globals """ assert len(self._to_consume) == 1 not_consumed = self._to_consume.pop().to_consume # attempt to check for __all__ if defined if "__all__" in node.locals: self._check_all(node, not_consumed) ...
[ "leave", "module", ":", "check", "globals" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L669-L685
[ "def", "leave_module", "(", "self", ",", "node", ")", ":", "assert", "len", "(", "self", ".", "_to_consume", ")", "==", "1", "not_consumed", "=", "self", ".", "_to_consume", ".", "pop", "(", ")", ".", "to_consume", "# attempt to check for __all__ if defined", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
VariablesChecker.visit_functiondef
visit function: update consumption analysis variable and check locals
pylint/checkers/variables.py
def visit_functiondef(self, node): """visit function: update consumption analysis variable and check locals """ self._to_consume.append(NamesConsumer(node, "function")) if not ( self.linter.is_message_enabled("redefined-outer-name") or self.linter.is_message_enabl...
def visit_functiondef(self, node): """visit function: update consumption analysis variable and check locals """ self._to_consume.append(NamesConsumer(node, "function")) if not ( self.linter.is_message_enabled("redefined-outer-name") or self.linter.is_message_enabl...
[ "visit", "function", ":", "update", "consumption", "analysis", "variable", "and", "check", "locals" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L865-L897
[ "def", "visit_functiondef", "(", "self", ",", "node", ")", ":", "self", ".", "_to_consume", ".", "append", "(", "NamesConsumer", "(", "node", ",", "\"function\"", ")", ")", "if", "not", "(", "self", ".", "linter", ".", "is_message_enabled", "(", "\"redefin...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
VariablesChecker.leave_functiondef
leave function: check function's locals are consumed
pylint/checkers/variables.py
def leave_functiondef(self, node): """leave function: check function's locals are consumed""" if node.type_comment_returns: self._store_type_annotation_node(node.type_comment_returns) if node.type_comment_args: for argument_annotation in node.type_comment_args: ...
def leave_functiondef(self, node): """leave function: check function's locals are consumed""" if node.type_comment_returns: self._store_type_annotation_node(node.type_comment_returns) if node.type_comment_args: for argument_annotation in node.type_comment_args: ...
[ "leave", "function", ":", "check", "function", "s", "locals", "are", "consumed" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L1006-L1034
[ "def", "leave_functiondef", "(", "self", ",", "node", ")", ":", "if", "node", ".", "type_comment_returns", ":", "self", ".", "_store_type_annotation_node", "(", "node", ".", "type_comment_returns", ")", "if", "node", ".", "type_comment_args", ":", "for", "argume...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
VariablesChecker.visit_global
check names imported exists in the global scope
pylint/checkers/variables.py
def visit_global(self, node): """check names imported exists in the global scope""" frame = node.frame() if isinstance(frame, astroid.Module): self.add_message("global-at-module-level", node=node) return module = frame.root() default_message = True ...
def visit_global(self, node): """check names imported exists in the global scope""" frame = node.frame() if isinstance(frame, astroid.Module): self.add_message("global-at-module-level", node=node) return module = frame.root() default_message = True ...
[ "check", "names", "imported", "exists", "in", "the", "global", "scope" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L1046-L1089
[ "def", "visit_global", "(", "self", ",", "node", ")", ":", "frame", "=", "node", ".", "frame", "(", ")", "if", "isinstance", "(", "frame", ",", "astroid", ".", "Module", ")", ":", "self", ".", "add_message", "(", "\"global-at-module-level\"", ",", "node"...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
VariablesChecker._ignore_class_scope
Return True if the node is in a local class scope, as an assignment. :param node: Node considered :type node: astroid.Node :return: True if the node is in a local class scope, as an assignment. False otherwise. :rtype: bool
pylint/checkers/variables.py
def _ignore_class_scope(self, node): """ Return True if the node is in a local class scope, as an assignment. :param node: Node considered :type node: astroid.Node :return: True if the node is in a local class scope, as an assignment. False otherwise. :rtype: bool ...
def _ignore_class_scope(self, node): """ Return True if the node is in a local class scope, as an assignment. :param node: Node considered :type node: astroid.Node :return: True if the node is in a local class scope, as an assignment. False otherwise. :rtype: bool ...
[ "Return", "True", "if", "the", "node", "is", "in", "a", "local", "class", "scope", "as", "an", "assignment", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L1336-L1371
[ "def", "_ignore_class_scope", "(", "self", ",", "node", ")", ":", "# Detect if we are in a local class scope, as an assignment.", "# For example, the following is fair game.", "#", "# class A:", "# b = 1", "# c = lambda b=b: b * b", "#", "# class B:", "# tp = 1", "# def...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
VariablesChecker.visit_name
check that a name is defined if the current scope and doesn't redefine a built-in
pylint/checkers/variables.py
def visit_name(self, node): """check that a name is defined if the current scope and doesn't redefine a built-in """ stmt = node.statement() if stmt.fromlineno is None: # name node from an astroid built from live code, skip assert not stmt.root().file.ends...
def visit_name(self, node): """check that a name is defined if the current scope and doesn't redefine a built-in """ stmt = node.statement() if stmt.fromlineno is None: # name node from an astroid built from live code, skip assert not stmt.root().file.ends...
[ "check", "that", "a", "name", "is", "defined", "if", "the", "current", "scope", "and", "doesn", "t", "redefine", "a", "built", "-", "in" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L1374-L1572
[ "def", "visit_name", "(", "self", ",", "node", ")", ":", "stmt", "=", "node", ".", "statement", "(", ")", "if", "stmt", ".", "fromlineno", "is", "None", ":", "# name node from an astroid built from live code, skip", "assert", "not", "stmt", ".", "root", "(", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
VariablesChecker._has_homonym_in_upper_function_scope
Return True if there is a node with the same name in the to_consume dict of an upper scope and if that scope is a function :param node: node to check for :type node: astroid.Node :param index: index of the current consumer inside self._to_consume :type index: int :return...
pylint/checkers/variables.py
def _has_homonym_in_upper_function_scope(self, node, index): """ Return True if there is a node with the same name in the to_consume dict of an upper scope and if that scope is a function :param node: node to check for :type node: astroid.Node :param index: index of the ...
def _has_homonym_in_upper_function_scope(self, node, index): """ Return True if there is a node with the same name in the to_consume dict of an upper scope and if that scope is a function :param node: node to check for :type node: astroid.Node :param index: index of the ...
[ "Return", "True", "if", "there", "is", "a", "node", "with", "the", "same", "name", "in", "the", "to_consume", "dict", "of", "an", "upper", "scope", "and", "if", "that", "scope", "is", "a", "function" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L1574-L1590
[ "def", "_has_homonym_in_upper_function_scope", "(", "self", ",", "node", ",", "index", ")", ":", "for", "_consumer", "in", "self", ".", "_to_consume", "[", "index", "-", "1", ":", ":", "-", "1", "]", ":", "if", "_consumer", ".", "scope_type", "==", "\"fu...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
VariablesChecker.visit_import
check modules attribute accesses
pylint/checkers/variables.py
def visit_import(self, node): """check modules attribute accesses""" if not self._analyse_fallback_blocks and utils.is_from_fallback_block(node): # No need to verify this, since ImportError is already # handled by the client code. return for name, _ in node.n...
def visit_import(self, node): """check modules attribute accesses""" if not self._analyse_fallback_blocks and utils.is_from_fallback_block(node): # No need to verify this, since ImportError is already # handled by the client code. return for name, _ in node.n...
[ "check", "modules", "attribute", "accesses" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L1593-L1606
[ "def", "visit_import", "(", "self", ",", "node", ")", ":", "if", "not", "self", ".", "_analyse_fallback_blocks", "and", "utils", ".", "is_from_fallback_block", "(", "node", ")", ":", "# No need to verify this, since ImportError is already", "# handled by the client code."...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
VariablesChecker.visit_importfrom
check modules attribute accesses
pylint/checkers/variables.py
def visit_importfrom(self, node): """check modules attribute accesses""" if not self._analyse_fallback_blocks and utils.is_from_fallback_block(node): # No need to verify this, since ImportError is already # handled by the client code. return name_parts = node...
def visit_importfrom(self, node): """check modules attribute accesses""" if not self._analyse_fallback_blocks and utils.is_from_fallback_block(node): # No need to verify this, since ImportError is already # handled by the client code. return name_parts = node...
[ "check", "modules", "attribute", "accesses" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L1609-L1627
[ "def", "visit_importfrom", "(", "self", ",", "node", ")", ":", "if", "not", "self", ".", "_analyse_fallback_blocks", "and", "utils", ".", "is_from_fallback_block", "(", "node", ")", ":", "# No need to verify this, since ImportError is already", "# handled by the client co...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
VariablesChecker.visit_assign
Check unbalanced tuple unpacking for assignments and unpacking non-sequences as well as in case self/cls get assigned.
pylint/checkers/variables.py
def visit_assign(self, node): """Check unbalanced tuple unpacking for assignments and unpacking non-sequences as well as in case self/cls get assigned. """ self._check_self_cls_assign(node) if not isinstance(node.targets[0], (astroid.Tuple, astroid.List)): ret...
def visit_assign(self, node): """Check unbalanced tuple unpacking for assignments and unpacking non-sequences as well as in case self/cls get assigned. """ self._check_self_cls_assign(node) if not isinstance(node.targets[0], (astroid.Tuple, astroid.List)): ret...
[ "Check", "unbalanced", "tuple", "unpacking", "for", "assignments", "and", "unpacking", "non", "-", "sequences", "as", "well", "as", "in", "case", "self", "/", "cls", "get", "assigned", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L1632-L1647
[ "def", "visit_assign", "(", "self", ",", "node", ")", ":", "self", ".", "_check_self_cls_assign", "(", "node", ")", "if", "not", "isinstance", "(", "node", ".", "targets", "[", "0", "]", ",", "(", "astroid", ".", "Tuple", ",", "astroid", ".", "List", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
VariablesChecker._check_self_cls_assign
Check that self/cls don't get assigned
pylint/checkers/variables.py
def _check_self_cls_assign(self, node): """Check that self/cls don't get assigned""" assign_names = { target.name for target in node.targets if isinstance(target, astroid.AssignName) } scope = node.scope() nonlocals_with_same_name = any( ...
def _check_self_cls_assign(self, node): """Check that self/cls don't get assigned""" assign_names = { target.name for target in node.targets if isinstance(target, astroid.AssignName) } scope = node.scope() nonlocals_with_same_name = any( ...
[ "Check", "that", "self", "/", "cls", "don", "t", "get", "assigned" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L1672-L1704
[ "def", "_check_self_cls_assign", "(", "self", ",", "node", ")", ":", "assign_names", "=", "{", "target", ".", "name", "for", "target", "in", "node", ".", "targets", "if", "isinstance", "(", "target", ",", "astroid", ".", "AssignName", ")", "}", "scope", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
VariablesChecker._check_unpacking
Check for unbalanced tuple unpacking and unpacking non sequences.
pylint/checkers/variables.py
def _check_unpacking(self, infered, node, targets): """ Check for unbalanced tuple unpacking and unpacking non sequences. """ if utils.is_inside_abstract_class(node): return if utils.is_comprehension(node): return if infered is astroid.Uninferable:...
def _check_unpacking(self, infered, node, targets): """ Check for unbalanced tuple unpacking and unpacking non sequences. """ if utils.is_inside_abstract_class(node): return if utils.is_comprehension(node): return if infered is astroid.Uninferable:...
[ "Check", "for", "unbalanced", "tuple", "unpacking", "and", "unpacking", "non", "sequences", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L1706-L1746
[ "def", "_check_unpacking", "(", "self", ",", "infered", ",", "node", ",", "targets", ")", ":", "if", "utils", ".", "is_inside_abstract_class", "(", "node", ")", ":", "return", "if", "utils", ".", "is_comprehension", "(", "node", ")", ":", "return", "if", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
VariablesChecker._check_module_attrs
check that module_names (list of string) are accessible through the given module if the latest access name corresponds to a module, return it
pylint/checkers/variables.py
def _check_module_attrs(self, node, module, module_names): """check that module_names (list of string) are accessible through the given module if the latest access name corresponds to a module, return it """ assert isinstance(module, astroid.Module), module while module_n...
def _check_module_attrs(self, node, module, module_names): """check that module_names (list of string) are accessible through the given module if the latest access name corresponds to a module, return it """ assert isinstance(module, astroid.Module), module while module_n...
[ "check", "that", "module_names", "(", "list", "of", "string", ")", "are", "accessible", "through", "the", "given", "module", "if", "the", "latest", "access", "name", "corresponds", "to", "a", "module", "return", "it" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L1748-L1782
[ "def", "_check_module_attrs", "(", "self", ",", "node", ",", "module", ",", "module_names", ")", ":", "assert", "isinstance", "(", "module", ",", "astroid", ".", "Module", ")", ",", "module", "while", "module_names", ":", "name", "=", "module_names", ".", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
VariablesChecker3k._check_metaclasses
Update consumption analysis for metaclasses.
pylint/checkers/variables.py
def _check_metaclasses(self, node): """ Update consumption analysis for metaclasses. """ consumed = [] # [(scope_locals, consumed_key)] for child_node in node.get_children(): if isinstance(child_node, astroid.ClassDef): consumed.extend(self._check_classdef_metaclass...
def _check_metaclasses(self, node): """ Update consumption analysis for metaclasses. """ consumed = [] # [(scope_locals, consumed_key)] for child_node in node.get_children(): if isinstance(child_node, astroid.ClassDef): consumed.extend(self._check_classdef_metaclass...
[ "Update", "consumption", "analysis", "for", "metaclasses", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L1809-L1820
[ "def", "_check_metaclasses", "(", "self", ",", "node", ")", ":", "consumed", "=", "[", "]", "# [(scope_locals, consumed_key)]", "for", "child_node", "in", "node", ".", "get_children", "(", ")", ":", "if", "isinstance", "(", "child_node", ",", "astroid", ".", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
table_lines_from_stats
get values listed in <columns> from <stats> and <old_stats>, and return a formated list of values, designed to be given to a ureport.Table object
pylint/checkers/__init__.py
def table_lines_from_stats(stats, _, columns): """get values listed in <columns> from <stats> and <old_stats>, and return a formated list of values, designed to be given to a ureport.Table object """ lines = [] for m_type in columns: new = stats[m_type] new = "%.3f" % new if isin...
def table_lines_from_stats(stats, _, columns): """get values listed in <columns> from <stats> and <old_stats>, and return a formated list of values, designed to be given to a ureport.Table object """ lines = [] for m_type in columns: new = stats[m_type] new = "%.3f" % new if isin...
[ "get", "values", "listed", "in", "<columns", ">", "from", "<stats", ">", "and", "<old_stats", ">", "and", "return", "a", "formated", "list", "of", "values", "designed", "to", "be", "given", "to", "a", "ureport", ".", "Table", "object" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/__init__.py#L46-L56
[ "def", "table_lines_from_stats", "(", "stats", ",", "_", ",", "columns", ")", ":", "lines", "=", "[", "]", "for", "m_type", "in", "columns", ":", "new", "=", "stats", "[", "m_type", "]", "new", "=", "\"%.3f\"", "%", "new", "if", "isinstance", "(", "n...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ensure_scripts
Creates the proper script names required for each platform (taken from 4Suite)
setup.py
def ensure_scripts(linux_scripts): """Creates the proper script names required for each platform (taken from 4Suite) """ from distutils import util if util.get_platform()[:3] == "win": return linux_scripts + [script + ".bat" for script in linux_scripts] return linux_scripts
def ensure_scripts(linux_scripts): """Creates the proper script names required for each platform (taken from 4Suite) """ from distutils import util if util.get_platform()[:3] == "win": return linux_scripts + [script + ".bat" for script in linux_scripts] return linux_scripts
[ "Creates", "the", "proper", "script", "names", "required", "for", "each", "platform", "(", "taken", "from", "4Suite", ")" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/setup.py#L71-L79
[ "def", "ensure_scripts", "(", "linux_scripts", ")", ":", "from", "distutils", "import", "util", "if", "util", ".", "get_platform", "(", ")", "[", ":", "3", "]", "==", "\"win\"", ":", "return", "linux_scripts", "+", "[", "script", "+", "\".bat\"", "for", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
get_packages
return a list of subpackages for the given directory
setup.py
def get_packages(directory, prefix): """return a list of subpackages for the given directory""" result = [] for package in os.listdir(directory): absfile = join(directory, package) if isdir(absfile): if exists(join(absfile, "__init__.py")): if prefix: ...
def get_packages(directory, prefix): """return a list of subpackages for the given directory""" result = [] for package in os.listdir(directory): absfile = join(directory, package) if isdir(absfile): if exists(join(absfile, "__init__.py")): if prefix: ...
[ "return", "a", "list", "of", "subpackages", "for", "the", "given", "directory" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/setup.py#L82-L94
[ "def", "get_packages", "(", "directory", ",", "prefix", ")", ":", "result", "=", "[", "]", "for", "package", "in", "os", ".", "listdir", "(", "directory", ")", ":", "absfile", "=", "join", "(", "directory", ",", "package", ")", "if", "isdir", "(", "a...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
install
setup entry point
setup.py
def install(**kwargs): """setup entry point""" if USE_SETUPTOOLS: if "--force-manifest" in sys.argv: sys.argv.remove("--force-manifest") packages = [modname] + get_packages(join(base_dir, "pylint"), modname) if USE_SETUPTOOLS: if install_requires: kwargs["install_...
def install(**kwargs): """setup entry point""" if USE_SETUPTOOLS: if "--force-manifest" in sys.argv: sys.argv.remove("--force-manifest") packages = [modname] + get_packages(join(base_dir, "pylint"), modname) if USE_SETUPTOOLS: if install_requires: kwargs["install_...
[ "setup", "entry", "point" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/setup.py#L142-L184
[ "def", "install", "(", "*", "*", "kwargs", ")", ":", "if", "USE_SETUPTOOLS", ":", "if", "\"--force-manifest\"", "in", "sys", ".", "argv", ":", "sys", ".", "argv", ".", "remove", "(", "\"--force-manifest\"", ")", "packages", "=", "[", "modname", "]", "+",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
MyInstallLib.run
overridden from install_lib class
setup.py
def run(self): """overridden from install_lib class""" install_lib.install_lib.run(self) # manually install included directories if any if include_dirs: for directory in include_dirs: dest = join(self.install_dir, directory) if sys.version_info...
def run(self): """overridden from install_lib class""" install_lib.install_lib.run(self) # manually install included directories if any if include_dirs: for directory in include_dirs: dest = join(self.install_dir, directory) if sys.version_info...
[ "overridden", "from", "install_lib", "class" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/setup.py#L107-L121
[ "def", "run", "(", "self", ")", ":", "install_lib", ".", "install_lib", ".", "run", "(", "self", ")", "# manually install included directories if any", "if", "include_dirs", ":", "for", "directory", "in", "include_dirs", ":", "dest", "=", "join", "(", "self", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
stripped_lines
return lines with leading/trailing whitespace and any ignored code features removed
pylint/checkers/similar.py
def stripped_lines(lines, ignore_comments, ignore_docstrings, ignore_imports): """return lines with leading/trailing whitespace and any ignored code features removed """ if ignore_imports: tree = astroid.parse("".join(lines)) node_is_import_by_lineno = ( (node.lineno, isinsta...
def stripped_lines(lines, ignore_comments, ignore_docstrings, ignore_imports): """return lines with leading/trailing whitespace and any ignored code features removed """ if ignore_imports: tree = astroid.parse("".join(lines)) node_is_import_by_lineno = ( (node.lineno, isinsta...
[ "return", "lines", "with", "leading", "/", "trailing", "whitespace", "and", "any", "ignored", "code", "features", "removed" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L156-L199
[ "def", "stripped_lines", "(", "lines", ",", "ignore_comments", ",", "ignore_docstrings", ",", "ignore_imports", ")", ":", "if", "ignore_imports", ":", "tree", "=", "astroid", ".", "parse", "(", "\"\"", ".", "join", "(", "lines", ")", ")", "node_is_import_by_li...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
report_similarities
make a layout with some stats about duplication
pylint/checkers/similar.py
def report_similarities(sect, stats, old_stats): """make a layout with some stats about duplication""" lines = ["", "now", "previous", "difference"] lines += table_lines_from_stats( stats, old_stats, ("nb_duplicated_lines", "percent_duplicated_lines") ) sect.append(Table(children=lines, cols...
def report_similarities(sect, stats, old_stats): """make a layout with some stats about duplication""" lines = ["", "now", "previous", "difference"] lines += table_lines_from_stats( stats, old_stats, ("nb_duplicated_lines", "percent_duplicated_lines") ) sect.append(Table(children=lines, cols...
[ "make", "a", "layout", "with", "some", "stats", "about", "duplication" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L273-L279
[ "def", "report_similarities", "(", "sect", ",", "stats", ",", "old_stats", ")", ":", "lines", "=", "[", "\"\"", ",", "\"now\"", ",", "\"previous\"", ",", "\"difference\"", "]", "lines", "+=", "table_lines_from_stats", "(", "stats", ",", "old_stats", ",", "("...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
Run
standalone command line access point
pylint/checkers/similar.py
def Run(argv=None): """standalone command line access point""" if argv is None: argv = sys.argv[1:] from getopt import getopt s_opts = "hdi" l_opts = ( "help", "duplicates=", "ignore-comments", "ignore-imports", "ignore-docstrings", ) min_line...
def Run(argv=None): """standalone command line access point""" if argv is None: argv = sys.argv[1:] from getopt import getopt s_opts = "hdi" l_opts = ( "help", "duplicates=", "ignore-comments", "ignore-imports", "ignore-docstrings", ) min_line...
[ "standalone", "command", "line", "access", "point" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L411-L448
[ "def", "Run", "(", "argv", "=", "None", ")", ":", "if", "argv", "is", "None", ":", "argv", "=", "sys", ".", "argv", "[", "1", ":", "]", "from", "getopt", "import", "getopt", "s_opts", "=", "\"hdi\"", "l_opts", "=", "(", "\"help\"", ",", "\"duplicat...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
Similar.append_stream
append a file to search for similarities
pylint/checkers/similar.py
def append_stream(self, streamid, stream, encoding=None): """append a file to search for similarities""" if encoding is None: readlines = stream.readlines else: readlines = decoding_stream(stream, encoding).readlines try: self.linesets.append( ...
def append_stream(self, streamid, stream, encoding=None): """append a file to search for similarities""" if encoding is None: readlines = stream.readlines else: readlines = decoding_stream(stream, encoding).readlines try: self.linesets.append( ...
[ "append", "a", "file", "to", "search", "for", "similarities" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L50-L67
[ "def", "append_stream", "(", "self", ",", "streamid", ",", "stream", ",", "encoding", "=", "None", ")", ":", "if", "encoding", "is", "None", ":", "readlines", "=", "stream", ".", "readlines", "else", ":", "readlines", "=", "decoding_stream", "(", "stream",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
Similar._compute_sims
compute similarities in appended files
pylint/checkers/similar.py
def _compute_sims(self): """compute similarities in appended files""" no_duplicates = defaultdict(list) for num, lineset1, idx1, lineset2, idx2 in self._iter_sims(): duplicate = no_duplicates[num] for couples in duplicate: if (lineset1, idx1) in couples or...
def _compute_sims(self): """compute similarities in appended files""" no_duplicates = defaultdict(list) for num, lineset1, idx1, lineset2, idx2 in self._iter_sims(): duplicate = no_duplicates[num] for couples in duplicate: if (lineset1, idx1) in couples or...
[ "compute", "similarities", "in", "appended", "files" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L73-L91
[ "def", "_compute_sims", "(", "self", ")", ":", "no_duplicates", "=", "defaultdict", "(", "list", ")", "for", "num", ",", "lineset1", ",", "idx1", ",", "lineset2", ",", "idx2", "in", "self", ".", "_iter_sims", "(", ")", ":", "duplicate", "=", "no_duplicat...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
Similar._display_sims
display computed similarities on stdout
pylint/checkers/similar.py
def _display_sims(self, sims): """display computed similarities on stdout""" nb_lignes_dupliquees = 0 for num, couples in sims: print() print(num, "similar lines in", len(couples), "files") couples = sorted(couples) for lineset, idx in couples: ...
def _display_sims(self, sims): """display computed similarities on stdout""" nb_lignes_dupliquees = 0 for num, couples in sims: print() print(num, "similar lines in", len(couples), "files") couples = sorted(couples) for lineset, idx in couples: ...
[ "display", "computed", "similarities", "on", "stdout" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L93-L114
[ "def", "_display_sims", "(", "self", ",", "sims", ")", ":", "nb_lignes_dupliquees", "=", "0", "for", "num", ",", "couples", "in", "sims", ":", "print", "(", ")", "print", "(", "num", ",", "\"similar lines in\"", ",", "len", "(", "couples", ")", ",", "\...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
Similar._find_common
find similarities in the two given linesets
pylint/checkers/similar.py
def _find_common(self, lineset1, lineset2): """find similarities in the two given linesets""" lines1 = lineset1.enumerate_stripped lines2 = lineset2.enumerate_stripped find = lineset2.find index1 = 0 min_lines = self.min_lines while index1 < len(lineset1): ...
def _find_common(self, lineset1, lineset2): """find similarities in the two given linesets""" lines1 = lineset1.enumerate_stripped lines2 = lineset2.enumerate_stripped find = lineset2.find index1 = 0 min_lines = self.min_lines while index1 < len(lineset1): ...
[ "find", "similarities", "in", "the", "two", "given", "linesets" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L116-L144
[ "def", "_find_common", "(", "self", ",", "lineset1", ",", "lineset2", ")", ":", "lines1", "=", "lineset1", ".", "enumerate_stripped", "lines2", "=", "lineset2", ".", "enumerate_stripped", "find", "=", "lineset2", ".", "find", "index1", "=", "0", "min_lines", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
Similar._iter_sims
iterate on similarities among all files, by making a cartesian product
pylint/checkers/similar.py
def _iter_sims(self): """iterate on similarities among all files, by making a cartesian product """ for idx, lineset in enumerate(self.linesets[:-1]): for lineset2 in self.linesets[idx + 1 :]: for sim in self._find_common(lineset, lineset2): ...
def _iter_sims(self): """iterate on similarities among all files, by making a cartesian product """ for idx, lineset in enumerate(self.linesets[:-1]): for lineset2 in self.linesets[idx + 1 :]: for sim in self._find_common(lineset, lineset2): ...
[ "iterate", "on", "similarities", "among", "all", "files", "by", "making", "a", "cartesian", "product" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L146-L153
[ "def", "_iter_sims", "(", "self", ")", ":", "for", "idx", ",", "lineset", "in", "enumerate", "(", "self", ".", "linesets", "[", ":", "-", "1", "]", ")", ":", "for", "lineset2", "in", "self", ".", "linesets", "[", "idx", "+", "1", ":", "]", ":", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
LineSet.enumerate_stripped
return an iterator on stripped lines, starting from a given index if specified, else 0
pylint/checkers/similar.py
def enumerate_stripped(self, start_at=0): """return an iterator on stripped lines, starting from a given index if specified, else 0 """ idx = start_at if start_at: lines = self._stripped_lines[start_at:] else: lines = self._stripped_lines f...
def enumerate_stripped(self, start_at=0): """return an iterator on stripped lines, starting from a given index if specified, else 0 """ idx = start_at if start_at: lines = self._stripped_lines[start_at:] else: lines = self._stripped_lines f...
[ "return", "an", "iterator", "on", "stripped", "lines", "starting", "from", "a", "given", "index", "if", "specified", "else", "0" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L235-L247
[ "def", "enumerate_stripped", "(", "self", ",", "start_at", "=", "0", ")", ":", "idx", "=", "start_at", "if", "start_at", ":", "lines", "=", "self", ".", "_stripped_lines", "[", "start_at", ":", "]", "else", ":", "lines", "=", "self", ".", "_stripped_line...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
LineSet._mk_index
create the index for this set
pylint/checkers/similar.py
def _mk_index(self): """create the index for this set""" index = defaultdict(list) for line_no, line in enumerate(self._stripped_lines): if line: index[line].append(line_no) return index
def _mk_index(self): """create the index for this set""" index = defaultdict(list) for line_no, line in enumerate(self._stripped_lines): if line: index[line].append(line_no) return index
[ "create", "the", "index", "for", "this", "set" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L253-L259
[ "def", "_mk_index", "(", "self", ")", ":", "index", "=", "defaultdict", "(", "list", ")", "for", "line_no", ",", "line", "in", "enumerate", "(", "self", ".", "_stripped_lines", ")", ":", "if", "line", ":", "index", "[", "line", "]", ".", "append", "(...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
SimilarChecker.set_option
method called to set an option (registered in the options list) overridden to report options setting to Similar
pylint/checkers/similar.py
def set_option(self, optname, value, action=None, optdict=None): """method called to set an option (registered in the options list) overridden to report options setting to Similar """ BaseChecker.set_option(self, optname, value, action, optdict) if optname == "min-similarity-lin...
def set_option(self, optname, value, action=None, optdict=None): """method called to set an option (registered in the options list) overridden to report options setting to Similar """ BaseChecker.set_option(self, optname, value, action, optdict) if optname == "min-similarity-lin...
[ "method", "called", "to", "set", "an", "option", "(", "registered", "in", "the", "options", "list", ")" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L344-L357
[ "def", "set_option", "(", "self", ",", "optname", ",", "value", ",", "action", "=", "None", ",", "optdict", "=", "None", ")", ":", "BaseChecker", ".", "set_option", "(", "self", ",", "optname", ",", "value", ",", "action", ",", "optdict", ")", "if", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
SimilarChecker.open
init the checkers: reset linesets and statistics information
pylint/checkers/similar.py
def open(self): """init the checkers: reset linesets and statistics information""" self.linesets = [] self.stats = self.linter.add_stats( nb_duplicated_lines=0, percent_duplicated_lines=0 )
def open(self): """init the checkers: reset linesets and statistics information""" self.linesets = [] self.stats = self.linter.add_stats( nb_duplicated_lines=0, percent_duplicated_lines=0 )
[ "init", "the", "checkers", ":", "reset", "linesets", "and", "statistics", "information" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L359-L364
[ "def", "open", "(", "self", ")", ":", "self", ".", "linesets", "=", "[", "]", "self", ".", "stats", "=", "self", ".", "linter", ".", "add_stats", "(", "nb_duplicated_lines", "=", "0", ",", "percent_duplicated_lines", "=", "0", ")" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
SimilarChecker.process_module
process a module the module's content is accessible via the stream object stream must implement the readlines method
pylint/checkers/similar.py
def process_module(self, node): """process a module the module's content is accessible via the stream object stream must implement the readlines method """ with node.stream() as stream: self.append_stream(self.linter.current_name, stream, node.file_encoding)
def process_module(self, node): """process a module the module's content is accessible via the stream object stream must implement the readlines method """ with node.stream() as stream: self.append_stream(self.linter.current_name, stream, node.file_encoding)
[ "process", "a", "module" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L366-L374
[ "def", "process_module", "(", "self", ",", "node", ")", ":", "with", "node", ".", "stream", "(", ")", "as", "stream", ":", "self", ".", "append_stream", "(", "self", ".", "linter", ".", "current_name", ",", "stream", ",", "node", ".", "file_encoding", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
SimilarChecker.close
compute and display similarities on closing (i.e. end of parsing)
pylint/checkers/similar.py
def close(self): """compute and display similarities on closing (i.e. end of parsing)""" total = sum(len(lineset) for lineset in self.linesets) duplicated = 0 stats = self.stats for num, couples in self._compute_sims(): msg = [] for lineset, idx in couples...
def close(self): """compute and display similarities on closing (i.e. end of parsing)""" total = sum(len(lineset) for lineset in self.linesets) duplicated = 0 stats = self.stats for num, couples in self._compute_sims(): msg = [] for lineset, idx in couples...
[ "compute", "and", "display", "similarities", "on", "closing", "(", "i", ".", "e", ".", "end", "of", "parsing", ")" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/similar.py#L376-L392
[ "def", "close", "(", "self", ")", ":", "total", "=", "sum", "(", "len", "(", "lineset", ")", "for", "lineset", "in", "self", ".", "linesets", ")", "duplicated", "=", "0", "stats", "=", "self", ".", "stats", "for", "num", ",", "couples", "in", "self...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_definition_equivalent_to_call
Check if a definition signature is equivalent to a call.
pylint/checkers/classes.py
def _definition_equivalent_to_call(definition, call): """Check if a definition signature is equivalent to a call.""" if definition.kwargs: same_kw_variadics = definition.kwargs in call.starred_kws else: same_kw_variadics = not call.starred_kws if definition.varargs: same_args_var...
def _definition_equivalent_to_call(definition, call): """Check if a definition signature is equivalent to a call.""" if definition.kwargs: same_kw_variadics = definition.kwargs in call.starred_kws else: same_kw_variadics = not call.starred_kws if definition.varargs: same_args_var...
[ "Check", "if", "a", "definition", "signature", "is", "equivalent", "to", "a", "call", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L121-L155
[ "def", "_definition_equivalent_to_call", "(", "definition", ",", "call", ")", ":", "if", "definition", ".", "kwargs", ":", "same_kw_variadics", "=", "definition", ".", "kwargs", "in", "call", ".", "starred_kws", "else", ":", "same_kw_variadics", "=", "not", "cal...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_check_arg_equality
Check equality of nodes based on the comparison of their attributes named attr_name. Args: node_a (astroid.node): first node to compare. node_b (astroid.node): second node to compare. attr_name (str): name of the nodes attribute to use for comparison. Returns: bool: True if nod...
pylint/checkers/classes.py
def _check_arg_equality(node_a, node_b, attr_name): """ Check equality of nodes based on the comparison of their attributes named attr_name. Args: node_a (astroid.node): first node to compare. node_b (astroid.node): second node to compare. attr_name (str): name of the nodes attribut...
def _check_arg_equality(node_a, node_b, attr_name): """ Check equality of nodes based on the comparison of their attributes named attr_name. Args: node_a (astroid.node): first node to compare. node_b (astroid.node): second node to compare. attr_name (str): name of the nodes attribut...
[ "Check", "equality", "of", "nodes", "based", "on", "the", "comparison", "of", "their", "attributes", "named", "attr_name", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L185-L197
[ "def", "_check_arg_equality", "(", "node_a", ",", "node_b", ",", "attr_name", ")", ":", "return", "getattr", "(", "node_a", ",", "attr_name", ")", "==", "getattr", "(", "node_b", ",", "attr_name", ")" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_has_different_parameters_default_value
Check if original and overridden methods arguments have different default values Return True if one of the overridden arguments has a default value different from the default value of the original argument If one of the method doesn't have argument (.args is None) return False
pylint/checkers/classes.py
def _has_different_parameters_default_value(original, overridden): """ Check if original and overridden methods arguments have different default values Return True if one of the overridden arguments has a default value different from the default value of the original argument If one of the method d...
def _has_different_parameters_default_value(original, overridden): """ Check if original and overridden methods arguments have different default values Return True if one of the overridden arguments has a default value different from the default value of the original argument If one of the method d...
[ "Check", "if", "original", "and", "overridden", "methods", "arguments", "have", "different", "default", "values" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L200-L254
[ "def", "_has_different_parameters_default_value", "(", "original", ",", "overridden", ")", ":", "if", "original", ".", "args", "is", "None", "or", "overridden", ".", "args", "is", "None", ":", "return", "False", "all_args", "=", "chain", "(", "original", ".", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_different_parameters
Determine if the two methods have different parameters They are considered to have different parameters if: * they have different positional parameters, including different names * one of the methods is having variadics, while the other is not * they have different keyword only parameters.
pylint/checkers/classes.py
def _different_parameters(original, overridden, dummy_parameter_regex): """Determine if the two methods have different parameters They are considered to have different parameters if: * they have different positional parameters, including different names * one of the methods is having variadics,...
def _different_parameters(original, overridden, dummy_parameter_regex): """Determine if the two methods have different parameters They are considered to have different parameters if: * they have different positional parameters, including different names * one of the methods is having variadics,...
[ "Determine", "if", "the", "two", "methods", "have", "different", "parameters" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L272-L315
[ "def", "_different_parameters", "(", "original", ",", "overridden", ",", "dummy_parameter_regex", ")", ":", "original_parameters", "=", "_positional_parameters", "(", "original", ")", "overridden_parameters", "=", "_positional_parameters", "(", "overridden", ")", "differe...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_called_in_methods
Check if the func was called in any of the given methods, belonging to the *klass*. Returns True if so, False otherwise.
pylint/checkers/classes.py
def _called_in_methods(func, klass, methods): """ Check if the func was called in any of the given methods, belonging to the *klass*. Returns True if so, False otherwise. """ if not isinstance(func, astroid.FunctionDef): return False for method in methods: try: infered = ...
def _called_in_methods(func, klass, methods): """ Check if the func was called in any of the given methods, belonging to the *klass*. Returns True if so, False otherwise. """ if not isinstance(func, astroid.FunctionDef): return False for method in methods: try: infered = ...
[ "Check", "if", "the", "func", "was", "called", "in", "any", "of", "the", "given", "methods", "belonging", "to", "the", "*", "klass", "*", ".", "Returns", "True", "if", "so", "False", "otherwise", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L341-L365
[ "def", "_called_in_methods", "(", "func", ",", "klass", ",", "methods", ")", ":", "if", "not", "isinstance", "(", "func", ",", "astroid", ".", "FunctionDef", ")", ":", "return", "False", "for", "method", "in", "methods", ":", "try", ":", "infered", "=", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_is_attribute_property
Check if the given attribute *name* is a property in the given *klass*. It will look for `property` calls or for functions with the given name, decorated by `property` or `property` subclasses. Returns ``True`` if the name is a property in the given klass, ``False`` otherwise.
pylint/checkers/classes.py
def _is_attribute_property(name, klass): """ Check if the given attribute *name* is a property in the given *klass*. It will look for `property` calls or for functions with the given name, decorated by `property` or `property` subclasses. Returns ``True`` if the name is a property in the given ...
def _is_attribute_property(name, klass): """ Check if the given attribute *name* is a property in the given *klass*. It will look for `property` calls or for functions with the given name, decorated by `property` or `property` subclasses. Returns ``True`` if the name is a property in the given ...
[ "Check", "if", "the", "given", "attribute", "*", "name", "*", "is", "a", "property", "in", "the", "given", "*", "klass", "*", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L368-L397
[ "def", "_is_attribute_property", "(", "name", ",", "klass", ")", ":", "try", ":", "attributes", "=", "klass", ".", "getattr", "(", "name", ")", "except", "astroid", ".", "NotFoundError", ":", "return", "False", "property_name", "=", "\"{}.property\"", ".", "...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_safe_infer_call_result
Safely infer the return value of a function. Returns None if inference failed or if there is some ambiguity (more than one node has been inferred). Otherwise returns infered value.
pylint/checkers/classes.py
def _safe_infer_call_result(node, caller, context=None): """ Safely infer the return value of a function. Returns None if inference failed or if there is some ambiguity (more than one node has been inferred). Otherwise returns infered value. """ try: inferit = node.infer_call_result(cal...
def _safe_infer_call_result(node, caller, context=None): """ Safely infer the return value of a function. Returns None if inference failed or if there is some ambiguity (more than one node has been inferred). Otherwise returns infered value. """ try: inferit = node.infer_call_result(cal...
[ "Safely", "infer", "the", "return", "value", "of", "a", "function", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L408-L428
[ "def", "_safe_infer_call_result", "(", "node", ",", "caller", ",", "context", "=", "None", ")", ":", "try", ":", "inferit", "=", "node", ".", "infer_call_result", "(", "caller", ",", "context", "=", "context", ")", "value", "=", "next", "(", "inferit", "...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
_ancestors_to_call
return a dictionary where keys are the list of base classes providing the queried method, and so that should/may be called from the method node
pylint/checkers/classes.py
def _ancestors_to_call(klass_node, method="__init__"): """return a dictionary where keys are the list of base classes providing the queried method, and so that should/may be called from the method node """ to_call = {} for base_node in klass_node.ancestors(recurs=False): try: to_...
def _ancestors_to_call(klass_node, method="__init__"): """return a dictionary where keys are the list of base classes providing the queried method, and so that should/may be called from the method node """ to_call = {} for base_node in klass_node.ancestors(recurs=False): try: to_...
[ "return", "a", "dictionary", "where", "keys", "are", "the", "list", "of", "base", "classes", "providing", "the", "queried", "method", "and", "so", "that", "should", "/", "may", "be", "called", "from", "the", "method", "node" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L1758-L1768
[ "def", "_ancestors_to_call", "(", "klass_node", ",", "method", "=", "\"__init__\"", ")", ":", "to_call", "=", "{", "}", "for", "base_node", "in", "klass_node", ".", "ancestors", "(", "recurs", "=", "False", ")", ":", "try", ":", "to_call", "[", "base_node"...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
register
required method to auto register this checker
pylint/checkers/classes.py
def register(linter): """required method to auto register this checker """ linter.register_checker(ClassChecker(linter)) linter.register_checker(SpecialMethodsChecker(linter))
def register(linter): """required method to auto register this checker """ linter.register_checker(ClassChecker(linter)) linter.register_checker(SpecialMethodsChecker(linter))
[ "required", "method", "to", "auto", "register", "this", "checker" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L1771-L1774
[ "def", "register", "(", "linter", ")", ":", "linter", ".", "register_checker", "(", "ClassChecker", "(", "linter", ")", ")", "linter", ".", "register_checker", "(", "SpecialMethodsChecker", "(", "linter", ")", ")" ]
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ScopeAccessMap.set_accessed
Set the given node as accessed.
pylint/checkers/classes.py
def set_accessed(self, node): """Set the given node as accessed.""" frame = node_frame_class(node) if frame is None: # The node does not live in a class. return self._scopes[frame][node.attrname].append(node)
def set_accessed(self, node): """Set the given node as accessed.""" frame = node_frame_class(node) if frame is None: # The node does not live in a class. return self._scopes[frame][node.attrname].append(node)
[ "Set", "the", "given", "node", "as", "accessed", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L633-L640
[ "def", "set_accessed", "(", "self", ",", "node", ")", ":", "frame", "=", "node_frame_class", "(", "node", ")", "if", "frame", "is", "None", ":", "# The node does not live in a class.", "return", "self", ".", "_scopes", "[", "frame", "]", "[", "node", ".", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassChecker.visit_classdef
init visit variable _accessed
pylint/checkers/classes.py
def visit_classdef(self, node): """init visit variable _accessed """ self._check_bases_classes(node) # if not an exception or a metaclass if node.type == "class" and has_known_bases(node): try: node.local_attr("__init__") except astroid.Not...
def visit_classdef(self, node): """init visit variable _accessed """ self._check_bases_classes(node) # if not an exception or a metaclass if node.type == "class" and has_known_bases(node): try: node.local_attr("__init__") except astroid.Not...
[ "init", "visit", "variable", "_accessed" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L742-L754
[ "def", "visit_classdef", "(", "self", ",", "node", ")", ":", "self", ".", "_check_bases_classes", "(", "node", ")", "# if not an exception or a metaclass", "if", "node", ".", "type", "==", "\"class\"", "and", "has_known_bases", "(", "node", ")", ":", "try", ":...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassChecker._check_consistent_mro
Detect that a class has a consistent mro or duplicate bases.
pylint/checkers/classes.py
def _check_consistent_mro(self, node): """Detect that a class has a consistent mro or duplicate bases.""" try: node.mro() except InconsistentMroError: self.add_message("inconsistent-mro", args=node.name, node=node) except DuplicateBasesError: self.add_...
def _check_consistent_mro(self, node): """Detect that a class has a consistent mro or duplicate bases.""" try: node.mro() except InconsistentMroError: self.add_message("inconsistent-mro", args=node.name, node=node) except DuplicateBasesError: self.add_...
[ "Detect", "that", "a", "class", "has", "a", "consistent", "mro", "or", "duplicate", "bases", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L756-L766
[ "def", "_check_consistent_mro", "(", "self", ",", "node", ")", ":", "try", ":", "node", ".", "mro", "(", ")", "except", "InconsistentMroError", ":", "self", ".", "add_message", "(", "\"inconsistent-mro\"", ",", "args", "=", "node", ".", "name", ",", "node"...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassChecker._check_proper_bases
Detect that a class inherits something which is not a class or a type.
pylint/checkers/classes.py
def _check_proper_bases(self, node): """ Detect that a class inherits something which is not a class or a type. """ for base in node.bases: ancestor = safe_infer(base) if ancestor in (astroid.Uninferable, None): continue if isin...
def _check_proper_bases(self, node): """ Detect that a class inherits something which is not a class or a type. """ for base in node.bases: ancestor = safe_infer(base) if ancestor in (astroid.Uninferable, None): continue if isin...
[ "Detect", "that", "a", "class", "inherits", "something", "which", "is", "not", "a", "class", "or", "a", "type", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L768-L790
[ "def", "_check_proper_bases", "(", "self", ",", "node", ")", ":", "for", "base", "in", "node", ".", "bases", ":", "ancestor", "=", "safe_infer", "(", "base", ")", "if", "ancestor", "in", "(", "astroid", ".", "Uninferable", ",", "None", ")", ":", "conti...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassChecker.leave_classdef
close a class node: check that instance attributes are defined in __init__ and check access to existent members
pylint/checkers/classes.py
def leave_classdef(self, cnode): """close a class node: check that instance attributes are defined in __init__ and check access to existent members """ # check access to existent members on non metaclass classes if self._ignore_mixin and cnode.name[-5:].lower() == "mixin"...
def leave_classdef(self, cnode): """close a class node: check that instance attributes are defined in __init__ and check access to existent members """ # check access to existent members on non metaclass classes if self._ignore_mixin and cnode.name[-5:].lower() == "mixin"...
[ "close", "a", "class", "node", ":", "check", "that", "instance", "attributes", "are", "defined", "in", "__init__", "and", "check", "access", "to", "existent", "members" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L792-L853
[ "def", "leave_classdef", "(", "self", ",", "cnode", ")", ":", "# check access to existent members on non metaclass classes", "if", "self", ".", "_ignore_mixin", "and", "cnode", ".", "name", "[", "-", "5", ":", "]", ".", "lower", "(", ")", "==", "\"mixin\"", ":...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassChecker.visit_functiondef
check method arguments, overriding
pylint/checkers/classes.py
def visit_functiondef(self, node): """check method arguments, overriding""" # ignore actual functions if not node.is_method(): return self._check_useless_super_delegation(node) klass = node.parent.frame() self._meth_could_be_func = True # check first...
def visit_functiondef(self, node): """check method arguments, overriding""" # ignore actual functions if not node.is_method(): return self._check_useless_super_delegation(node) klass = node.parent.frame() self._meth_could_be_func = True # check first...
[ "check", "method", "arguments", "overriding" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L855-L934
[ "def", "visit_functiondef", "(", "self", ",", "node", ")", ":", "# ignore actual functions", "if", "not", "node", ".", "is_method", "(", ")", ":", "return", "self", ".", "_check_useless_super_delegation", "(", "node", ")", "klass", "=", "node", ".", "parent", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassChecker._check_useless_super_delegation
Check if the given function node is an useless method override We consider it *useless* if it uses the super() builtin, but having nothing additional whatsoever than not implementing the method at all. If the method uses super() to delegate an operation to the rest of the MRO, and if th...
pylint/checkers/classes.py
def _check_useless_super_delegation(self, function): """Check if the given function node is an useless method override We consider it *useless* if it uses the super() builtin, but having nothing additional whatsoever than not implementing the method at all. If the method uses super() to...
def _check_useless_super_delegation(self, function): """Check if the given function node is an useless method override We consider it *useless* if it uses the super() builtin, but having nothing additional whatsoever than not implementing the method at all. If the method uses super() to...
[ "Check", "if", "the", "given", "function", "node", "is", "an", "useless", "method", "override" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L938-L1042
[ "def", "_check_useless_super_delegation", "(", "self", ",", "function", ")", ":", "if", "(", "not", "function", ".", "is_method", "(", ")", "# With decorators is a change of use", "or", "function", ".", "decorators", ")", ":", "return", "body", "=", "function", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassChecker.leave_functiondef
on method node, check if this method couldn't be a function ignore class, static and abstract methods, initializer, methods overridden from a parent class.
pylint/checkers/classes.py
def leave_functiondef(self, node): """on method node, check if this method couldn't be a function ignore class, static and abstract methods, initializer, methods overridden from a parent class. """ if node.is_method(): if node.args.args is not None: s...
def leave_functiondef(self, node): """on method node, check if this method couldn't be a function ignore class, static and abstract methods, initializer, methods overridden from a parent class. """ if node.is_method(): if node.args.args is not None: s...
[ "on", "method", "node", "check", "if", "this", "method", "couldn", "t", "be", "a", "function" ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L1098-L1121
[ "def", "leave_functiondef", "(", "self", ",", "node", ")", ":", "if", "node", ".", "is_method", "(", ")", ":", "if", "node", ".", "args", ".", "args", "is", "not", "None", ":", "self", ".", "_first_attrs", ".", "pop", "(", ")", "if", "not", "self",...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassChecker.visit_attribute
check if the getattr is an access to a class member if so, register it. Also check for access to protected class member from outside its class (but ignore __special__ methods)
pylint/checkers/classes.py
def visit_attribute(self, node): """check if the getattr is an access to a class member if so, register it. Also check for access to protected class member from outside its class (but ignore __special__ methods) """ # Check self if self._uses_mandatory_method_para...
def visit_attribute(self, node): """check if the getattr is an access to a class member if so, register it. Also check for access to protected class member from outside its class (but ignore __special__ methods) """ # Check self if self._uses_mandatory_method_para...
[ "check", "if", "the", "getattr", "is", "an", "access", "to", "a", "class", "member", "if", "so", "register", "it", ".", "Also", "check", "for", "access", "to", "protected", "class", "member", "from", "outside", "its", "class", "(", "but", "ignore", "__sp...
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L1123-L1136
[ "def", "visit_attribute", "(", "self", ",", "node", ")", ":", "# Check self", "if", "self", ".", "_uses_mandatory_method_param", "(", "node", ")", ":", "self", ".", "_accessed", ".", "set_accessed", "(", "node", ")", "return", "if", "not", "self", ".", "li...
2bf5c61a3ff6ae90613b81679de42c0f19aea600
test
ClassChecker._check_in_slots
Check that the given AssignAttr node is defined in the class slots.
pylint/checkers/classes.py
def _check_in_slots(self, node): """ Check that the given AssignAttr node is defined in the class slots. """ inferred = safe_infer(node.expr) if not isinstance(inferred, astroid.Instance): return klass = inferred._proxied if not has_known_bases(klass)...
def _check_in_slots(self, node): """ Check that the given AssignAttr node is defined in the class slots. """ inferred = safe_infer(node.expr) if not isinstance(inferred, astroid.Instance): return klass = inferred._proxied if not has_known_bases(klass)...
[ "Check", "that", "the", "given", "AssignAttr", "node", "is", "defined", "in", "the", "class", "slots", "." ]
PyCQA/pylint
python
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/classes.py#L1145-L1187
[ "def", "_check_in_slots", "(", "self", ",", "node", ")", ":", "inferred", "=", "safe_infer", "(", "node", ".", "expr", ")", "if", "not", "isinstance", "(", "inferred", ",", "astroid", ".", "Instance", ")", ":", "return", "klass", "=", "inferred", ".", ...
2bf5c61a3ff6ae90613b81679de42c0f19aea600