The following issues were found

Lib/wave.py
97 issues
self._convert is not callable
Error

Line: 246 Column: 20

                      if self._sampwidth != 1 and sys.byteorder == 'big':
            data = audioop.byteswap(data, self._sampwidth)
        if self._convert and data:
            data = self._convert(data)
        self._soundpos = self._soundpos + len(data) // (self._nchannels * self._sampwidth)
        return data

    #
    # Internal methods.

            

Reported by Pylint.

self._convert is not callable
Error

Line: 429 Column: 20

                      self._ensure_header_written(len(data))
        nframes = len(data) // (self._sampwidth * self._nchannels)
        if self._convert:
            data = self._convert(data)
        if self._sampwidth != 1 and sys.byteorder == 'big':
            data = audioop.byteswap(data, self._sampwidth)
        self._file.write(data)
        self._datawritten += len(data)
        self._nframeswritten = self._nframeswritten + nframes

            

Reported by Pylint.

Attribute '_data_seek_needed' defined outside __init__
Error

Line: 185 Column: 9

                      return self._file

    def rewind(self):
        self._data_seek_needed = 1
        self._soundpos = 0

    def close(self):
        self._file = None
        file = self._i_opened_the_file

            

Reported by Pylint.

Attribute '_soundpos' defined outside __init__
Error

Line: 186 Column: 9

              
    def rewind(self):
        self._data_seek_needed = 1
        self._soundpos = 0

    def close(self):
        self._file = None
        file = self._i_opened_the_file
        if file:

            

Reported by Pylint.

Attribute '_file' defined outside __init__
Error

Line: 189 Column: 9

                      self._soundpos = 0

    def close(self):
        self._file = None
        file = self._i_opened_the_file
        if file:
            self._i_opened_the_file = None
            file.close()


            

Reported by Pylint.

Redefining built-in 'id'
Error

Line: 224 Column: 23

                  def getmarkers(self):
        return None

    def getmark(self, id):
        raise Error('no marks')

    def setpos(self, pos):
        if pos < 0 or pos > self._nframes:
            raise Error('position not in range')

            

Reported by Pylint.

Attribute '_soundpos' defined outside __init__
Error

Line: 230 Column: 9

                  def setpos(self, pos):
        if pos < 0 or pos > self._nframes:
            raise Error('position not in range')
        self._soundpos = pos
        self._data_seek_needed = 1

    def readframes(self, nframes):
        if self._data_seek_needed:
            self._data_chunk.seek(0, 0)

            

Reported by Pylint.

Attribute '_data_seek_needed' defined outside __init__
Error

Line: 231 Column: 9

                      if pos < 0 or pos > self._nframes:
            raise Error('position not in range')
        self._soundpos = pos
        self._data_seek_needed = 1

    def readframes(self, nframes):
        if self._data_seek_needed:
            self._data_chunk.seek(0, 0)
            pos = self._soundpos * self._framesize

            

Reported by Pylint.

Attribute '_data_seek_needed' defined outside __init__
Error

Line: 239 Column: 13

                          pos = self._soundpos * self._framesize
            if pos:
                self._data_chunk.seek(pos, 0)
            self._data_seek_needed = 0
        if nframes == 0:
            return b''
        data = self._data_chunk.read(nframes * self._framesize)
        if self._sampwidth != 1 and sys.byteorder == 'big':
            data = audioop.byteswap(data, self._sampwidth)

            

Reported by Pylint.

Attribute '_soundpos' defined outside __init__
Error

Line: 247 Column: 9

                          data = audioop.byteswap(data, self._sampwidth)
        if self._convert and data:
            data = self._convert(data)
        self._soundpos = self._soundpos + len(data) // (self._nchannels * self._sampwidth)
        return data

    #
    # Internal methods.
    #

            

Reported by Pylint.

Lib/test/audit-tests.py
97 issues
Unable to import 'winreg'
Error

Line: 309 Column: 5

              

def test_winreg():
    from winreg import OpenKey, EnumKey, CloseKey, HKEY_LOCAL_MACHINE

    def hook(event, args):
        if not event.startswith("winreg."):
            return
        print(event, *args)

            

Reported by Pylint.

Catching too general exception BaseException
Error

Line: 76 Column: 12

                  try:
        yield
        assert False, f"expected {ex_type}"
    except BaseException as ex:
        if isinstance(ex, AssertionError):
            raise
        assert type(ex) is ex_type, f"{ex} should be {ex_type}"



            

Reported by Pylint.

Unused variable 'hook1'
Error

Line: 104 Column: 14

                  with assertRaises(BaseException):
        with TestHook(
            raise_on_events="sys.addaudithook", exc_type=BaseException
        ) as hook1:
            # Adding this next hook should raise BaseException
            with TestHook() as hook2:
                pass



            

Reported by Pylint.

Unused variable 'hook2'
Error

Line: 106 Column: 32

                          raise_on_events="sys.addaudithook", exc_type=BaseException
        ) as hook1:
            # Adding this next hook should raise BaseException
            with TestHook() as hook2:
                pass


def test_marshal():
    import marshal

            

Reported by Pylint.

Deserialization with the marshal module is possibly dangerous.
Security blacklist

Line: 116
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b302-marshal

                  payload = marshal.dumps(o)

    with TestHook() as hook:
        assertEqual(o, marshal.loads(marshal.dumps(o)))

        try:
            with open("test-marshal.bin", "wb") as f:
                marshal.dump(o, f)
            with open("test-marshal.bin", "rb") as f:

            

Reported by Bandit.

Deserialization with the marshal module is possibly dangerous.
Security blacklist

Line: 122
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b302-marshal

                          with open("test-marshal.bin", "wb") as f:
                marshal.dump(o, f)
            with open("test-marshal.bin", "rb") as f:
                assertEqual(o, marshal.load(f))
        finally:
            os.unlink("test-marshal.bin")

    actual = [(a[0], a[1]) for e, a in hook.seen if e == "marshal.dumps"]
    assertSequenceEqual(actual, [(o, marshal.version)] * 2)

            

Reported by Bandit.

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Security blacklist

Line: 147
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle

                  payload_2 = pickle.dumps(("a", "b", "c", 1, 2, 3))

    # Before we add the hook, ensure our malicious pickle loads
    assertEqual("Pwned!", pickle.loads(payload_1))

    with TestHook(raise_on_events="pickle.find_class") as hook:
        with assertRaises(RuntimeError):
            # With the hook enabled, loading globals is not allowed
            pickle.loads(payload_1)

            

Reported by Bandit.

Unused variable 'hook'
Error

Line: 149 Column: 59

                  # Before we add the hook, ensure our malicious pickle loads
    assertEqual("Pwned!", pickle.loads(payload_1))

    with TestHook(raise_on_events="pickle.find_class") as hook:
        with assertRaises(RuntimeError):
            # With the hook enabled, loading globals is not allowed
            pickle.loads(payload_1)
        # pickles with no globals are okay
        pickle.loads(payload_2)

            

Reported by Pylint.

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Security blacklist

Line: 152
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle

                  with TestHook(raise_on_events="pickle.find_class") as hook:
        with assertRaises(RuntimeError):
            # With the hook enabled, loading globals is not allowed
            pickle.loads(payload_1)
        # pickles with no globals are okay
        pickle.loads(payload_2)


def test_monkeypatch():

            

Reported by Bandit.

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Security blacklist

Line: 154
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle

                          # With the hook enabled, loading globals is not allowed
            pickle.loads(payload_1)
        # pickles with no globals are okay
        pickle.loads(payload_2)


def test_monkeypatch():
    class A:
        pass

            

Reported by Bandit.

Lib/test/test_strtod.py
96 issues
Unused variable 'i'
Error

Line: 115 Column: 17

                          lower = -(-2**53//5**k)
            if lower % 2 == 0:
                lower += 1
            for i in range(TEST_SIZE):
                # Select a random odd n in [2**53/5**k,
                # 2**54/5**k). Then n * 10**k gives a halfway case
                # with small number of significant digits.
                n, e = random.randrange(lower, upper, 2), k


            

Reported by Pylint.

Unused variable 'i'
Error

Line: 151 Column: 13

              
    def test_halfway_cases(self):
        # test halfway cases for the round-half-to-even rule
        for i in range(100 * TEST_SIZE):
            # bit pattern for a random finite positive (or +0.0) float
            bits = random.randrange(2047*2**52)

            # convert bit pattern to a number of the form m * 2**e
            e, m = divmod(bits, 2**52)

            

Reported by Pylint.

Unused variable 'j'
Error

Line: 186 Column: 17

                          (0, -327, 4941),                     # zero
            ]
        for n, e, u in boundaries:
            for j in range(1000):
                digits = n + random.randrange(-3*u, 3*u)
                exponent = e
                s = '{}e{}'.format(digits, exponent)
                self.check_strtod(s)
                n *= 10

            

Reported by Pylint.

Unused variable 'j'
Error

Line: 201 Column: 17

                      # with n
        for exponent in range(-400, -320):
            base = 10**-exponent // 2**1075
            for j in range(TEST_SIZE):
                digits = base + random.randrange(-1000, 1000)
                s = '{}e{}'.format(digits, exponent)
                self.check_strtod(s)

    def test_bigcomp(self):

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 209 Column: 17

                  def test_bigcomp(self):
        for ndigs in 5, 10, 14, 15, 16, 17, 18, 19, 20, 40, 41, 50:
            dig10 = 10**ndigs
            for i in range(10 * TEST_SIZE):
                digits = random.randrange(dig10)
                exponent = random.randrange(-400, 400)
                s = '{}e{}'.format(digits, exponent)
                self.check_strtod(s)


            

Reported by Pylint.

Unused variable 'i'
Error

Line: 222 Column: 13

              
        # put together random short valid strings
        # \d*[.\d*]?e
        for i in range(1000):
            for j in range(TEST_SIZE):
                s = random.choice(signs)
                intpart_len = random.randrange(5)
                s += ''.join(random.choice(digits) for _ in range(intpart_len))
                if random.choice([True, False]):

            

Reported by Pylint.

Unused variable 'j'
Error

Line: 223 Column: 17

                      # put together random short valid strings
        # \d*[.\d*]?e
        for i in range(1000):
            for j in range(TEST_SIZE):
                s = random.choice(signs)
                intpart_len = random.randrange(5)
                s += ''.join(random.choice(digits) for _ in range(intpart_len))
                if random.choice([True, False]):
                    s += '.'

            

Reported by Pylint.

Access to a protected member _2G of a client class
Error

Line: 251 Column: 35

                                  else:
                        assert False, "expected ValueError"

    @test.support.bigmemtest(size=test.support._2G+10, memuse=3, dry_run=False)
    def test_oversized_digit_strings(self, maxsize):
        # Input string whose length doesn't fit in an INT.
        s = "1." + "1" * maxsize
        with self.assertRaises(ValueError):
            float(s)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Tests for the correctly-rounded string -> float conversions
# introduced in Python 2.7 and 3.1.

import random
import unittest
import re
import sys
import test.support


            

Reported by Pylint.

Argument name "s" doesn't conform to snake_case naming style
Error

Line: 27 Column: 1

              
# Pure Python version of correctly rounded string->float conversion.
# Avoids any use of floating-point by returning the result as a hex string.
def strtod(s, mant_dig=53, min_exp = -1021, max_exp = 1024):
    """Convert a finite decimal string to a hex string representing an
    IEEE 754 binary64 float.  Return 'inf' or '-inf' on overflow.
    This function makes no use of floating-point arithmetic at any
    stage."""


            

Reported by Pylint.

Lib/ctypes/test/test_init.py
96 issues
Unused import c_long from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class X(Structure):
    _fields_ = [("a", c_int),
                ("b", c_int)]
    new_was_called = False

    def __new__(cls):

            

Reported by Pylint.

Unused import LittleEndianStructure from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class X(Structure):
    _fields_ = [("a", c_int),
                ("b", c_int)]
    new_was_called = False

    def __new__(cls):

            

Reported by Pylint.

Unused import BigEndianStructure from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class X(Structure):
    _fields_ = [("a", c_int),
                ("b", c_int)]
    new_was_called = False

    def __new__(cls):

            

Reported by Pylint.

Unused import set_last_error from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class X(Structure):
    _fields_ = [("a", c_int),
                ("b", c_int)]
    new_was_called = False

    def __new__(cls):

            

Reported by Pylint.

Unused import get_last_error from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class X(Structure):
    _fields_ = [("a", c_int),
                ("b", c_int)]
    new_was_called = False

    def __new__(cls):

            

Reported by Pylint.

Unused import pointer from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class X(Structure):
    _fields_ = [("a", c_int),
                ("b", c_int)]
    new_was_called = False

    def __new__(cls):

            

Reported by Pylint.

Unused import POINTER from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class X(Structure):
    _fields_ = [("a", c_int),
                ("b", c_int)]
    new_was_called = False

    def __new__(cls):

            

Reported by Pylint.

Unused import set_errno from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class X(Structure):
    _fields_ = [("a", c_int),
                ("b", c_int)]
    new_was_called = False

    def __new__(cls):

            

Reported by Pylint.

Unused import get_errno from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class X(Structure):
    _fields_ = [("a", c_int),
                ("b", c_int)]
    new_was_called = False

    def __new__(cls):

            

Reported by Pylint.

Unused import resize from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class X(Structure):
    _fields_ = [("a", c_int),
                ("b", c_int)]
    new_was_called = False

    def __new__(cls):

            

Reported by Pylint.

Lib/test/test_platform.py
96 issues
Unable to import '_winapi'
Error

Line: 374 Column: 13

                      elif sys.platform == "win32" and not os.path.exists(sys.executable):
            # App symlink appears to not exist, but we want the
            # real executable here anyway
            import _winapi
            executable = _winapi.GetModuleFileName(0)
        else:
            executable = sys.executable
        platform.libc_ver(executable)


            

Reported by Pylint.

Access to a protected member _platform_cache of a client class
Error

Line: 73 Column: 9

              
class PlatformTest(unittest.TestCase):
    def clear_caches(self):
        platform._platform_cache.clear()
        platform._sys_version_cache.clear()
        platform._uname_cache = None
        platform._os_release_cache = None

    def test_architecture(self):

            

Reported by Pylint.

Access to a protected member _sys_version_cache of a client class
Error

Line: 74 Column: 9

              class PlatformTest(unittest.TestCase):
    def clear_caches(self):
        platform._platform_cache.clear()
        platform._sys_version_cache.clear()
        platform._uname_cache = None
        platform._os_release_cache = None

    def test_architecture(self):
        res = platform.architecture()

            

Reported by Pylint.

Access to a protected member _uname_cache of a client class
Error

Line: 75 Column: 9

                  def clear_caches(self):
        platform._platform_cache.clear()
        platform._sys_version_cache.clear()
        platform._uname_cache = None
        platform._os_release_cache = None

    def test_architecture(self):
        res = platform.architecture()


            

Reported by Pylint.

Access to a protected member _os_release_cache of a client class
Error

Line: 76 Column: 9

                      platform._platform_cache.clear()
        platform._sys_version_cache.clear()
        platform._uname_cache = None
        platform._os_release_cache = None

    def test_architecture(self):
        res = platform.architecture()

    @os_helper.skip_unless_symlink

            

Reported by Pylint.

Unused variable 'res'
Error

Line: 79 Column: 9

                      platform._os_release_cache = None

    def test_architecture(self):
        res = platform.architecture()

    @os_helper.skip_unless_symlink
    def test_architecture_via_symlink(self): # issue3762
        with support.PythonSymlink() as py:
            cmd = "-c", "import platform; print(platform.architecture())"

            

Reported by Pylint.

Unused variable 'res'
Error

Line: 90 Column: 17

                  def test_platform(self):
        for aliased in (False, True):
            for terse in (False, True):
                res = platform.platform(aliased, terse)

    def test_system(self):
        res = platform.system()

    def test_node(self):

            

Reported by Pylint.

Unused variable 'res'
Error

Line: 93 Column: 9

                              res = platform.platform(aliased, terse)

    def test_system(self):
        res = platform.system()

    def test_node(self):
        res = platform.node()

    def test_release(self):

            

Reported by Pylint.

Unused variable 'res'
Error

Line: 96 Column: 9

                      res = platform.system()

    def test_node(self):
        res = platform.node()

    def test_release(self):
        res = platform.release()

    def test_version(self):

            

Reported by Pylint.

Unused variable 'res'
Error

Line: 99 Column: 9

                      res = platform.node()

    def test_release(self):
        res = platform.release()

    def test_version(self):
        res = platform.version()

    def test_machine(self):

            

Reported by Pylint.

Lib/test/test_cgi.py
95 issues
Catching too general exception Exception
Error

Line: 50 Column: 12

                      raise ValueError("unknown method: %s" % method)
    try:
        return cgi.parse(fp, env, strict_parsing=1)
    except Exception as err:
        return ComparableException(err)

parse_strict_test_cases = [
    ("", ValueError("bad query field: ''")),
    ("&", ValueError("bad query field: ''")),

            

Reported by Pylint.

Redefining built-in 'list'
Error

Line: 98 Column: 16

              def norm(seq):
    return sorted(seq, key=repr)

def first_elts(list):
    return [p[0] for p in list]

def first_second_elts(list):
    return [(p[0], p[1][0]) for p in list]


            

Reported by Pylint.

Redefining built-in 'list'
Error

Line: 101 Column: 23

              def first_elts(list):
    return [p[0] for p in list]

def first_second_elts(list):
    return [(p[0], p[1][0]) for p in list]

def gen_result(data, environ):
    encoding = 'latin-1'
    fake_stdin = BytesIO(data.encode(encoding))

            

Reported by Pylint.

Redefining name 'POSTDATA' from outer scope (line 585)
Error

Line: 128 Column: 9

                      self.assertEqual(result, expected)

    def test_parse_multipart_without_content_length(self):
        POSTDATA = '''--JfISa01
Content-Disposition: form-data; name="submit-name"

just a string

--JfISa01--

            

Reported by Pylint.

Redefining name 'BOUNDARY' from outer scope (line 583)
Error

Line: 142 Column: 9

                      self.assertEqual(result, expected)

    def test_parse_multipart_invalid_encoding(self):
        BOUNDARY = "JfISa01"
        POSTDATA = """--JfISa01
Content-Disposition: form-data; name="submit-name"
Content-Length: 3

\u2603

            

Reported by Pylint.

Redefining name 'POSTDATA' from outer scope (line 585)
Error

Line: 143 Column: 9

              
    def test_parse_multipart_invalid_encoding(self):
        BOUNDARY = "JfISa01"
        POSTDATA = """--JfISa01
Content-Disposition: form-data; name="submit-name"
Content-Length: 3

\u2603
--JfISa01"""

            

Reported by Pylint.

Redefining name 'BOUNDARY' from outer scope (line 583)
Error

Line: 373 Column: 9

                              self.assertEqual(got, exp)

    def test_fieldstorage_part_content_length(self):
        BOUNDARY = "JfISa01"
        POSTDATA = """--JfISa01
Content-Disposition: form-data; name="submit-name"
Content-Length: 5

Larry

            

Reported by Pylint.

Redefining name 'POSTDATA' from outer scope (line 585)
Error

Line: 374 Column: 9

              
    def test_fieldstorage_part_content_length(self):
        BOUNDARY = "JfISa01"
        POSTDATA = """--JfISa01
Content-Disposition: form-data; name="submit-name"
Content-Length: 5

Larry
--JfISa01"""

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import cgi
import os
import sys
import tempfile
import unittest
from collections import namedtuple
from io import StringIO, BytesIO
from test import support
from test.support import warnings_helper

            

Reported by Pylint.

Missing class docstring
Error

Line: 11 Column: 1

              from test import support
from test.support import warnings_helper

class HackedSysModule:
    # The regression test will have real values in sys.argv, which
    # will completely confuse the test of the cgi module
    argv = []
    stdin = sys.stdin


            

Reported by Pylint.

Tools/pynche/ColorDB.py
95 issues
Instance of 'ColorDB' has no '_re' member
Error

Line: 54 Column: 18

                      self.__allnames = None
        for line in fp:
            # get this compiled regular expression from derived class
            mo = self._re.match(line)
            if not mo:
                print('Error in', fp.name, ' line', lineno, file=sys.stderr)
                lineno += 1
                continue
            # extract the red, green, blue, and name

            

Reported by Pylint.

Unused import DynamicClassAttribute from wildcard import
Error

Line: 25 Column: 1

              
import sys
import re
from types import *

class BadColor(Exception):
    pass

DEFAULT_DB = None

            

Reported by Pylint.

Unused import FrameType from wildcard import
Error

Line: 25 Column: 1

              
import sys
import re
from types import *

class BadColor(Exception):
    pass

DEFAULT_DB = None

            

Reported by Pylint.

Unused import TracebackType from wildcard import
Error

Line: 25 Column: 1

              
import sys
import re
from types import *

class BadColor(Exception):
    pass

DEFAULT_DB = None

            

Reported by Pylint.

Unused import tb from wildcard import
Error

Line: 25 Column: 1

              
import sys
import re
from types import *

class BadColor(Exception):
    pass

DEFAULT_DB = None

            

Reported by Pylint.

Unused import ModuleType from wildcard import
Error

Line: 25 Column: 1

              
import sys
import re
from types import *

class BadColor(Exception):
    pass

DEFAULT_DB = None

            

Reported by Pylint.

Unused import ClassMethodDescriptorType from wildcard import
Error

Line: 25 Column: 1

              
import sys
import re
from types import *

class BadColor(Exception):
    pass

DEFAULT_DB = None

            

Reported by Pylint.

Unused import MethodDescriptorType from wildcard import
Error

Line: 25 Column: 1

              
import sys
import re
from types import *

class BadColor(Exception):
    pass

DEFAULT_DB = None

            

Reported by Pylint.

Unused import MethodWrapperType from wildcard import
Error

Line: 25 Column: 1

              
import sys
import re
from types import *

class BadColor(Exception):
    pass

DEFAULT_DB = None

            

Reported by Pylint.

Unused import WrapperDescriptorType from wildcard import
Error

Line: 25 Column: 1

              
import sys
import re
from types import *

class BadColor(Exception):
    pass

DEFAULT_DB = None

            

Reported by Pylint.

Lib/test/test_peg_generator/test_pegen.py
95 issues
Unable to import 'pegen.grammar_parser'
Error

Line: 13 Column: 5

              
test_tools.skip_if_missing("peg_generator")
with test_tools.imports_under_tool("peg_generator"):
    from pegen.grammar_parser import GeneratedParser as GrammarParser
    from pegen.testutil import parse_string, generate_parser, make_parser
    from pegen.grammar import GrammarVisitor, GrammarError, Grammar
    from pegen.grammar_visualizer import ASTGrammarPrinter
    from pegen.parser import Parser
    from pegen.python_generator import PythonParserGenerator

            

Reported by Pylint.

Unable to import 'pegen.testutil'
Error

Line: 14 Column: 5

              test_tools.skip_if_missing("peg_generator")
with test_tools.imports_under_tool("peg_generator"):
    from pegen.grammar_parser import GeneratedParser as GrammarParser
    from pegen.testutil import parse_string, generate_parser, make_parser
    from pegen.grammar import GrammarVisitor, GrammarError, Grammar
    from pegen.grammar_visualizer import ASTGrammarPrinter
    from pegen.parser import Parser
    from pegen.python_generator import PythonParserGenerator


            

Reported by Pylint.

Unable to import 'pegen.grammar'
Error

Line: 15 Column: 5

              with test_tools.imports_under_tool("peg_generator"):
    from pegen.grammar_parser import GeneratedParser as GrammarParser
    from pegen.testutil import parse_string, generate_parser, make_parser
    from pegen.grammar import GrammarVisitor, GrammarError, Grammar
    from pegen.grammar_visualizer import ASTGrammarPrinter
    from pegen.parser import Parser
    from pegen.python_generator import PythonParserGenerator



            

Reported by Pylint.

Unable to import 'pegen.grammar_visualizer'
Error

Line: 16 Column: 5

                  from pegen.grammar_parser import GeneratedParser as GrammarParser
    from pegen.testutil import parse_string, generate_parser, make_parser
    from pegen.grammar import GrammarVisitor, GrammarError, Grammar
    from pegen.grammar_visualizer import ASTGrammarPrinter
    from pegen.parser import Parser
    from pegen.python_generator import PythonParserGenerator


class TestPegen(unittest.TestCase):

            

Reported by Pylint.

Unable to import 'pegen.parser'
Error

Line: 17 Column: 5

                  from pegen.testutil import parse_string, generate_parser, make_parser
    from pegen.grammar import GrammarVisitor, GrammarError, Grammar
    from pegen.grammar_visualizer import ASTGrammarPrinter
    from pegen.parser import Parser
    from pegen.python_generator import PythonParserGenerator


class TestPegen(unittest.TestCase):
    def test_parse_grammar(self) -> None:

            

Reported by Pylint.

Unable to import 'pegen.python_generator'
Error

Line: 18 Column: 5

                  from pegen.grammar import GrammarVisitor, GrammarError, Grammar
    from pegen.grammar_visualizer import ASTGrammarPrinter
    from pegen.parser import Parser
    from pegen.python_generator import PythonParserGenerator


class TestPegen(unittest.TestCase):
    def test_parse_grammar(self) -> None:
        grammar_source = """

            

Reported by Pylint.

Undefined variable 'Type'
Error

Line: 541 Column: 23

                      genr.generate("<string>")
        ns: Dict[str, Any] = {}
        exec(out.getvalue(), ns)
        parser_class: Type[Parser] = ns["GeneratedParser"]
        node = parse_string("D A C A E", parser_class)

        self.assertEqual(
            node,
            [

            

Reported by Pylint.

Instance of 'TestGrammarVisitor' has no 'assertEqual' member
Error

Line: 929 Column: 9

              
        visitor.visit(rules)

        self.assertEqual(visitor.n_nodes, 6)

    def test_parse_or_grammar(self) -> None:
        grammar = """
        start: rule
        rule: 'a' | 'b'

            

Reported by Pylint.

Instance of 'TestGrammarVisitor' has no 'assertEqual' member
Error

Line: 946 Column: 9

                      #                  Alt/NamedItem/StringLeaf -> 3
        #                  Alt/NamedItem/StringLeaf -> 3

        self.assertEqual(visitor.n_nodes, 14)

    def test_parse_repeat1_grammar(self) -> None:
        grammar = """
        start: 'a'+
        """

            

Reported by Pylint.

Instance of 'TestGrammarVisitor' has no 'assertEqual' member
Error

Line: 958 Column: 9

                      visitor.visit(rules)

        # Grammar/Rule/Rhs/Alt/NamedItem/Repeat1/StringLeaf -> 6
        self.assertEqual(visitor.n_nodes, 7)

    def test_parse_repeat0_grammar(self) -> None:
        grammar = """
        start: 'a'*
        """

            

Reported by Pylint.

Lib/distutils/ccompiler.py
94 issues
Instance of 'CCompiler' has no 'executables' member
Error

Line: 118 Column: 20

                      # named library files) to include on any link
        self.objects = []

        for key in self.executables.keys():
            self.set_executable(key, self.executables[key])

    def set_executables(self, **kwargs):
        """Define the executables (and options for them) that will be run
        to perform the various stages of compilation.  The exact set of

            

Reported by Pylint.

Instance of 'CCompiler' has no 'executables' member
Error

Line: 119 Column: 38

                      self.objects = []

        for key in self.executables.keys():
            self.set_executable(key, self.executables[key])

    def set_executables(self, **kwargs):
        """Define the executables (and options for them) that will be run
        to perform the various stages of compilation.  The exact set of
        executables that may be specified here depends on the compiler

            

Reported by Pylint.

Instance of 'CCompiler' has no 'executables' member
Error

Line: 148 Column: 27

                      # basically the same things with Unix C compilers.

        for key in kwargs:
            if key not in self.executables:
                raise ValueError("unknown executable '%s' for class %s" %
                      (key, self.__class__.__name__))
            self.set_executable(key, kwargs[key])

    def set_executable(self, key, value):

            

Reported by Pylint.

Unused import LibError from wildcard import
Error

Line: 7 Column: 1

              for the Distutils compiler abstraction model."""

import sys, os, re
from distutils.errors import *
from distutils.spawn import spawn
from distutils.file_util import move_file
from distutils.dir_util import mkpath
from distutils.dep_util import newer_group
from distutils.util import split_quoted, execute

            

Reported by Pylint.

Unused import DistutilsArgError from wildcard import
Error

Line: 7 Column: 1

              for the Distutils compiler abstraction model."""

import sys, os, re
from distutils.errors import *
from distutils.spawn import spawn
from distutils.file_util import move_file
from distutils.dir_util import mkpath
from distutils.dep_util import newer_group
from distutils.util import split_quoted, execute

            

Reported by Pylint.

Unused import DistutilsFileError from wildcard import
Error

Line: 7 Column: 1

              for the Distutils compiler abstraction model."""

import sys, os, re
from distutils.errors import *
from distutils.spawn import spawn
from distutils.file_util import move_file
from distutils.dir_util import mkpath
from distutils.dep_util import newer_group
from distutils.util import split_quoted, execute

            

Reported by Pylint.

Unused import DistutilsOptionError from wildcard import
Error

Line: 7 Column: 1

              for the Distutils compiler abstraction model."""

import sys, os, re
from distutils.errors import *
from distutils.spawn import spawn
from distutils.file_util import move_file
from distutils.dir_util import mkpath
from distutils.dep_util import newer_group
from distutils.util import split_quoted, execute

            

Reported by Pylint.

Unused import DistutilsSetupError from wildcard import
Error

Line: 7 Column: 1

              for the Distutils compiler abstraction model."""

import sys, os, re
from distutils.errors import *
from distutils.spawn import spawn
from distutils.file_util import move_file
from distutils.dir_util import mkpath
from distutils.dep_util import newer_group
from distutils.util import split_quoted, execute

            

Reported by Pylint.

Unused import DistutilsExecError from wildcard import
Error

Line: 7 Column: 1

              for the Distutils compiler abstraction model."""

import sys, os, re
from distutils.errors import *
from distutils.spawn import spawn
from distutils.file_util import move_file
from distutils.dir_util import mkpath
from distutils.dep_util import newer_group
from distutils.util import split_quoted, execute

            

Reported by Pylint.

Unused import DistutilsInternalError from wildcard import
Error

Line: 7 Column: 1

              for the Distutils compiler abstraction model."""

import sys, os, re
from distutils.errors import *
from distutils.spawn import spawn
from distutils.file_util import move_file
from distutils.dir_util import mkpath
from distutils.dep_util import newer_group
from distutils.util import split_quoted, execute

            

Reported by Pylint.

Lib/ctypes/test/test_python_api.py
94 issues
Unused import RTLD_GLOBAL from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest, sys
from test import support

################################################################
# This section should be moved into ctypes\__init__.py, when it's ready.

from _ctypes import PyObj_FromPtr


            

Reported by Pylint.

Unused import memmove from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest, sys
from test import support

################################################################
# This section should be moved into ctypes\__init__.py, when it's ready.

from _ctypes import PyObj_FromPtr


            

Reported by Pylint.

Unused import memset from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest, sys
from test import support

################################################################
# This section should be moved into ctypes\__init__.py, when it's ready.

from _ctypes import PyObj_FromPtr


            

Reported by Pylint.

Unused import PYFUNCTYPE from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest, sys
from test import support

################################################################
# This section should be moved into ctypes\__init__.py, when it's ready.

from _ctypes import PyObj_FromPtr


            

Reported by Pylint.

Unused import cast from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest, sys
from test import support

################################################################
# This section should be moved into ctypes\__init__.py, when it's ready.

from _ctypes import PyObj_FromPtr


            

Reported by Pylint.

Unused import string_at from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest, sys
from test import support

################################################################
# This section should be moved into ctypes\__init__.py, when it's ready.

from _ctypes import PyObj_FromPtr


            

Reported by Pylint.

Unused import wstring_at from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest, sys
from test import support

################################################################
# This section should be moved into ctypes\__init__.py, when it's ready.

from _ctypes import PyObj_FromPtr


            

Reported by Pylint.

Unused import DllGetClassObject from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest, sys
from test import support

################################################################
# This section should be moved into ctypes\__init__.py, when it's ready.

from _ctypes import PyObj_FromPtr


            

Reported by Pylint.

Unused import DllCanUnloadNow from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest, sys
from test import support

################################################################
# This section should be moved into ctypes\__init__.py, when it's ready.

from _ctypes import PyObj_FromPtr


            

Reported by Pylint.

Unused import c_int8 from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest, sys
from test import support

################################################################
# This section should be moved into ctypes\__init__.py, when it's ready.

from _ctypes import PyObj_FromPtr


            

Reported by Pylint.