The following issues were found
Tools/clinic/cpp.py
22 issues
Line: 27
Column: 24
is_a_simple_defined = re.compile(r'^defined\s*\(\s*[A-Za-z0-9_]+\s*\)$').match
def __init__(self, filename=None, *, verbose=False):
self.stack = []
self.in_comment = False
self.continuation = None
self.line_number = 0
self.filename = filename
Reported by Pylint.
Line: 54
Column: 13
def fail(self, *a):
if self.filename:
filename = " " + self.filename
else:
filename = ''
print("Error at" + filename, "line", self.line_number, ":")
print(" ", ' '.join(str(x) for x in a))
sys.exit(-1)
Reported by Pylint.
Line: 66
Column: 13
self.fail("Ended file while still in a preprocessor conditional block!")
def write(self, s):
for line in s.split("\n"):
self.writeline(line)
def writeline(self, line):
self.line_number += 1
line = line.strip()
Reported by Pylint.
Line: 69
Column: 25
for line in s.split("\n"):
self.writeline(line)
def writeline(self, line):
self.line_number += 1
line = line.strip()
def pop_stack():
if not self.stack:
Reported by Pylint.
Line: 118
Column: 17
self.fail("Nested block comment!")
before, _, remainder = line.partition('/*')
comment, comment_ends, after = remainder.partition('*/')
if comment_ends:
# snip out the comment
line = before.rstrip() + ' ' + after.lstrip()
continue
# comment continues to eol
Reported by Pylint.
Line: 1
Column: 1
import re
import sys
def negate(condition):
"""
Returns a CPP conditional that is the opposite of the conditional passed in.
"""
if condition.startswith('!'):
return condition[1:]
Reported by Pylint.
Line: 43
Column: 5
" condition=", repr(self.condition()),
">"))
def status(self):
return str(self.line_number).rjust(4) + ": " + self.condition()
def condition(self):
"""
Returns the current preprocessor state, as a single #if condition.
Reported by Pylint.
Line: 52
Column: 5
"""
return " && ".join(condition for token, condition in self.stack)
def fail(self, *a):
if self.filename:
filename = " " + self.filename
else:
filename = ''
print("Error at" + filename, "line", self.line_number, ":")
Reported by Pylint.
Line: 61
Column: 5
print(" ", ' '.join(str(x) for x in a))
sys.exit(-1)
def close(self):
if self.stack:
self.fail("Ended file while still in a preprocessor conditional block!")
def write(self, s):
for line in s.split("\n"):
Reported by Pylint.
Line: 65
Column: 5
if self.stack:
self.fail("Ended file while still in a preprocessor conditional block!")
def write(self, s):
for line in s.split("\n"):
self.writeline(line)
def writeline(self, line):
self.line_number += 1
Reported by Pylint.
Lib/test/test_profile.py
22 issues
Line: 14
Column: 1
from contextlib import contextmanager
import profile
from test.profilee import testfunc, timer
from test.support.script_helper import assert_python_failure, assert_python_ok
class ProfileTest(unittest.TestCase):
Reported by Pylint.
Line: 18
Column: 1
from test.support.script_helper import assert_python_failure, assert_python_ok
class ProfileTest(unittest.TestCase):
profilerclass = profile.Profile
profilermodule = profile
methodnames = ['print_stats', 'print_callers', 'print_callees']
expected_max_output = ':0(max)'
Reported by Pylint.
Line: 28
Column: 5
def tearDown(self):
unlink(TESTFN)
def get_expected_output(self):
return _ProfileOutput
@classmethod
def do_profiling(cls):
results = []
Reported by Pylint.
Line: 28
Column: 5
def tearDown(self):
unlink(TESTFN)
def get_expected_output(self):
return _ProfileOutput
@classmethod
def do_profiling(cls):
results = []
Reported by Pylint.
Line: 32
Column: 5
return _ProfileOutput
@classmethod
def do_profiling(cls):
results = []
prof = cls.profilerclass(timer, 0.001)
start_timer = timer()
prof.runctx("testfunc()", globals(), locals())
results.append(timer() - start_timer)
Reported by Pylint.
Line: 39
Column: 13
prof.runctx("testfunc()", globals(), locals())
results.append(timer() - start_timer)
for methodname in cls.methodnames:
s = StringIO()
stats = pstats.Stats(prof, stream=s)
stats.strip_dirs().sort_stats("stdname")
getattr(stats, methodname)()
output = s.getvalue().splitlines()
mod_name = testfunc.__module__.rsplit('.', 1)[1]
Reported by Pylint.
Line: 52
Column: 5
results.append('\n'.join(output))
return results
def test_cprofile(self):
results = self.do_profiling()
expected = self.get_expected_output()
self.assertEqual(results[0], 1000)
fail = []
for i, method in enumerate(self.methodnames):
Reported by Pylint.
Line: 58
Column: 13
self.assertEqual(results[0], 1000)
fail = []
for i, method in enumerate(self.methodnames):
a = expected[method]
b = results[i+1]
if a != b:
fail.append(f"\nStats.{method} output for "
f"{self.profilerclass.__name__} "
"does not fit expectation:")
Reported by Pylint.
Line: 59
Column: 13
fail = []
for i, method in enumerate(self.methodnames):
a = expected[method]
b = results[i+1]
if a != b:
fail.append(f"\nStats.{method} output for "
f"{self.profilerclass.__name__} "
"does not fit expectation:")
fail.extend(unified_diff(a.split('\n'), b.split('\n'),
Reported by Pylint.
Line: 69
Column: 5
if fail:
self.fail("\n".join(fail))
def test_calling_conventions(self):
# Issue #5330: profile and cProfile wouldn't report C functions called
# with keyword arguments. We test all calling conventions.
stmts = [
"max([0])",
"max([0], key=int)",
Reported by Pylint.
Parser/pegen.c
21 issues
Line: 1634
Column: 5
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
return NULL;
}
strcpy(s, first_str);
s += strlen(first_str);
*s++ = '.';
strcpy(s, second_str);
s += strlen(second_str);
*s = '\0';
Reported by FlawFinder.
Line: 1637
Column: 5
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
strcpy(s, first_str);
s += strlen(first_str);
*s++ = '.';
strcpy(s, second_str);
s += strlen(second_str);
*s = '\0';
PyObject *uni = PyUnicode_DecodeUTF8(PyBytes_AS_STRING(str), PyBytes_GET_SIZE(str), NULL);
Py_DECREF(str);
Reported by FlawFinder.
Line: 462
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
// Copy both strings into new buffer
memcpy(new_errmsg, fstring_msg, strlen(fstring_msg));
memcpy(new_errmsg + strlen(fstring_msg), errmsg, strlen(errmsg));
new_errmsg[len] = 0;
errmsg = new_errmsg;
}
errstr = PyUnicode_FromFormatV(errmsg, va);
Reported by FlawFinder.
Line: 463
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
// Copy both strings into new buffer
memcpy(new_errmsg, fstring_msg, strlen(fstring_msg));
memcpy(new_errmsg + strlen(fstring_msg), errmsg, strlen(errmsg));
new_errmsg[len] = 0;
errmsg = new_errmsg;
}
errstr = PyUnicode_FromFormatV(errmsg, va);
if (!errstr) {
Reported by FlawFinder.
Line: 12
Column: 45
CWE codes:
126
PyObject *
_PyPegen_new_type_comment(Parser *p, const char *s)
{
PyObject *res = PyUnicode_DecodeUTF8(s, strlen(s), NULL);
if (res == NULL) {
return NULL;
}
if (_PyArena_AddPyObject(p->arena, res) < 0) {
Py_DECREF(res);
Reported by FlawFinder.
Line: 95
Column: 44
CWE codes:
126
PyObject *
_PyPegen_new_identifier(Parser *p, const char *n)
{
PyObject *id = PyUnicode_DecodeUTF8(n, strlen(n), NULL);
if (!id) {
goto error;
}
/* PyUnicode_DecodeUTF8 should always return a ready string. */
assert(PyUnicode_IS_READY(id));
Reported by FlawFinder.
Line: 354
Column: 26
CWE codes:
126
msg = "too many levels of indentation";
break;
case E_LINECONT:
col_offset = strlen(strtok(p->tok->buf, "\n")) - 1;
msg = "unexpected character after line continuation character";
break;
default:
msg = "unknown parsing error";
}
Reported by FlawFinder.
Line: 407
Column: 35
CWE codes:
126
char *next_newline;
if ((next_newline = strchr(cur_line, '\n')) == NULL) { // This is the last line
next_newline = cur_line + strlen(cur_line);
}
return PyUnicode_DecodeUTF8(cur_line, next_newline - cur_line, "replace");
}
Py_ssize_t
Reported by FlawFinder.
Line: 419
Column: 22
CWE codes:
126
if (!str) {
return -1;
}
Py_ssize_t len = strlen(str);
if (col_offset > len + 1) {
col_offset = len + 1;
}
assert(col_offset >= 0);
PyObject *text = PyUnicode_DecodeUTF8(str, col_offset, "replace");
Reported by FlawFinder.
Line: 454
Column: 48
CWE codes:
126
if (p->start_rule == Py_fstring_input) {
const char *fstring_msg = "f-string: ";
Py_ssize_t len = strlen(fstring_msg) + strlen(errmsg);
char *new_errmsg = PyMem_Malloc(len + 1); // Lengths of both strings plus NULL character
if (!new_errmsg) {
return (void *) PyErr_NoMemory();
}
Reported by FlawFinder.
PC/layout/support/filesets.py
21 issues
Line: 91
Column: 18
)
def _return_true(f):
return True
def rglob(root, patterns, condition=None):
if isinstance(patterns, tuple):
Reported by Pylint.
Line: 11
Column: 1
import os
class FileStemSet:
def __init__(self, *patterns):
self._names = set()
self._prefixes = []
self._suffixes = []
for p in map(os.path.normcase, patterns):
Reported by Pylint.
Line: 11
Column: 1
import os
class FileStemSet:
def __init__(self, *patterns):
self._names = set()
self._prefixes = []
self._suffixes = []
for p in map(os.path.normcase, patterns):
Reported by Pylint.
Line: 16
Column: 13
self._names = set()
self._prefixes = []
self._suffixes = []
for p in map(os.path.normcase, patterns):
if p.endswith("*"):
self._prefixes.append(p[:-1])
elif p.startswith("*"):
self._suffixes.append(p[1:])
else:
Reported by Pylint.
Line: 24
Column: 5
else:
self._names.add(p)
def _make_name(self, f):
return os.path.normcase(f.stem)
def __contains__(self, f):
bn = self._make_name(f)
return (
Reported by Pylint.
Line: 24
Column: 5
else:
self._names.add(p)
def _make_name(self, f):
return os.path.normcase(f.stem)
def __contains__(self, f):
bn = self._make_name(f)
return (
Reported by Pylint.
Line: 27
Column: 5
def _make_name(self, f):
return os.path.normcase(f.stem)
def __contains__(self, f):
bn = self._make_name(f)
return (
bn in self._names
or any(map(bn.startswith, self._prefixes))
or any(map(bn.endswith, self._suffixes))
Reported by Pylint.
Line: 28
Column: 9
return os.path.normcase(f.stem)
def __contains__(self, f):
bn = self._make_name(f)
return (
bn in self._names
or any(map(bn.startswith, self._prefixes))
or any(map(bn.endswith, self._suffixes))
)
Reported by Pylint.
Line: 36
Column: 1
)
class FileNameSet(FileStemSet):
def _make_name(self, f):
return os.path.normcase(f.name)
class FileSuffixSet:
Reported by Pylint.
Line: 36
Column: 1
)
class FileNameSet(FileStemSet):
def _make_name(self, f):
return os.path.normcase(f.name)
class FileSuffixSet:
Reported by Pylint.
Tools/freeze/checkextensions.py
21 issues
Line: 20
Column: 20
edict[e] = parsesetup.getsetupinfo(setup), liba
for mod in unknown:
for e in extensions:
(mods, vars), liba = edict[e]
if mod not in mods:
continue
modules.append(mod)
if liba:
# If we find a lib.a, use it, ignore the
Reported by Pylint.
Line: 39
Column: 21
break
return files, modules
def select(e, mods, vars, mod, skipofiles):
files = []
for w in mods[mod]:
w = treatword(w)
if not w:
continue
Reported by Pylint.
Line: 46
Column: 9
if not w:
continue
w = expandvars(w, vars)
for w in w.split():
if skipofiles and w[-2:] == '.o':
continue
# Assume $var expands to absolute pathname
if w[0] not in ('-', '$') and w[-2:] in ('.o', '.a'):
w = os.path.join(e, w)
Reported by Pylint.
Line: 72
Column: 16
w = os.path.join(head, tail)
return w
def expandvars(str, vars):
i = 0
while i < len(str):
i = k = str.find('$', i)
if i < 0:
break
Reported by Pylint.
Line: 72
Column: 21
w = os.path.join(head, tail)
return w
def expandvars(str, vars):
i = 0
while i < len(str):
i = k = str.find('$', i)
if i < 0:
break
Reported by Pylint.
Line: 1
Column: 1
# Check for a module in a set of extension directories.
# An extension directory should contain a Setup file
# and one or more .o files or a lib.a file.
import os
import parsesetup
def checkextensions(unknown, extensions):
files = []
Reported by Pylint.
Line: 8
Column: 1
import os
import parsesetup
def checkextensions(unknown, extensions):
files = []
modules = []
edict = {}
for e in extensions:
setup = os.path.join(e, 'Setup')
Reported by Pylint.
Line: 12
Column: 9
files = []
modules = []
edict = {}
for e in extensions:
setup = os.path.join(e, 'Setup')
liba = os.path.join(e, 'lib.a')
if not os.path.isfile(liba):
liba = None
edict[e] = parsesetup.getsetupinfo(setup), liba
Reported by Pylint.
Line: 19
Column: 13
liba = None
edict[e] = parsesetup.getsetupinfo(setup), liba
for mod in unknown:
for e in extensions:
(mods, vars), liba = edict[e]
if mod not in mods:
continue
modules.append(mod)
if liba:
Reported by Pylint.
Line: 31
Column: 21
if liba in files:
break
files.append(liba)
for m in list(mods.keys()):
files = files + select(e, mods, vars,
m, 1)
break
files = files + select(e, mods, vars, mod, 0)
break
Reported by Pylint.
Lib/tkinter/test/test_tkinter/test_font.py
21 issues
Line: 1
Column: 1
import unittest
import tkinter
from tkinter import font
from test.support import requires, run_unittest, gc_collect, ALWAYS_EQ
from tkinter.test.support import AbstractTkTest, AbstractDefaultRootTest
requires('gui')
fontname = "TkDefaultFont"
Reported by Pylint.
Line: 5
Column: 1
import tkinter
from tkinter import font
from test.support import requires, run_unittest, gc_collect, ALWAYS_EQ
from tkinter.test.support import AbstractTkTest, AbstractDefaultRootTest
requires('gui')
fontname = "TkDefaultFont"
Reported by Pylint.
Line: 9
Column: 1
requires('gui')
fontname = "TkDefaultFont"
class FontTest(AbstractTkTest, unittest.TestCase):
@classmethod
def setUpClass(cls):
Reported by Pylint.
Line: 11
Column: 1
fontname = "TkDefaultFont"
class FontTest(AbstractTkTest, unittest.TestCase):
@classmethod
def setUpClass(cls):
AbstractTkTest.setUpClass.__func__(cls)
try:
Reported by Pylint.
Line: 21
Column: 5
except tkinter.TclError:
cls.font = font.Font(root=cls.root, name=fontname, exists=False)
def test_configure(self):
options = self.font.configure()
self.assertGreaterEqual(set(options),
{'family', 'size', 'weight', 'slant', 'underline', 'overstrike'})
for key in options:
self.assertEqual(self.font.cget(key), options[key])
Reported by Pylint.
Line: 38
Column: 5
self.assertIsInstance(self.font.cget(key), sizetype)
self.assertIsInstance(self.font[key], sizetype)
def test_unicode_family(self):
family = 'MS \u30b4\u30b7\u30c3\u30af'
try:
f = font.Font(root=self.root, family=family, exists=True)
except tkinter.TclError:
f = font.Font(root=self.root, family=family, exists=False)
Reported by Pylint.
Line: 41
Column: 13
def test_unicode_family(self):
family = 'MS \u30b4\u30b7\u30c3\u30af'
try:
f = font.Font(root=self.root, family=family, exists=True)
except tkinter.TclError:
f = font.Font(root=self.root, family=family, exists=False)
self.assertEqual(f.cget('family'), family)
del f
gc_collect()
Reported by Pylint.
Line: 43
Column: 13
try:
f = font.Font(root=self.root, family=family, exists=True)
except tkinter.TclError:
f = font.Font(root=self.root, family=family, exists=False)
self.assertEqual(f.cget('family'), family)
del f
gc_collect()
def test_actual(self):
Reported by Pylint.
Line: 48
Column: 5
del f
gc_collect()
def test_actual(self):
options = self.font.actual()
self.assertGreaterEqual(set(options),
{'family', 'size', 'weight', 'slant', 'underline', 'overstrike'})
for key in options:
self.assertEqual(self.font.actual(key), options[key])
Reported by Pylint.
Line: 62
Column: 5
self.assertIsInstance(options[key], sizetype)
self.assertIsInstance(self.font.actual(key), sizetype)
def test_name(self):
self.assertEqual(self.font.name, fontname)
self.assertEqual(str(self.font), fontname)
def test_equality(self):
font1 = font.Font(root=self.root, name=fontname, exists=True)
Reported by Pylint.
Lib/xml/dom/__init__.py
21 issues
Line: 73
Column: 16
Exception.__init__(self, *args, **kw)
def _get_code(self):
return self.code
class IndexSizeErr(DOMException):
code = INDEX_SIZE_ERR
Reported by Pylint.
Line: 140
Column: 1
EMPTY_NAMESPACE = None
EMPTY_PREFIX = None
from .domreg import getDOMImplementation, registerDOMImplementation
Reported by Pylint.
Line: 18
Column: 1
"""
class Node:
"""Class giving the NodeType constants."""
__slots__ = ()
# DOM implementations may use this as a base class for their own
# Node implementations. If they don't, the constants defined here
Reported by Pylint.
Line: 76
Column: 1
return self.code
class IndexSizeErr(DOMException):
code = INDEX_SIZE_ERR
class DomstringSizeErr(DOMException):
code = DOMSTRING_SIZE_ERR
Reported by Pylint.
Line: 79
Column: 1
class IndexSizeErr(DOMException):
code = INDEX_SIZE_ERR
class DomstringSizeErr(DOMException):
code = DOMSTRING_SIZE_ERR
class HierarchyRequestErr(DOMException):
code = HIERARCHY_REQUEST_ERR
Reported by Pylint.
Line: 82
Column: 1
class DomstringSizeErr(DOMException):
code = DOMSTRING_SIZE_ERR
class HierarchyRequestErr(DOMException):
code = HIERARCHY_REQUEST_ERR
class WrongDocumentErr(DOMException):
code = WRONG_DOCUMENT_ERR
Reported by Pylint.
Line: 85
Column: 1
class HierarchyRequestErr(DOMException):
code = HIERARCHY_REQUEST_ERR
class WrongDocumentErr(DOMException):
code = WRONG_DOCUMENT_ERR
class InvalidCharacterErr(DOMException):
code = INVALID_CHARACTER_ERR
Reported by Pylint.
Line: 88
Column: 1
class WrongDocumentErr(DOMException):
code = WRONG_DOCUMENT_ERR
class InvalidCharacterErr(DOMException):
code = INVALID_CHARACTER_ERR
class NoDataAllowedErr(DOMException):
code = NO_DATA_ALLOWED_ERR
Reported by Pylint.
Line: 91
Column: 1
class InvalidCharacterErr(DOMException):
code = INVALID_CHARACTER_ERR
class NoDataAllowedErr(DOMException):
code = NO_DATA_ALLOWED_ERR
class NoModificationAllowedErr(DOMException):
code = NO_MODIFICATION_ALLOWED_ERR
Reported by Pylint.
Line: 94
Column: 1
class NoDataAllowedErr(DOMException):
code = NO_DATA_ALLOWED_ERR
class NoModificationAllowedErr(DOMException):
code = NO_MODIFICATION_ALLOWED_ERR
class NotFoundErr(DOMException):
code = NOT_FOUND_ERR
Reported by Pylint.
Lib/test/test___all__.py
21 issues
Line: 25
Column: 17
("", ResourceWarning),
quiet=True):
try:
exec("import %s" % modname, names)
except:
# Silent fail here seems the best route since some modules
# may not be available or not initialize properly in all
# environments.
raise FailedImport(modname)
Reported by Pylint.
Line: 25
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html
("", ResourceWarning),
quiet=True):
try:
exec("import %s" % modname, names)
except:
# Silent fail here seems the best route since some modules
# may not be available or not initialize properly in all
# environments.
raise FailedImport(modname)
Reported by Bandit.
Line: 30
Column: 17
# Silent fail here seems the best route since some modules
# may not be available or not initialize properly in all
# environments.
raise FailedImport(modname)
if not hasattr(sys.modules[modname], "__all__"):
raise NoAll(modname)
names = {}
with self.subTest(module=modname):
with warnings_helper.check_warnings(
Reported by Pylint.
Line: 40
Column: 21
("", ResourceWarning),
quiet=True):
try:
exec("from %s import *" % modname, names)
except Exception as e:
# Include the module name in the exception string
self.fail("__all__ failure in {}: {}: {}".format(
modname, e.__class__.__name__, e))
if "__builtins__" in names:
Reported by Pylint.
Line: 40
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html
("", ResourceWarning),
quiet=True):
try:
exec("from %s import *" % modname, names)
except Exception as e:
# Include the module name in the exception string
self.fail("__all__ failure in {}: {}: {}".format(
modname, e.__class__.__name__, e))
if "__builtins__" in names:
Reported by Bandit.
Line: 41
Column: 24
quiet=True):
try:
exec("from %s import *" % modname, names)
except Exception as e:
# Include the module name in the exception string
self.fail("__all__ failure in {}: {}: {}".format(
modname, e.__class__.__name__, e))
if "__builtins__" in names:
del names["__builtins__"]
Reported by Pylint.
Line: 1
Column: 1
import unittest
from test import support
from test.support import warnings_helper
import os
import sys
class NoAll(RuntimeError):
pass
Reported by Pylint.
Line: 8
Column: 1
import sys
class NoAll(RuntimeError):
pass
class FailedImport(RuntimeError):
pass
Reported by Pylint.
Line: 11
Column: 1
class NoAll(RuntimeError):
pass
class FailedImport(RuntimeError):
pass
class AllTest(unittest.TestCase):
Reported by Pylint.
Line: 15
Column: 1
pass
class AllTest(unittest.TestCase):
def check_all(self, modname):
names = {}
with warnings_helper.check_warnings(
(".* (module|package)", DeprecationWarning),
Reported by Pylint.
Lib/test/ann_module2.py
21 issues
Line: 13
Column: 5
x: float = i/10
def f():
class C: ...
return C()
f().new_attr: object = object()
class C:
Reported by Pylint.
Line: 16
Column: 1
class C: ...
return C()
f().new_attr: object = object()
class C:
def __init__(self, x: int) -> None:
self.x = x
Reported by Pylint.
Line: 19
Column: 24
f().new_attr: object = object()
class C:
def __init__(self, x: int) -> None:
self.x = x
c = C(5)
c.new_attr: int = 10
Reported by Pylint.
Line: 23
Column: 1
self.x = x
c = C(5)
c.new_attr: int = 10
__annotations__ = {}
@no_type_check
Reported by Pylint.
Line: 30
Column: 20
@no_type_check
class NTC:
def meth(self, param: complex) -> None:
...
class CV:
var: ClassVar['CV']
Reported by Pylint.
Line: 12
Column: 1
j: int
x: float = i/10
def f():
class C: ...
return C()
f().new_attr: object = object()
Reported by Pylint.
Line: 12
Column: 1
j: int
x: float = i/10
def f():
class C: ...
return C()
f().new_attr: object = object()
Reported by Pylint.
Line: 13
Column: 5
x: float = i/10
def f():
class C: ...
return C()
f().new_attr: object = object()
class C:
Reported by Pylint.
Line: 13
Column: 5
x: float = i/10
def f():
class C: ...
return C()
f().new_attr: object = object()
class C:
Reported by Pylint.
Line: 13
Column: 14
x: float = i/10
def f():
class C: ...
return C()
f().new_attr: object = object()
class C:
Reported by Pylint.
Lib/telnetlib.py
21 issues
Line: 220
Column: 42
if host is not None:
self.open(host, port, timeout)
def open(self, host, port=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
"""Connect to a host.
The optional second argument is the port number, which
defaults to the standard telnet port (23).
Reported by Pylint.
Line: 546
Column: 26
selector.register(sys.stdin, selectors.EVENT_READ)
while True:
for key, events in selector.select():
if key.fileobj is self:
try:
text = self.read_eager()
except EOFError:
print('*** Connection closed by remote host ***')
Reported by Pylint.
Line: 585
Column: 22
else:
sys.stdout.flush()
def expect(self, list, timeout=None):
"""Read until one from a list of a regular expressions matches.
The first argument is a list of regular expressions, either
compiled (re.Pattern instances) or uncompiled (strings).
The optional second argument is a timeout, in seconds; default
Reported by Pylint.
Line: 644
Column: 24
def __enter__(self):
return self
def __exit__(self, type, value, traceback):
self.close()
def test():
"""Test program for telnetlib.
Reported by Pylint.
Line: 141
Column: 1
_TelnetSelector = selectors.SelectSelector
class Telnet:
"""Telnet interface class.
An instance of this class represents a connection to a telnet
server. The instance is initially not connected; the open()
Reported by Pylint.
Line: 141
Column: 1
_TelnetSelector = selectors.SelectSelector
class Telnet:
"""Telnet interface class.
An instance of this class represents a connection to a telnet
server. The instance is initially not connected; the open()
Reported by Pylint.
Line: 214
Column: 9
self.cookedq = b''
self.eof = 0
self.iacseq = b'' # Buffer for IAC sequence.
self.sb = 0 # flag for SB and SE sequence.
self.sbdataq = b''
self.option_callback = None
if host is not None:
self.open(host, port, timeout)
Reported by Pylint.
Line: 302
Column: 9
is closed and no cooked data is available.
"""
n = len(match)
self.process_rawq()
i = self.cookedq.find(match)
if i >= 0:
i = i+n
buf = self.cookedq[:i]
Reported by Pylint.
Line: 424
Column: 5
"""Provide a callback function called after each receipt of a telnet option."""
self.option_callback = callback
def process_rawq(self):
"""Transfer from raw queue to cooked queue.
Set self.eof when connection is closed. Don't block unless in
the midst of an IAC sequence.
Reported by Pylint.
Line: 424
Column: 5
"""Provide a callback function called after each receipt of a telnet option."""
self.option_callback = callback
def process_rawq(self):
"""Transfer from raw queue to cooked queue.
Set self.eof when connection is closed. Don't block unless in
the midst of an IAC sequence.
Reported by Pylint.