The following issues were found
Lib/test/test_netrc.py
30 issues
Line: 125
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b103_set_bad_file_permissions.html
nrc = netrc.netrc()
self.assertEqual(nrc.hosts['foo.domain.com'],
('bar', None, 'pass'))
os.chmod(fn, 0o622)
self.assertRaises(netrc.NetrcParseError, netrc.netrc)
def test_file_not_found_in_home(self):
with os_helper.temp_cwd(None) as d:
with os_helper.EnvironmentVarGuard() as environ:
Reported by Bandit.
Line: 158
Column: 24
with support.swap_attr(os.path, 'expanduser', fake_expanduser):
nrc = netrc.netrc()
login, account, password = nrc.authenticators('foo.domain.com')
self.assertEqual(login, 'bar')
self.assertTrue(called)
Reported by Pylint.
Line: 158
Column: 33
with support.swap_attr(os.path, 'expanduser', fake_expanduser):
nrc = netrc.netrc()
login, account, password = nrc.authenticators('foo.domain.com')
self.assertEqual(login, 'bar')
self.assertTrue(called)
Reported by Pylint.
Line: 1
Column: 1
import netrc, os, unittest, sys, tempfile, textwrap
from test import support
from test.support import os_helper
class NetrcTestCase(unittest.TestCase):
def make_nrc(self, test_data):
test_data = textwrap.dedent(test_data)
Reported by Pylint.
Line: 1
Column: 1
import netrc, os, unittest, sys, tempfile, textwrap
from test import support
from test.support import os_helper
class NetrcTestCase(unittest.TestCase):
def make_nrc(self, test_data):
test_data = textwrap.dedent(test_data)
Reported by Pylint.
Line: 6
Column: 1
from test.support import os_helper
class NetrcTestCase(unittest.TestCase):
def make_nrc(self, test_data):
test_data = textwrap.dedent(test_data)
mode = 'w'
if sys.platform != 'cygwin':
Reported by Pylint.
Line: 8
Column: 5
class NetrcTestCase(unittest.TestCase):
def make_nrc(self, test_data):
test_data = textwrap.dedent(test_data)
mode = 'w'
if sys.platform != 'cygwin':
mode += 't'
temp_fd, temp_filename = tempfile.mkstemp()
Reported by Pylint.
Line: 14
Column: 47
if sys.platform != 'cygwin':
mode += 't'
temp_fd, temp_filename = tempfile.mkstemp()
with os.fdopen(temp_fd, mode=mode) as fp:
fp.write(test_data)
self.addCleanup(os.unlink, temp_filename)
return netrc.netrc(temp_filename)
def test_default(self):
Reported by Pylint.
Line: 19
Column: 5
self.addCleanup(os.unlink, temp_filename)
return netrc.netrc(temp_filename)
def test_default(self):
nrc = self.make_nrc("""\
machine host1.domain.com login log1 password pass1 account acct1
default login log2 password pass2
""")
self.assertEqual(nrc.hosts['host1.domain.com'],
Reported by Pylint.
Line: 31
Column: 5
nrc2 = self.make_nrc(nrc.__repr__())
self.assertEqual(nrc.hosts, nrc2.hosts)
def test_macros(self):
nrc = self.make_nrc("""\
macdef macro1
line1
line2
Reported by Pylint.
Lib/pyclbr.py
29 issues
Line: 94
Column: 53
return Function(ob.module, func_name, ob.file, lineno,
parent=ob, is_async=is_async, end_lineno=end_lineno)
def _nest_class(ob, class_name, lineno, end_lineno, super=None):
"Return a Class after nesting within ob."
return Class(ob.module, class_name, super, ob.file, lineno,
parent=ob, end_lineno=end_lineno)
Reported by Pylint.
Line: 161
Column: 5
return _readmodule(submodule, parent['__path__'], package)
# Search the path for the module.
f = None
if inpackage is not None:
search_path = path
else:
search_path = path + sys.path
spec = importlib.util._find_spec_from_path(fullmodule, search_path)
Reported by Pylint.
Line: 166
Column: 12
search_path = path
else:
search_path = path + sys.path
spec = importlib.util._find_spec_from_path(fullmodule, search_path)
if spec is None:
raise ModuleNotFoundError(f"no module named {fullmodule!r}", name=fullmodule)
_modules[fullmodule] = tree
# Is module a package?
if spec.submodule_search_locations is not None:
Reported by Pylint.
Line: 280
Column: 5
import os
try:
mod = sys.argv[1]
except:
mod = __file__
if os.path.exists(mod):
path = [os.path.dirname(mod)]
mod = os.path.basename(mod)
if mod.lower().endswith(".py"):
Reported by Pylint.
Line: 53
Column: 1
_modules = {} # Initialize cache of modules we've seen.
class _Object:
"Information about Python class or function."
def __init__(self, module, name, file, lineno, end_lineno, parent):
self.module = module
self.name = name
self.file = file
Reported by Pylint.
Line: 55
Column: 5
class _Object:
"Information about Python class or function."
def __init__(self, module, name, file, lineno, end_lineno, parent):
self.module = module
self.name = name
self.file = file
self.lineno = lineno
self.end_lineno = end_lineno
Reported by Pylint.
Line: 68
Column: 1
# Odd Function and Class signatures are for back-compatibility.
class Function(_Object):
"Information about a Python function, including methods."
def __init__(self, module, name, file, lineno,
parent=None, is_async=False, *, end_lineno=None):
super().__init__(module, name, file, lineno, end_lineno, parent)
self.is_async = is_async
Reported by Pylint.
Line: 70
Column: 5
# Odd Function and Class signatures are for back-compatibility.
class Function(_Object):
"Information about a Python function, including methods."
def __init__(self, module, name, file, lineno,
parent=None, is_async=False, *, end_lineno=None):
super().__init__(module, name, file, lineno, end_lineno, parent)
self.is_async = is_async
if isinstance(parent, Class):
parent.methods[name] = lineno
Reported by Pylint.
Line: 78
Column: 1
parent.methods[name] = lineno
class Class(_Object):
"Information about a Python class."
def __init__(self, module, name, super_, file, lineno,
parent=None, *, end_lineno=None):
super().__init__(module, name, file, lineno, end_lineno, parent)
self.super = super_ or []
Reported by Pylint.
Line: 80
Column: 5
class Class(_Object):
"Information about a Python class."
def __init__(self, module, name, super_, file, lineno,
parent=None, *, end_lineno=None):
super().__init__(module, name, file, lineno, end_lineno, parent)
self.super = super_ or []
self.methods = {}
Reported by Pylint.
Lib/test/test_dbm_ndbm.py
29 issues
Line: 35
Column: 13
self.assertIsNone(self.d.get(b'xxx'))
self.assertEqual(self.d.get(b'xxx', b'foo'), b'foo')
with self.assertRaises(KeyError):
self.d['xxx']
self.assertEqual(self.d.setdefault(b'xxx', b'foo'), b'foo')
self.assertEqual(self.d[b'xxx'], b'foo')
self.d.close()
def test_empty_value(self):
Reported by Pylint.
Line: 1
Column: 1
from test.support import import_helper
from test.support import os_helper
import_helper.import_module("dbm.ndbm") #skip if not supported
import os
import unittest
import dbm.ndbm
from dbm.ndbm import error
class DbmTestCase(unittest.TestCase):
Reported by Pylint.
Line: 4
Column: 1
from test.support import import_helper
from test.support import os_helper
import_helper.import_module("dbm.ndbm") #skip if not supported
import os
import unittest
import dbm.ndbm
from dbm.ndbm import error
class DbmTestCase(unittest.TestCase):
Reported by Pylint.
Line: 5
Column: 1
from test.support import os_helper
import_helper.import_module("dbm.ndbm") #skip if not supported
import os
import unittest
import dbm.ndbm
from dbm.ndbm import error
class DbmTestCase(unittest.TestCase):
Reported by Pylint.
Line: 6
Column: 1
import_helper.import_module("dbm.ndbm") #skip if not supported
import os
import unittest
import dbm.ndbm
from dbm.ndbm import error
class DbmTestCase(unittest.TestCase):
def setUp(self):
Reported by Pylint.
Line: 7
Column: 1
import os
import unittest
import dbm.ndbm
from dbm.ndbm import error
class DbmTestCase(unittest.TestCase):
def setUp(self):
self.filename = os_helper.TESTFN
Reported by Pylint.
Line: 9
Column: 1
import dbm.ndbm
from dbm.ndbm import error
class DbmTestCase(unittest.TestCase):
def setUp(self):
self.filename = os_helper.TESTFN
self.d = dbm.ndbm.open(self.filename, 'c')
self.d.close()
Reported by Pylint.
Line: 13
Column: 9
def setUp(self):
self.filename = os_helper.TESTFN
self.d = dbm.ndbm.open(self.filename, 'c')
self.d.close()
def tearDown(self):
for suffix in ['', '.pag', '.dir', '.db']:
os_helper.unlink(self.filename + suffix)
Reported by Pylint.
Line: 20
Column: 5
for suffix in ['', '.pag', '.dir', '.db']:
os_helper.unlink(self.filename + suffix)
def test_keys(self):
self.d = dbm.ndbm.open(self.filename, 'c')
self.assertEqual(self.d.keys(), [])
self.d['a'] = 'b'
self.d[b'bytes'] = b'data'
self.d['12345678910'] = '019237410982340912840198242'
Reported by Pylint.
Line: 40
Column: 5
self.assertEqual(self.d[b'xxx'], b'foo')
self.d.close()
def test_empty_value(self):
if dbm.ndbm.library == 'Berkeley DB':
self.skipTest("Berkeley DB doesn't distinguish the empty value "
"from the absent one")
self.d = dbm.ndbm.open(self.filename, 'c')
self.assertEqual(self.d.keys(), [])
Reported by Pylint.
Lib/test/_test_atexit.py
29 issues
Line: 12
Column: 9
class GeneralTest(unittest.TestCase):
def setUp(self):
atexit._clear()
def tearDown(self):
atexit._clear()
def assert_raises_unraisable(self, exc_type, func, *args):
Reported by Pylint.
Line: 15
Column: 9
atexit._clear()
def tearDown(self):
atexit._clear()
def assert_raises_unraisable(self, exc_type, func, *args):
with support.catch_unraisable_exception() as cm:
atexit.register(func, *args)
atexit._run_exitfuncs()
Reported by Pylint.
Line: 20
Column: 13
def assert_raises_unraisable(self, exc_type, func, *args):
with support.catch_unraisable_exception() as cm:
atexit.register(func, *args)
atexit._run_exitfuncs()
self.assertEqual(cm.unraisable.object, func)
self.assertEqual(cm.unraisable.exc_type, exc_type)
self.assertEqual(type(cm.unraisable.exc_value), exc_type)
Reported by Pylint.
Line: 41
Column: 9
atexit.register(func1, 1, 2)
atexit.register(func2)
atexit.register(func2, 3, key="value")
atexit._run_exitfuncs()
self.assertEqual(calls,
[('func2', (3,), {'key': 'value'}),
('func2', (), {}),
('func1', (1, 2), {})])
Reported by Pylint.
Line: 65
Column: 13
# bpo-10756: Make sure that an unnormalized exception is handled
# properly.
def div_zero():
1 / 0
self.assert_raises_unraisable(ZeroDivisionError, div_zero)
def test_exit(self):
self.assert_raises_unraisable(SystemExit, sys.exit)
Reported by Pylint.
Line: 77
Column: 13
def inc():
a[0] += 1
for i in range(128):
atexit.register(inc)
atexit._run_exitfuncs()
self.assertEqual(a[0], 128)
Reported by Pylint.
Line: 79
Column: 9
for i in range(128):
atexit.register(inc)
atexit._run_exitfuncs()
self.assertEqual(a[0], 128)
def test_clear(self):
a = [0]
Reported by Pylint.
Line: 89
Column: 9
a[0] += 1
atexit.register(inc)
atexit._clear()
atexit._run_exitfuncs()
self.assertEqual(a[0], 0)
def test_unregister(self):
Reported by Pylint.
Line: 90
Column: 9
atexit.register(inc)
atexit._clear()
atexit._run_exitfuncs()
self.assertEqual(a[0], 0)
def test_unregister(self):
a = [0]
Reported by Pylint.
Line: 101
Column: 13
def dec():
a[0] -= 1
for i in range(4):
atexit.register(inc)
atexit.register(dec)
atexit.unregister(inc)
atexit._run_exitfuncs()
Reported by Pylint.
Modules/_ctypes/_ctypes.c
29 issues
Line: 350
Column: 9
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
return NULL;
}
if (prefix)
strcpy(result, prefix);
else
result[0] = '\0';
strcat(result, suffix);
return result;
}
Reported by FlawFinder.
Line: 353
Column: 5
CWE codes:
120
Suggestion:
Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)
strcpy(result, prefix);
else
result[0] = '\0';
strcat(result, suffix);
return result;
}
/*
Allocate a memory block for a pep3118 format string, adding
Reported by FlawFinder.
Line: 383
Column: 9
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
}
new_prefix[0] = '\0';
if (prefix)
strcpy(new_prefix, prefix);
if (ndim > 0) {
/* Add the prefix "(shape[0],shape[1],...,shape[ndim-1])" */
strcat(new_prefix, "(");
for (k = 0; k < ndim; ++k) {
if (k < ndim-1) {
Reported by FlawFinder.
Line: 393
Column: 13
CWE codes:
120
Suggestion:
Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)
} else {
sprintf(buf, "%"PY_FORMAT_SIZE_T"d)", shape[k]);
}
strcat(new_prefix, buf);
}
}
result = _ctypes_alloc_format_string(new_prefix, suffix);
PyMem_Free(new_prefix);
return result;
Reported by FlawFinder.
Line: 3407
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
if (!mangled_name)
return NULL;
for (i = 0; i < 32; ++i) {
sprintf(mangled_name, "_%s@%d", name, i*4);
Py_BEGIN_ALLOW_THREADS
address = (PPROC)GetProcAddress(handle, mangled_name);
Py_END_ALLOW_THREADS
if (address)
return address;
Reported by FlawFinder.
Line: 369
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
{
char *new_prefix;
char *result;
char buf[32];
Py_ssize_t prefix_len;
int k;
prefix_len = 32 * ndim + 3;
if (prefix)
Reported by FlawFinder.
Line: 389
Column: 17
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
strcat(new_prefix, "(");
for (k = 0; k < ndim; ++k) {
if (k < ndim-1) {
sprintf(buf, "%"PY_FORMAT_SIZE_T"d,", shape[k]);
} else {
sprintf(buf, "%"PY_FORMAT_SIZE_T"d)", shape[k]);
}
strcat(new_prefix, buf);
}
Reported by FlawFinder.
Line: 391
Column: 17
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
if (k < ndim-1) {
sprintf(buf, "%"PY_FORMAT_SIZE_T"d,", shape[k]);
} else {
sprintf(buf, "%"PY_FORMAT_SIZE_T"d)", shape[k]);
}
strcat(new_prefix, buf);
}
}
result = _ctypes_alloc_format_string(new_prefix, suffix);
Reported by FlawFinder.
Line: 450
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (ptr == NULL) {
return NULL;
}
memcpy(ptr, self->b_ptr, self->b_size);
/* Create a Python object which calls PyMem_Free(ptr) in
its deallocator. The object will be destroyed
at _ctypes_callproc() cleanup. */
obj = (&StructParam_Type)->tp_alloc(&StructParam_Type, 0);
Reported by FlawFinder.
Line: 715
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
result = GenericPyCData_new((PyTypeObject *)type, NULL, NULL);
if (result != NULL) {
memcpy(((CDataObject *)result)->b_ptr,
(char *)buffer.buf + offset, dict->size);
}
PyBuffer_Release(&buffer);
return result;
}
Reported by FlawFinder.
Lib/test/test_zipfile64.py
29 issues
Line: 21
Column: 1
from tempfile import TemporaryFile
from test.support import os_helper
from test.support import TESTFN, requires_zlib
TESTFN2 = TESTFN + "2"
# How much time in seconds can pass before we print a 'Still working' message.
_PRINT_WORKING_MSG_INTERVAL = 60
Reported by Pylint.
Line: 6
Column: 3
# from test_zipfile
from test import support
# XXX(nnorwitz): disable this test by looking for extralargefile resource,
# which doesn't exist. This test takes over 30 minutes to run in general
# and requires more disk space than most of the buildbots.
support.requires(
'extralargefile',
'test requires loads of disk-space bytes and a long time to run'
Reported by Pylint.
Line: 1
Column: 1
# Tests of the full ZIP64 functionality of zipfile
# The support.requires call is the only reason for keeping this separate
# from test_zipfile
from test import support
# XXX(nnorwitz): disable this test by looking for extralargefile resource,
# which doesn't exist. This test takes over 30 minutes to run in general
# and requires more disk space than most of the buildbots.
support.requires(
Reported by Pylint.
Line: 14
Column: 1
'test requires loads of disk-space bytes and a long time to run'
)
import zipfile, os, unittest
import time
import sys
from tempfile import TemporaryFile
Reported by Pylint.
Line: 14
Column: 1
'test requires loads of disk-space bytes and a long time to run'
)
import zipfile, os, unittest
import time
import sys
from tempfile import TemporaryFile
Reported by Pylint.
Line: 14
Column: 1
'test requires loads of disk-space bytes and a long time to run'
)
import zipfile, os, unittest
import time
import sys
from tempfile import TemporaryFile
Reported by Pylint.
Line: 14
Column: 1
'test requires loads of disk-space bytes and a long time to run'
)
import zipfile, os, unittest
import time
import sys
from tempfile import TemporaryFile
Reported by Pylint.
Line: 15
Column: 1
)
import zipfile, os, unittest
import time
import sys
from tempfile import TemporaryFile
from test.support import os_helper
Reported by Pylint.
Line: 16
Column: 1
import zipfile, os, unittest
import time
import sys
from tempfile import TemporaryFile
from test.support import os_helper
from test.support import TESTFN, requires_zlib
Reported by Pylint.
Line: 18
Column: 1
import time
import sys
from tempfile import TemporaryFile
from test.support import os_helper
from test.support import TESTFN, requires_zlib
TESTFN2 = TESTFN + "2"
Reported by Pylint.
Tools/c-analyzer/c_parser/match.py
29 issues
Line: 3
Column: 1
import re
from . import info as _info
from .parser._regexes import SIMPLE_TYPE
_KIND = _info.KIND
Reported by Pylint.
Line: 4
Column: 1
import re
from . import info as _info
from .parser._regexes import SIMPLE_TYPE
_KIND = _info.KIND
Reported by Pylint.
Line: 57
Column: 3
def _is_funcptr(declstr):
if not declstr:
return None
# XXX Support "(<name>*)(".
return '(*)(' in declstr.replace(' ', '')
def is_forward_decl(decl):
if decl.kind is _KIND.TYPEDEF:
Reported by Pylint.
Line: 67
Column: 3
elif is_type_decl(decl):
return not decl.data
elif decl.kind is _KIND.FUNCTION:
# XXX This doesn't work with ParsedItem.
return decl.signature.isforward
elif decl.kind is _KIND.VARIABLE:
# No var decls are considered forward (or all are...).
return False
else:
Reported by Pylint.
Line: 127
Column: 17
def filter_by_kind(items, kind):
if kind == 'type':
kinds = _KIND._TYPE_DECLS
elif kind == 'decl':
kinds = _KIND._TYPE_DECLS
try:
okay = kind in _KIND
except TypeError:
Reported by Pylint.
Line: 129
Column: 17
if kind == 'type':
kinds = _KIND._TYPE_DECLS
elif kind == 'decl':
kinds = _KIND._TYPE_DECLS
try:
okay = kind in _KIND
except TypeError:
kinds = set(kind)
else:
Reported by Pylint.
Line: 167
Column: 13
try:
collated[item.kind].append(item)
except KeyError:
raise ValueError(f'unsupported kind in {item!r}')
return collated
def group_by_kinds(items):
# Collate into kind groups (decl, type, etc.).
Reported by Pylint.
Line: 1
Column: 1
import re
from . import info as _info
from .parser._regexes import SIMPLE_TYPE
_KIND = _info.KIND
Reported by Pylint.
Line: 10
Column: 1
_KIND = _info.KIND
def match_storage(decl, expected):
default = _info.get_default_storage(decl)
#assert default
if expected is None:
expected = {default}
elif isinstance(expected, str):
Reported by Pylint.
Line: 28
Column: 1
##################################
# decl matchers
def is_type_decl(item):
return _KIND.is_type_decl(item.kind)
def is_decl(item):
return _KIND.is_decl(item.kind)
Reported by Pylint.
Lib/email/feedparser.py
29 issues
Line: 269
Column: 17
yield NeedMoreData
continue
break
msg = self._pop_message()
# We need to pop the EOF matcher in order to tell if we're at
# the end of the current file, not the end of the last block
# of message headers.
self._input.pop_eof_matcher()
# The input stream must be sitting at the newline or at the
Reported by Pylint.
Line: 404
Column: 35
end = len(mo.group(0))
self._last.epilogue = epilogue[:-end]
else:
payload = self._last._payload
if isinstance(payload, str):
mo = NLCRE_eol.search(payload)
if mo:
payload = payload[:-len(mo.group(0))]
self._last._payload = payload
Reported by Pylint.
Line: 409
Column: 33
mo = NLCRE_eol.search(payload)
if mo:
payload = payload[:-len(mo.group(0))]
self._last._payload = payload
self._input.pop_eof_matcher()
self._pop_message()
# Set the multipart up for newline cleansing, which will
# happen if we're in a nested multipart.
self._last = self._cur
Reported by Pylint.
Line: 45
Column: 1
class BufferedSubFile(object):
"""A file-ish object that can have new data loaded into it.
You can also push and pop line-matching predicates onto a stack. When the
current predicate matches the current line, a false EOF response
(i.e. empty string) is returned instead. This lets the parser adhere to a
Reported by Pylint.
Line: 64
Column: 5
# A flag indicating whether the file has been closed or not.
self._closed = False
def push_eof_matcher(self, pred):
self._eofstack.append(pred)
def pop_eof_matcher(self):
return self._eofstack.pop()
Reported by Pylint.
Line: 67
Column: 5
def push_eof_matcher(self, pred):
self._eofstack.append(pred)
def pop_eof_matcher(self):
return self._eofstack.pop()
def close(self):
# Don't forget any trailing partial line.
self._partial.seek(0)
Reported by Pylint.
Line: 70
Column: 5
def pop_eof_matcher(self):
return self._eofstack.pop()
def close(self):
# Don't forget any trailing partial line.
self._partial.seek(0)
self.pushlines(self._partial.readlines())
self._partial.seek(0)
self._partial.truncate()
Reported by Pylint.
Line: 78
Column: 5
self._partial.truncate()
self._closed = True
def readline(self):
if not self._lines:
if self._closed:
return ''
return NeedMoreData
# Pop the line off the stack and see if it matches the current
Reported by Pylint.
Line: 96
Column: 5
return ''
return line
def unreadline(self, line):
# Let the consumer push a line back into the buffer.
assert line is not NeedMoreData
self._lines.appendleft(line)
def push(self, data):
Reported by Pylint.
Line: 98
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def unreadline(self, line):
# Let the consumer push a line back into the buffer.
assert line is not NeedMoreData
self._lines.appendleft(line)
def push(self, data):
"""Push some new data into this object."""
self._partial.write(data)
Reported by Bandit.
Lib/collections/abc.py
29 issues
Line: 1
Column: 1
from _collections_abc import *
from _collections_abc import __all__
from _collections_abc import _CallableGenericAlias
Reported by Pylint.
Line: 1
Column: 1
from _collections_abc import *
from _collections_abc import __all__
from _collections_abc import _CallableGenericAlias
Reported by Pylint.
Line: 1
Column: 1
from _collections_abc import *
from _collections_abc import __all__
from _collections_abc import _CallableGenericAlias
Reported by Pylint.
Line: 1
Column: 1
from _collections_abc import *
from _collections_abc import __all__
from _collections_abc import _CallableGenericAlias
Reported by Pylint.
Line: 1
Column: 1
from _collections_abc import *
from _collections_abc import __all__
from _collections_abc import _CallableGenericAlias
Reported by Pylint.
Line: 1
Column: 1
from _collections_abc import *
from _collections_abc import __all__
from _collections_abc import _CallableGenericAlias
Reported by Pylint.
Line: 1
Column: 1
from _collections_abc import *
from _collections_abc import __all__
from _collections_abc import _CallableGenericAlias
Reported by Pylint.
Line: 1
Column: 1
from _collections_abc import *
from _collections_abc import __all__
from _collections_abc import _CallableGenericAlias
Reported by Pylint.
Line: 1
Column: 1
from _collections_abc import *
from _collections_abc import __all__
from _collections_abc import _CallableGenericAlias
Reported by Pylint.
Line: 1
Column: 1
from _collections_abc import *
from _collections_abc import __all__
from _collections_abc import _CallableGenericAlias
Reported by Pylint.
Doc/tools/extensions/c_annotations.py
29 issues
Line: 23
Column: 1
"""
from os import path
from docutils import nodes
from docutils.parsers.rst import directives
from docutils.parsers.rst import Directive
from docutils.statemachine import StringList
import csv
Reported by Pylint.
Line: 24
Column: 1
from os import path
from docutils import nodes
from docutils.parsers.rst import directives
from docutils.parsers.rst import Directive
from docutils.statemachine import StringList
import csv
from sphinx import addnodes
Reported by Pylint.
Line: 25
Column: 1
from os import path
from docutils import nodes
from docutils.parsers.rst import directives
from docutils.parsers.rst import Directive
from docutils.statemachine import StringList
import csv
from sphinx import addnodes
from sphinx.domains.c import CObject
Reported by Pylint.
Line: 26
Column: 1
from docutils import nodes
from docutils.parsers.rst import directives
from docutils.parsers.rst import Directive
from docutils.statemachine import StringList
import csv
from sphinx import addnodes
from sphinx.domains.c import CObject
Reported by Pylint.
Line: 29
Column: 1
from docutils.statemachine import StringList
import csv
from sphinx import addnodes
from sphinx.domains.c import CObject
REST_ROLE_MAP = {
'function': 'func',
Reported by Pylint.
Line: 30
Column: 1
import csv
from sphinx import addnodes
from sphinx.domains.c import CObject
REST_ROLE_MAP = {
'function': 'func',
'var': 'data',
Reported by Pylint.
Line: 33
Column: 17
from sphinx.domains.c import CObject
REST_ROLE_MAP = {
'function': 'func',
'var': 'data',
'type': 'type',
'macro': 'macro',
'type': 'type',
Reported by Pylint.
Line: 62
Column: 27
parts = line.split(":", 4)
if len(parts) != 5:
raise ValueError("Wrong field count in %r" % line)
function, type, arg, refcount, comment = parts
# Get the entry, creating it if needed:
try:
entry = self.refcount_data[function]
except KeyError:
entry = self.refcount_data[function] = RCEntry(function)
Reported by Pylint.
Line: 62
Column: 48
parts = line.split(":", 4)
if len(parts) != 5:
raise ValueError("Wrong field count in %r" % line)
function, type, arg, refcount, comment = parts
# Get the entry, creating it if needed:
try:
entry = self.refcount_data[function]
except KeyError:
entry = self.refcount_data[function] = RCEntry(function)
Reported by Pylint.
Line: 83
Column: 17
self.stable_abi_data = {}
with open(stable_abi_file, 'r') as fp:
for record in csv.DictReader(fp):
role = record['role']
name = record['name']
self.stable_abi_data[name] = record
def add_annotations(self, app, doctree):
for node in doctree.traverse(addnodes.desc_content):
Reported by Pylint.