The following issues were found

Lib/test/test_descr.py
2653 issues
Instance of 'Number' has no 'prec' member
Error

Line: 275 Column: 24

                              result.prec = kwds.get('prec', 12)
                return result
            def __repr__(self):
                prec = self.prec
                if self.imag == 0.0:
                    return "%.*g" % (prec, self.real)
                if self.real == 0.0:
                    return "%.*gj" % (prec, self.imag)
                return "(%.*g+%.*gj)" % (prec, self.real, prec, self.imag)

            

Reported by Pylint.

Instance of 'Number' has no 'prec' member
Error

Line: 285 Column: 26

              
        a = Number(3.14, prec=6)
        self.assertEqual(repr(a), "3.14")
        self.assertEqual(a.prec, 6)

        a = Number(a, prec=2)
        self.assertEqual(repr(a), "3.1")
        self.assertEqual(a.prec, 2)


            

Reported by Pylint.

Instance of 'Number' has no 'prec' member
Error

Line: 289 Column: 26

              
        a = Number(a, prec=2)
        self.assertEqual(repr(a), "3.1")
        self.assertEqual(a.prec, 2)

        a = Number(234.5)
        self.assertEqual(repr(a), "234.5")
        self.assertEqual(a.prec, 12)


            

Reported by Pylint.

Instance of 'Number' has no 'prec' member
Error

Line: 293 Column: 26

              
        a = Number(234.5)
        self.assertEqual(repr(a), "234.5")
        self.assertEqual(a.prec, 12)

    def test_explicit_reverse_methods(self):
        # see issue 9930
        self.assertEqual(complex.__radd__(3j, 4.0), complex(4.0, 3.0))
        self.assertEqual(float.__rsub__(3.0, 1), -2.0)

            

Reported by Pylint.

Method should have "self" as first argument
Error

Line: 418 Column: 13

                      self.assertIsInstance(d, dict)
        class C(dict):
            state = -1
            def __init__(self_local, *a, **kw):
                if a:
                    self.assertEqual(len(a), 1)
                    self_local.state = a[0]
                if kw:
                    for k, v in list(kw.items()):

            

Reported by Pylint.

Method should have "self" as first argument
Error

Line: 427 Column: 13

                                      self_local[v] = k
            def __getitem__(self, key):
                return self.get(key, 0)
            def __setitem__(self_local, key, value):
                self.assertIsInstance(key, type(0))
                dict.__setitem__(self_local, key, value)
            def setstate(self, state):
                self.state = state
            def getstate(self):

            

Reported by Pylint.

class already defined line 476
Error

Line: 498 Column: 9

                          def __new__(cls, name, bases, dict):
                dict['__spam__'] = 1
                return type.__new__(cls, name, bases, dict)
        class C(metaclass=M1):
            pass
        self.assertEqual(C.__spam__, 1)
        c = C()
        self.assertEqual(c.__spam__, 1)


            

Reported by Pylint.

Class 'C' has no '__spam__' member
Error

Line: 500 Column: 26

                              return type.__new__(cls, name, bases, dict)
        class C(metaclass=M1):
            pass
        self.assertEqual(C.__spam__, 1)
        c = C()
        self.assertEqual(c.__spam__, 1)

        class _instance(object):
            pass

            

Reported by Pylint.

Instance of 'C' has no '__spam__' member
Error

Line: 502 Column: 26

                          pass
        self.assertEqual(C.__spam__, 1)
        c = C()
        self.assertEqual(c.__spam__, 1)

        class _instance(object):
            pass
        class M2(object):
            @staticmethod

            

Reported by Pylint.

class already defined line 476
Error

Line: 522 Column: 9

                                      continue
                    setattr(it, key, self.dict[key].__get__(it, self))
                return it
        class C(metaclass=M2):
            def spam(self):
                return 42
        self.assertEqual(C.name, 'C')
        self.assertEqual(C.bases, ())
        self.assertIn('spam', C.dict)

            

Reported by Pylint.

Lib/test/_test_multiprocessing.py
2018 issues
Instance of 'BaseTestCase' has no 'assertAlmostEqual' member
Error

Line: 189 Column: 13

              
    def assertTimingAlmostEqual(self, a, b):
        if CHECK_TIMINGS:
            self.assertAlmostEqual(a, b, 1)

    def assertReturnsIfImplemented(self, value, func, *args):
        try:
            res = func(*args)
        except NotImplementedError:

            

Reported by Pylint.

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

Line: 197 Column: 20

                      except NotImplementedError:
            pass
        else:
            return self.assertEqual(value, res)

    # For the sanity of Windows users, rather than crashing or freezing in
    # multiple ways.
    def __reduce__(self, *args):
        raise NotImplementedError("shouldn't try to pickle a test case")

            

Reported by Pylint.

Instance of '_TestProcess' has no 'TYPE' member
Error

Line: 237 Column: 12

                  ALLOWED_TYPES = ('processes', 'threads')

    def test_current(self):
        if self.TYPE == 'threads':
            self.skipTest('test not appropriate for {}'.format(self.TYPE))

        current = self.current_process()
        authkey = current.authkey


            

Reported by Pylint.

Instance of '_TestProcess' has no 'TYPE' member
Error

Line: 238 Column: 64

              
    def test_current(self):
        if self.TYPE == 'threads':
            self.skipTest('test not appropriate for {}'.format(self.TYPE))

        current = self.current_process()
        authkey = current.authkey

        self.assertTrue(current.is_alive())

            

Reported by Pylint.

Instance of '_TestProcess' has no 'skipTest' member
Error

Line: 238 Column: 13

              
    def test_current(self):
        if self.TYPE == 'threads':
            self.skipTest('test not appropriate for {}'.format(self.TYPE))

        current = self.current_process()
        authkey = current.authkey

        self.assertTrue(current.is_alive())

            

Reported by Pylint.

Instance of '_TestProcess' has no 'current_process' member
Error

Line: 240 Column: 19

                      if self.TYPE == 'threads':
            self.skipTest('test not appropriate for {}'.format(self.TYPE))

        current = self.current_process()
        authkey = current.authkey

        self.assertTrue(current.is_alive())
        self.assertTrue(not current.daemon)
        self.assertIsInstance(authkey, bytes)

            

Reported by Pylint.

Instance of '_TestProcess' has no 'assertTrue' member
Error

Line: 243 Column: 9

                      current = self.current_process()
        authkey = current.authkey

        self.assertTrue(current.is_alive())
        self.assertTrue(not current.daemon)
        self.assertIsInstance(authkey, bytes)
        self.assertTrue(len(authkey) > 0)
        self.assertEqual(current.ident, os.getpid())
        self.assertEqual(current.exitcode, None)

            

Reported by Pylint.

Instance of '_TestProcess' has no 'assertTrue' member
Error

Line: 244 Column: 9

                      authkey = current.authkey

        self.assertTrue(current.is_alive())
        self.assertTrue(not current.daemon)
        self.assertIsInstance(authkey, bytes)
        self.assertTrue(len(authkey) > 0)
        self.assertEqual(current.ident, os.getpid())
        self.assertEqual(current.exitcode, None)


            

Reported by Pylint.

Instance of '_TestProcess' has no 'assertIsInstance' member
Error

Line: 245 Column: 9

              
        self.assertTrue(current.is_alive())
        self.assertTrue(not current.daemon)
        self.assertIsInstance(authkey, bytes)
        self.assertTrue(len(authkey) > 0)
        self.assertEqual(current.ident, os.getpid())
        self.assertEqual(current.exitcode, None)

    def test_daemon_argument(self):

            

Reported by Pylint.

Instance of '_TestProcess' has no 'assertTrue' member
Error

Line: 246 Column: 9

                      self.assertTrue(current.is_alive())
        self.assertTrue(not current.daemon)
        self.assertIsInstance(authkey, bytes)
        self.assertTrue(len(authkey) > 0)
        self.assertEqual(current.ident, os.getpid())
        self.assertEqual(current.exitcode, None)

    def test_daemon_argument(self):
        if self.TYPE == "threads":

            

Reported by Pylint.

Lib/lib2to3/tests/test_fixers.py
1935 issues
Instance of 'FixerTestCase' has no 'fixer' member
Error

Line: 19 Column: 25

                  # their own.
    def setUp(self, fix_list=None, fixer_pkg="lib2to3", options=None):
        if fix_list is None:
            fix_list = [self.fixer]
        self.refactor = support.get_refactorer(fixer_pkg, fix_list, options)
        self.fixer_log = []
        self.filename = "<string>"

        for fixer in chain(self.refactor.pre_order,

            

Reported by Pylint.

Instance of 'FixerTestCase' has no 'fixer' member
Error

Line: 56 Column: 18

                          self.assertEqual(self.fixer_log, [])

    def assert_runs_after(self, *names):
        fixes = [self.fixer]
        fixes.extend(names)
        r = support.get_refactorer("lib2to3", fixes)
        (pre, post) = r.get_fixers()
        n = "fix_" + self.fixer
        if post and post[-1].__class__.__module__.endswith(n):

            

Reported by Pylint.

Instance of 'FixerTestCase' has no 'fixer' member
Error

Line: 60 Column: 22

                      fixes.extend(names)
        r = support.get_refactorer("lib2to3", fixes)
        (pre, post) = r.get_fixers()
        n = "fix_" + self.fixer
        if post and post[-1].__class__.__module__.endswith(n):
            # We're the last fixer to run
            return
        if pre and pre[-1].__class__.__module__.endswith(n) and not post:
            # We're the last in pre and post is empty

            

Reported by Pylint.

Instance of 'ImportsFixerTests' has no 'modules' member
Error

Line: 1697 Column: 25

              class ImportsFixerTests:

    def test_import_module(self):
        for old, new in self.modules.items():
            b = "import %s" % old
            a = "import %s" % new
            self.check(b, a)

            b = "import foo, %s, bar" % old

            

Reported by Pylint.

Instance of 'ImportsFixerTests' has no 'check' member
Error

Line: 1700 Column: 13

                      for old, new in self.modules.items():
            b = "import %s" % old
            a = "import %s" % new
            self.check(b, a)

            b = "import foo, %s, bar" % old
            a = "import foo, %s, bar" % new
            self.check(b, a)


            

Reported by Pylint.

Instance of 'ImportsFixerTests' has no 'check' member
Error

Line: 1704 Column: 13

              
            b = "import foo, %s, bar" % old
            a = "import foo, %s, bar" % new
            self.check(b, a)

    def test_import_from(self):
        for old, new in self.modules.items():
            b = "from %s import foo" % old
            a = "from %s import foo" % new

            

Reported by Pylint.

Instance of 'ImportsFixerTests' has no 'modules' member
Error

Line: 1707 Column: 25

                          self.check(b, a)

    def test_import_from(self):
        for old, new in self.modules.items():
            b = "from %s import foo" % old
            a = "from %s import foo" % new
            self.check(b, a)

            b = "from %s import foo, bar" % old

            

Reported by Pylint.

Instance of 'ImportsFixerTests' has no 'check' member
Error

Line: 1710 Column: 13

                      for old, new in self.modules.items():
            b = "from %s import foo" % old
            a = "from %s import foo" % new
            self.check(b, a)

            b = "from %s import foo, bar" % old
            a = "from %s import foo, bar" % new
            self.check(b, a)


            

Reported by Pylint.

Instance of 'ImportsFixerTests' has no 'check' member
Error

Line: 1714 Column: 13

              
            b = "from %s import foo, bar" % old
            a = "from %s import foo, bar" % new
            self.check(b, a)

            b = "from %s import (yes, no)" % old
            a = "from %s import (yes, no)" % new
            self.check(b, a)


            

Reported by Pylint.

Instance of 'ImportsFixerTests' has no 'check' member
Error

Line: 1718 Column: 13

              
            b = "from %s import (yes, no)" % old
            a = "from %s import (yes, no)" % new
            self.check(b, a)

    def test_import_module_as(self):
        for old, new in self.modules.items():
            b = "import %s as foo_bar" % old
            a = "import %s as foo_bar" % new

            

Reported by Pylint.

Lib/test/test_decimal.py
1812 issues
Instance of 'IBMTestCases' has no 'decimal' member
Error

Line: 139 Column: 24

                  """Class which tests the Decimal class against the IBM test cases."""

    def setUp(self):
        self.context = self.decimal.Context()
        self.readcontext = self.decimal.Context()
        self.ignore_list = ['#']

        # List of individual .decTest test ids that correspond to tests that
        # we're skipping for one reason or another.

            

Reported by Pylint.

Instance of 'IBMTestCases' has no 'decimal' member
Error

Line: 140 Column: 28

              
    def setUp(self):
        self.context = self.decimal.Context()
        self.readcontext = self.decimal.Context()
        self.ignore_list = ['#']

        # List of individual .decTest test ids that correspond to tests that
        # we're skipping for one reason or another.
        self.skipped_test_ids = set([

            

Reported by Pylint.

Instance of 'IBMTestCases' has no 'decimal' member
Error

Line: 181 Column: 12

                          'powx4014',
            ])

        if self.decimal == C:
            # status has additional Subnormal, Underflow
            self.skipped_test_ids.add('pwsx803')
            self.skipped_test_ids.add('pwsx805')
            # Correct rounding (skipped for decNumber, too)
            self.skipped_test_ids.add('powx4302')

            

Reported by Pylint.

Instance of 'IBMTestCases' has no 'decimal' member
Error

Line: 252 Column: 40

                                           '05up' : ROUND_05UP}

        # Map the test cases' error names to the actual errors.
        self.ErrorNames = {'clamped' : self.decimal.Clamped,
                           'conversion_syntax' : self.decimal.InvalidOperation,
                           'division_by_zero' : self.decimal.DivisionByZero,
                           'division_impossible' : self.decimal.InvalidOperation,
                           'division_undefined' : self.decimal.InvalidOperation,
                           'inexact' : self.decimal.Inexact,

            

Reported by Pylint.

Instance of 'IBMTestCases' has no 'decimal' member
Error

Line: 253 Column: 50

              
        # Map the test cases' error names to the actual errors.
        self.ErrorNames = {'clamped' : self.decimal.Clamped,
                           'conversion_syntax' : self.decimal.InvalidOperation,
                           'division_by_zero' : self.decimal.DivisionByZero,
                           'division_impossible' : self.decimal.InvalidOperation,
                           'division_undefined' : self.decimal.InvalidOperation,
                           'inexact' : self.decimal.Inexact,
                           'invalid_context' : self.decimal.InvalidOperation,

            

Reported by Pylint.

Instance of 'IBMTestCases' has no 'decimal' member
Error

Line: 254 Column: 49

                      # Map the test cases' error names to the actual errors.
        self.ErrorNames = {'clamped' : self.decimal.Clamped,
                           'conversion_syntax' : self.decimal.InvalidOperation,
                           'division_by_zero' : self.decimal.DivisionByZero,
                           'division_impossible' : self.decimal.InvalidOperation,
                           'division_undefined' : self.decimal.InvalidOperation,
                           'inexact' : self.decimal.Inexact,
                           'invalid_context' : self.decimal.InvalidOperation,
                           'invalid_operation' : self.decimal.InvalidOperation,

            

Reported by Pylint.

Instance of 'IBMTestCases' has no 'decimal' member
Error

Line: 255 Column: 52

                      self.ErrorNames = {'clamped' : self.decimal.Clamped,
                           'conversion_syntax' : self.decimal.InvalidOperation,
                           'division_by_zero' : self.decimal.DivisionByZero,
                           'division_impossible' : self.decimal.InvalidOperation,
                           'division_undefined' : self.decimal.InvalidOperation,
                           'inexact' : self.decimal.Inexact,
                           'invalid_context' : self.decimal.InvalidOperation,
                           'invalid_operation' : self.decimal.InvalidOperation,
                           'overflow' : self.decimal.Overflow,

            

Reported by Pylint.

Instance of 'IBMTestCases' has no 'decimal' member
Error

Line: 256 Column: 51

                                         'conversion_syntax' : self.decimal.InvalidOperation,
                           'division_by_zero' : self.decimal.DivisionByZero,
                           'division_impossible' : self.decimal.InvalidOperation,
                           'division_undefined' : self.decimal.InvalidOperation,
                           'inexact' : self.decimal.Inexact,
                           'invalid_context' : self.decimal.InvalidOperation,
                           'invalid_operation' : self.decimal.InvalidOperation,
                           'overflow' : self.decimal.Overflow,
                           'rounded' : self.decimal.Rounded,

            

Reported by Pylint.

Instance of 'IBMTestCases' has no 'decimal' member
Error

Line: 257 Column: 40

                                         'division_by_zero' : self.decimal.DivisionByZero,
                           'division_impossible' : self.decimal.InvalidOperation,
                           'division_undefined' : self.decimal.InvalidOperation,
                           'inexact' : self.decimal.Inexact,
                           'invalid_context' : self.decimal.InvalidOperation,
                           'invalid_operation' : self.decimal.InvalidOperation,
                           'overflow' : self.decimal.Overflow,
                           'rounded' : self.decimal.Rounded,
                           'subnormal' : self.decimal.Subnormal,

            

Reported by Pylint.

Instance of 'IBMTestCases' has no 'decimal' member
Error

Line: 258 Column: 48

                                         'division_impossible' : self.decimal.InvalidOperation,
                           'division_undefined' : self.decimal.InvalidOperation,
                           'inexact' : self.decimal.Inexact,
                           'invalid_context' : self.decimal.InvalidOperation,
                           'invalid_operation' : self.decimal.InvalidOperation,
                           'overflow' : self.decimal.Overflow,
                           'rounded' : self.decimal.Rounded,
                           'subnormal' : self.decimal.Subnormal,
                           'underflow' : self.decimal.Underflow}

            

Reported by Pylint.

Lib/test/test_socket.py
1736 issues
Cannot import 'traceback' due to syntax error 'invalid syntax (<unknown>, line 576)'
Error

Line: 14 Column: 1

              import select
import tempfile
import time
import traceback
import queue
import sys
import os
import platform
import array

            

Reported by Pylint.

Module 'socket' has no 'IPPROTO_UDPLITE' member
Error

Line: 199 Column: 70

              class SocketUDPLITETest(SocketUDPTest):

    def setUp(self):
        self.serv = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDPLITE)
        self.port = socket_helper.bind_port(self.serv)

class ThreadSafeCleanupTestCase(unittest.TestCase):
    """Subclass of unittest.TestCase with thread-safe cleanup methods.


            

Reported by Pylint.

Access to member 'setUp' before its definition line 330
Error

Line: 328 Column: 24

              
    def __init__(self):
        # Swap the true setup function
        self.__setUp = self.setUp
        self.__tearDown = self.tearDown
        self.setUp = self._setUp
        self.tearDown = self._tearDown

    def serverExplicitReady(self):

            

Reported by Pylint.

Access to member 'tearDown' before its definition line 331
Error

Line: 329 Column: 27

                  def __init__(self):
        # Swap the true setup function
        self.__setUp = self.setUp
        self.__tearDown = self.tearDown
        self.setUp = self._setUp
        self.tearDown = self._tearDown

    def serverExplicitReady(self):
        """This method allows the server to explicitly indicate that

            

Reported by Pylint.

Generator 'generator' has no '__enter__' member
Error

Line: 342 Column: 9

              
    def _setUp(self):
        self.wait_threads = threading_helper.wait_threads_exit()
        self.wait_threads.__enter__()

        self.server_ready = threading.Event()
        self.client_ready = threading.Event()
        self.done = threading.Event()
        self.queue = queue.Queue(1)

            

Reported by Pylint.

Instance of 'ThreadableTest' has no 'id' member
Error

Line: 351 Column: 22

                      self.server_crashed = False

        # Do some munging to start the client test.
        methodname = self.id()
        i = methodname.rfind('.')
        methodname = methodname[i+1:]
        test_method = getattr(self, '_' + methodname)
        self.client_thread = thread.start_new_thread(
            self.clientRun, (test_method,))

            

Reported by Pylint.

Generator 'generator' has no '__exit__' member
Error

Line: 370 Column: 9

                  def _tearDown(self):
        self.__tearDown()
        self.done.wait()
        self.wait_threads.__exit__(None, None, None)

        if self.queue.qsize():
            exc = self.queue.get()
            raise exc


            

Reported by Pylint.

Module 'socket' has no 'IPPROTO_UDPLITE' member
Error

Line: 442 Column: 69

                      ThreadableTest.__init__(self)

    def clientSetUp(self):
        self.cli = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDPLITE)

    def clientTearDown(self):
        self.cli.close()
        self.cli = None
        ThreadableTest.clientTearDown(self)

            

Reported by Pylint.

Instance of 'SocketTestBase' has no 'newSocket' member
Error

Line: 597 Column: 21

                  """

    def setUp(self):
        self.serv = self.newSocket()
        self.bindServer()

    def bindServer(self):
        """Bind server socket and set self.serv_addr to its address."""
        self.bindSock(self.serv)

            

Reported by Pylint.

Instance of 'SocketTestBase' has no 'bindSock' member
Error

Line: 602 Column: 9

              
    def bindServer(self):
        """Bind server socket and set self.serv_addr to its address."""
        self.bindSock(self.serv)
        self.serv_addr = self.serv.getsockname()

    def tearDown(self):
        self.serv.close()
        self.serv = None

            

Reported by Pylint.

Lib/test/test_inspect.py
1664 issues
Non-iterable value range(2) is used in an iterating context
Error

Line: 115 Column: 20

                      yield i

async def async_generator_function_example(self):
    async for i in range(2):
        yield i

async def coroutine_function_example(self):
    return 'spam'


            

Reported by Pylint.

Instance of 'str' has no 'close' member
Error

Line: 215 Column: 9

                                  async_generator_function_example))))
        self.assertTrue(inspect.isasyncgen(async_gen_coro))

        coro.close(); gen_coro.close(); # silence warnings

    def test_isawaitable(self):
        def gen(): yield
        self.assertFalse(inspect.isawaitable(gen()))


            

Reported by Pylint.

Method has no argument
Error

Line: 228 Column: 13

                      self.assertTrue(inspect.isawaitable(gen_coro))

        class Future:
            def __await__():
                pass
        self.assertTrue(inspect.isawaitable(Future()))
        self.assertFalse(inspect.isawaitable(Future))

        class NotFuture: pass

            

Reported by Pylint.

Instance of 'str' has no 'close' member
Error

Line: 238 Column: 9

                      not_fut.__await__ = lambda: None
        self.assertFalse(inspect.isawaitable(not_fut))

        coro.close(); gen_coro.close() # silence warnings

    def test_isroutine(self):
        self.assertTrue(inspect.isroutine(mod.spam))
        self.assertTrue(inspect.isroutine([].count))


            

Reported by Pylint.

Class 'SlotUser' has no 'power' member
Error

Line: 442 Column: 41

                                       'A longer,\n\nindented\n\ndocstring.')
        self.assertEqual(inspect.getdoc(git.abuse),
                         'Another\n\ndocstring\n\ncontaining\n\ntabs')
        self.assertEqual(inspect.getdoc(SlotUser.power),
                         'measured in kilowatts')
        self.assertEqual(inspect.getdoc(SlotUser.distance),
                         'measured in kilometers')

    @unittest.skipIf(sys.flags.optimize >= 2,

            

Reported by Pylint.

Class 'SlotUser' has no 'distance' member
Error

Line: 444 Column: 41

                                       'Another\n\ndocstring\n\ncontaining\n\ntabs')
        self.assertEqual(inspect.getdoc(SlotUser.power),
                         'measured in kilowatts')
        self.assertEqual(inspect.getdoc(SlotUser.distance),
                         'measured in kilometers')

    @unittest.skipIf(sys.flags.optimize >= 2,
                     "Docstrings are omitted with -O2 and above")
    def test_getdoc_inherited(self):

            

Reported by Pylint.

Instance of 'module' has no 'x' member
Error

Line: 564 Column: 48

                      m.__file__ = "<string>" # hopefully not a real filename...
        m.__loader__ = "dummy"  # pretend the filename is understood by a loader
        exec("def x(): pass", m.__dict__)
        self.assertEqual(inspect.getsourcefile(m.x.__code__), '<string>')
        del sys.modules[name]
        inspect.getmodule(compile('a=10','','single'))

    def test_proceed_with_fake_filename(self):
        '''doctest monkeypatches linecache to enable inspection'''

            

Reported by Pylint.

Module 'test.inspect_fodder2' has no 'anonymous' member
Error

Line: 664 Column: 32

                  def test_anonymous(self):
        # Test inspect.getsource with a lambda function defined
        # as argument to another function.
        self.assertSourceEqual(mod2.anonymous, 55, 55)

class TestBlockComments(GetSourceBase):
    fodderModule = mod

    def test_toplevel_class(self):

            

Reported by Pylint.

Unable to import 'inspect_fodder3'
Error

Line: 794 Column: 13

                                'w', encoding='utf-8') as f:
            f.write("class X:\n    pass # No EOL")
        with DirsOnSysPath(self.tempdir):
            import inspect_fodder3 as mod3
        self.fodderModule = mod3
        super().setUp()

    def tearDown(self):
        shutil.rmtree(self.tempdir)

            

Reported by Pylint.

Method has no argument
Error

Line: 809 Column: 5

                  """
    A broken data descriptor. See bug #1785.
    """
    def __get__(*args):
        raise AttributeError("broken data descriptor")

    def __set__(*args):
        raise RuntimeError


            

Reported by Pylint.

Lib/test/test_dataclasses.py
1624 issues
class already defined line 79
Error

Line: 91 Column: 13

                                                  "non-default argument 'y' follows "
                                    "default argument"):
            @dataclass
            class C:
                x: int = 0
                y: int

        # A derived class adds a non-default field after a default one.
        with self.assertRaisesRegex(TypeError,

            

Reported by Pylint.

class already defined line 79
Error

Line: 104 Column: 13

                              x: int = 0

            @dataclass
            class C(B):
                y: int

        # Override a base class field and add a default to
        #  a field which didn't use to have a default.
        with self.assertRaisesRegex(TypeError,

            

Reported by Pylint.

class already defined line 100
Error

Line: 113 Column: 13

                                                  "non-default argument 'y' follows "
                                    "default argument"):
            @dataclass
            class B:
                x: int
                y: int

            @dataclass
            class C(B):

            

Reported by Pylint.

class already defined line 79
Error

Line: 118 Column: 13

                              y: int

            @dataclass
            class C(B):
                x: int = 0

    def test_overwrite_hash(self):
        # Test that declaring this class isn't an error.  It should
        #  use the user-provided __hash__.

            

Reported by Pylint.

class already defined line 125
Error

Line: 134 Column: 9

                      # Test that declaring this class isn't an error.  It should
        #  use the generated __hash__.
        @dataclass(frozen=True)
        class C:
            x: int
            def __eq__(self, other):
                return False
        self.assertEqual(hash(C(100)), hash((100,)))


            

Reported by Pylint.

class already defined line 125
Error

Line: 145 Column: 13

                      with self.assertRaisesRegex(TypeError,
                                    'Cannot overwrite attribute __hash__'):
            @dataclass(unsafe_hash=True)
            class C:
                def __hash__(self):
                    pass

        # Creating this class should not generate an exception,
        #  because even though __hash__ exists before @dataclass is

            

Reported by Pylint.

class already defined line 125
Error

Line: 154 Column: 9

                      #  called, (due to __eq__ being defined), since it's None
        #  that's okay.
        @dataclass(unsafe_hash=True)
        class C:
            x: int
            def __eq__(self):
                pass
        # The generated hash function works as we'd expect.
        self.assertEqual(hash(C(10)), hash((10,)))

            

Reported by Pylint.

The special method '__eq__' expects 1 param(s), 0 was given
Error

Line: 156 Column: 13

                      @dataclass(unsafe_hash=True)
        class C:
            x: int
            def __eq__(self):
                pass
        # The generated hash function works as we'd expect.
        self.assertEqual(hash(C(10)), hash((10,)))

        # Creating this class should generate an exception, because

            

Reported by Pylint.

class already defined line 125
Error

Line: 167 Column: 13

                      with self.assertRaisesRegex(TypeError,
                                    'Cannot overwrite attribute __hash__'):
            @dataclass(unsafe_hash=True)
            class C:
                x: int
                def __eq__(self):
                    pass
                def __hash__(self):
                    pass

            

Reported by Pylint.

The special method '__eq__' expects 1 param(s), 0 was given
Error

Line: 169 Column: 17

                          @dataclass(unsafe_hash=True)
            class C:
                x: int
                def __eq__(self):
                    pass
                def __hash__(self):
                    pass

    def test_overwrite_fields_in_derived_class(self):

            

Reported by Pylint.

Lib/test/test_io.py
1599 issues
Super of 'MockFileIO' has no 'read' member
Error

Line: 229 Column: 15

                      super().__init__(data)

    def read(self, n=None):
        res = super().read(n)
        self.read_history.append(None if res is None else len(res))
        return res

    def readinto(self, b):
        res = super().readinto(b)

            

Reported by Pylint.

Super of 'MockFileIO' has no 'readinto' member
Error

Line: 234 Column: 15

                      return res

    def readinto(self, b):
        res = super().readinto(b)
        self.read_history.append(res)
        return res

class CMockFileIO(MockFileIO, io.BytesIO):
    pass

            

Reported by Pylint.

Instance of 'MockUnseekableIO' has no 'UnsupportedOperation' member
Error

Line: 250 Column: 15

                      return False

    def seek(self, *args):
        raise self.UnsupportedOperation("not seekable")

    def tell(self, *args):
        raise self.UnsupportedOperation("not seekable")

    def truncate(self, *args):

            

Reported by Pylint.

Instance of 'MockUnseekableIO' has no 'UnsupportedOperation' member
Error

Line: 253 Column: 15

                      raise self.UnsupportedOperation("not seekable")

    def tell(self, *args):
        raise self.UnsupportedOperation("not seekable")

    def truncate(self, *args):
        raise self.UnsupportedOperation("not seekable")

class CMockUnseekableIO(MockUnseekableIO, io.BytesIO):

            

Reported by Pylint.

Instance of 'MockUnseekableIO' has no 'UnsupportedOperation' member
Error

Line: 256 Column: 15

                      raise self.UnsupportedOperation("not seekable")

    def truncate(self, *args):
        raise self.UnsupportedOperation("not seekable")

class CMockUnseekableIO(MockUnseekableIO, io.BytesIO):
    UnsupportedOperation = io.UnsupportedOperation

class PyMockUnseekableIO(MockUnseekableIO, pyio.BytesIO):

            

Reported by Pylint.

Instance of 'IOTest' has no 'UnsupportedOperation' member
Error

Line: 409 Column: 15

              
    def test_invalid_operations(self):
        # Try writing on a file opened in read mode and vice-versa.
        exc = self.UnsupportedOperation
        with self.open(os_helper.TESTFN, "w", encoding="utf-8") as fp:
            self.assertRaises(exc, fp.read)
            self.assertRaises(exc, fp.readline)
        with self.open(os_helper.TESTFN, "wb") as fp:
            self.assertRaises(exc, fp.read)

            

Reported by Pylint.

Instance of 'IOTest' has no 'open' member
Error

Line: 410 Column: 14

                  def test_invalid_operations(self):
        # Try writing on a file opened in read mode and vice-versa.
        exc = self.UnsupportedOperation
        with self.open(os_helper.TESTFN, "w", encoding="utf-8") as fp:
            self.assertRaises(exc, fp.read)
            self.assertRaises(exc, fp.readline)
        with self.open(os_helper.TESTFN, "wb") as fp:
            self.assertRaises(exc, fp.read)
            self.assertRaises(exc, fp.readline)

            

Reported by Pylint.

Instance of 'IOTest' has no 'open' member
Error

Line: 413 Column: 14

                      with self.open(os_helper.TESTFN, "w", encoding="utf-8") as fp:
            self.assertRaises(exc, fp.read)
            self.assertRaises(exc, fp.readline)
        with self.open(os_helper.TESTFN, "wb") as fp:
            self.assertRaises(exc, fp.read)
            self.assertRaises(exc, fp.readline)
        with self.open(os_helper.TESTFN, "wb", buffering=0) as fp:
            self.assertRaises(exc, fp.read)
            self.assertRaises(exc, fp.readline)

            

Reported by Pylint.

Instance of 'IOTest' has no 'open' member
Error

Line: 416 Column: 14

                      with self.open(os_helper.TESTFN, "wb") as fp:
            self.assertRaises(exc, fp.read)
            self.assertRaises(exc, fp.readline)
        with self.open(os_helper.TESTFN, "wb", buffering=0) as fp:
            self.assertRaises(exc, fp.read)
            self.assertRaises(exc, fp.readline)
        with self.open(os_helper.TESTFN, "rb", buffering=0) as fp:
            self.assertRaises(exc, fp.write, b"blah")
            self.assertRaises(exc, fp.writelines, [b"blah\n"])

            

Reported by Pylint.

Instance of 'IOTest' has no 'open' member
Error

Line: 419 Column: 14

                      with self.open(os_helper.TESTFN, "wb", buffering=0) as fp:
            self.assertRaises(exc, fp.read)
            self.assertRaises(exc, fp.readline)
        with self.open(os_helper.TESTFN, "rb", buffering=0) as fp:
            self.assertRaises(exc, fp.write, b"blah")
            self.assertRaises(exc, fp.writelines, [b"blah\n"])
        with self.open(os_helper.TESTFN, "rb") as fp:
            self.assertRaises(exc, fp.write, b"blah")
            self.assertRaises(exc, fp.writelines, [b"blah\n"])

            

Reported by Pylint.

Lib/test/test_enum.py
1448 issues
Method should have "self" as first argument
Error

Line: 292 Column: 13

                          AUTUMN = 3
            WINTER = 4

            def spam(cls):
                pass

        self.assertTrue(hasattr(Season, 'spam'))
        del Season.spam
        self.assertFalse(hasattr(Season, 'spam'))

            

Reported by Pylint.

class already defined line 321
Error

Line: 324 Column: 13

                          class Wrong(Enum):
                mro = 9
        with self.assertRaises(ValueError):
            class Wrong(Enum):
                _create_= 11
        with self.assertRaises(ValueError):
            class Wrong(Enum):
                _get_mixins_ = 9
        with self.assertRaises(ValueError):

            

Reported by Pylint.

class already defined line 321
Error

Line: 327 Column: 13

                          class Wrong(Enum):
                _create_= 11
        with self.assertRaises(ValueError):
            class Wrong(Enum):
                _get_mixins_ = 9
        with self.assertRaises(ValueError):
            class Wrong(Enum):
                _find_new_ = 1
        with self.assertRaises(ValueError):

            

Reported by Pylint.

class already defined line 321
Error

Line: 330 Column: 13

                          class Wrong(Enum):
                _get_mixins_ = 9
        with self.assertRaises(ValueError):
            class Wrong(Enum):
                _find_new_ = 1
        with self.assertRaises(ValueError):
            class Wrong(Enum):
                _any_name_ = 9


            

Reported by Pylint.

class already defined line 321
Error

Line: 333 Column: 13

                          class Wrong(Enum):
                _find_new_ = 1
        with self.assertRaises(ValueError):
            class Wrong(Enum):
                _any_name_ = 9

    def test_bool(self):
        # plain Enum members are always True
        class Logic(Enum):

            

Reported by Pylint.

class already defined line 438
Error

Line: 445 Column: 13

                              red = 4

        with self.assertRaises(TypeError):
            class Color(Enum):
                red = 1
                green = 2
                blue = 3
                def red(self):
                    return 'red'

            

Reported by Pylint.

method already defined line 446
Error

Line: 449 Column: 17

                              red = 1
                green = 2
                blue = 3
                def red(self):
                    return 'red'

        with self.assertRaises(TypeError):
            class Color(Enum):
                @property

            

Reported by Pylint.

class already defined line 438
Error

Line: 453 Column: 13

                                  return 'red'

        with self.assertRaises(TypeError):
            class Color(Enum):
                @property
                def red(self):
                    return 'redder'
                red = 1
                green = 2

            

Reported by Pylint.

method already defined line 558
Error

Line: 571 Column: 5

                  @unittest.skipIf(
            python_version >= (3, 12),
            'mixin-format now uses member instead of member.value',
            )
    def test_mixin_format_warning(self):
        class Grades(int, Enum):
            A = 5
            B = 4
            C = 3

            

Reported by Pylint.

class already defined line 711
Error

Line: 721 Column: 13

                          def repr(self):
                return hex(self)
        with self.assertRaisesRegex(TypeError, 'too many data types'):
            class Huh(MyStr, MyInt, Enum):
                One = 1

    def test_hash(self):
        Season = self.Season
        dates = {}

            

Reported by Pylint.

Lib/test/test_exceptions.py
1432 issues
Method should have "self" as first argument
Error

Line: 291 Column: 13

                      # exception object can't be constructed.

        class BadException(Exception):
            def __init__(self_):
                raise RuntimeError("can't instantiate BadException")

        class InvalidException:
            pass


            

Reported by Pylint.

Instance of 'OSError' has no 'winerror' member
Error

Line: 346 Column: 30

                          # POSIX errno (9 aka EBADF) is untranslated
            w = OSError(9, 'foo', 'bar')
            self.assertEqual(w.errno, 9)
            self.assertEqual(w.winerror, None)
            self.assertEqual(str(w), "[Errno 9] foo: 'bar'")
            # ERROR_PATH_NOT_FOUND (win error 3) becomes ENOENT (2)
            w = OSError(0, 'foo', 'bar', 3)
            self.assertEqual(w.errno, 2)
            self.assertEqual(w.winerror, 3)

            

Reported by Pylint.

Instance of 'OSError' has no 'winerror' member
Error

Line: 351 Column: 30

                          # ERROR_PATH_NOT_FOUND (win error 3) becomes ENOENT (2)
            w = OSError(0, 'foo', 'bar', 3)
            self.assertEqual(w.errno, 2)
            self.assertEqual(w.winerror, 3)
            self.assertEqual(w.strerror, 'foo')
            self.assertEqual(w.filename, 'bar')
            self.assertEqual(w.filename2, None)
            self.assertEqual(str(w), "[WinError 3] foo: 'bar'")
            # Unknown win error becomes EINVAL (22)

            

Reported by Pylint.

Instance of 'OSError' has no 'winerror' member
Error

Line: 359 Column: 30

                          # Unknown win error becomes EINVAL (22)
            w = OSError(0, 'foo', None, 1001)
            self.assertEqual(w.errno, 22)
            self.assertEqual(w.winerror, 1001)
            self.assertEqual(w.strerror, 'foo')
            self.assertEqual(w.filename, None)
            self.assertEqual(w.filename2, None)
            self.assertEqual(str(w), "[WinError 1001] foo")
            # Non-numeric "errno"

            

Reported by Pylint.

Instance of 'OSError' has no 'winerror' member
Error

Line: 367 Column: 30

                          # Non-numeric "errno"
            w = OSError('bar', 'foo')
            self.assertEqual(w.errno, 'bar')
            self.assertEqual(w.winerror, None)
            self.assertEqual(w.strerror, 'foo')
            self.assertEqual(w.filename, None)
            self.assertEqual(w.filename2, None)

    @unittest.skipUnless(sys.platform == 'win32',

            

Reported by Pylint.

Undefined variable 'something'
Error

Line: 758 Column: 13

                      def print_error():
            e
        try:
            something
        except Exception as e:
            print_error()
            # implicit "del e" here

    def test_generator_leaking(self):

            

Reported by Pylint.

Cannot import 'traceback' due to syntax error 'invalid syntax (<unknown>, line 576)'
Error

Line: 1341 Column: 1

                  def test_MemoryError(self):
        # PyErr_NoMemory always raises the same exception instance.
        # Check that the traceback is not doubled.
        import traceback
        from _testcapi import raise_memoryerror
        def raiseMemError():
            try:
                raise_memoryerror()
            except MemoryError as e:

            

Reported by Pylint.

wr is not callable
Error

Line: 1413 Column: 33

                      try:
            inner()
        except MemoryError as e:
            self.assertNotEqual(wr(), None)
        else:
            self.fail("MemoryError not raised")
        self.assertEqual(wr(), None)

    @no_tracing

            

Reported by Pylint.

wr is not callable
Error

Line: 1416 Column: 26

                          self.assertNotEqual(wr(), None)
        else:
            self.fail("MemoryError not raised")
        self.assertEqual(wr(), None)

    @no_tracing
    def test_recursion_error_cleanup(self):
        # Same test as above, but with "recursion exceeded" errors
        class C:

            

Reported by Pylint.

wr is not callable
Error

Line: 1433 Column: 33

                      try:
            inner()
        except RecursionError as e:
            self.assertNotEqual(wr(), None)
        else:
            self.fail("RecursionError not raised")
        self.assertEqual(wr(), None)

    def test_errno_ENOTDIR(self):

            

Reported by Pylint.