The following issues were found

Lib/unittest/test/testmock/testmagicmethods.py
92 issues
Statement seems to have no effect
Error

Line: 30 Column: 9

              
        mock = MagicMock()
        # this time use it first
        mock['foo']
        del mock.__getitem__
        self.assertRaises(TypeError, lambda: mock['foo'])


    def test_magic_method_wrapping(self):

            

Reported by Pylint.

Unused argument 'name'
Error

Line: 37 Column: 21

              
    def test_magic_method_wrapping(self):
        mock = Mock()
        def f(self, name):
            return self, 'fish'

        mock.__getitem__ = f
        self.assertIsNot(mock.__getitem__, f)
        self.assertEqual(mock['foo'], (mock, 'fish'))

            

Reported by Pylint.

Unused argument 's'
Error

Line: 84 Column: 21

                      self.assertRaises(TypeError, _set)

        _dict = {}
        def getitem(s, name):
            return _dict[name]
        def setitem(s, name, value):
            _dict[name] = value
        def delitem(s, name):
            del _dict[name]

            

Reported by Pylint.

Unused argument 's'
Error

Line: 86 Column: 21

                      _dict = {}
        def getitem(s, name):
            return _dict[name]
        def setitem(s, name, value):
            _dict[name] = value
        def delitem(s, name):
            del _dict[name]

        mock.__setitem__ = setitem

            

Reported by Pylint.

Unused argument 's'
Error

Line: 88 Column: 21

                          return _dict[name]
        def setitem(s, name, value):
            _dict[name] = value
        def delitem(s, name):
            del _dict[name]

        mock.__setitem__ = setitem
        mock.__getitem__ = getitem
        mock.__delitem__ = delitem

            

Reported by Pylint.

Unused argument 's'
Error

Line: 161 Column: 19

                      # test delegation
        self.assertEqual(hash(mock), Mock.__hash__(mock))

        def _hash(s):
            return 3
        mock.__hash__ = _hash
        self.assertEqual(hash(mock), 3)



            

Reported by Pylint.

Unused argument 's'
Error

Line: 177 Column: 18

              
    def test_comparison(self):
        mock = Mock()
        def comp(s, o):
            return True
        mock.__lt__ = mock.__gt__ = mock.__le__ = mock.__ge__ = comp
        self. assertTrue(mock < 3)
        self. assertTrue(mock > 3)
        self. assertTrue(mock <= 3)

            

Reported by Pylint.

Unused argument 'o'
Error

Line: 177 Column: 21

              
    def test_comparison(self):
        mock = Mock()
        def comp(s, o):
            return True
        mock.__lt__ = mock.__gt__ = mock.__le__ = mock.__ge__ = comp
        self. assertTrue(mock < 3)
        self. assertTrue(mock > 3)
        self. assertTrue(mock <= 3)

            

Reported by Pylint.

Unused argument 'self'
Error

Line: 208 Column: 20

                          self.assertEqual(mock == object(), False)
            self.assertEqual(mock != object(), True)

            def eq(self, other):
                return other == 3
            mock.__eq__ = eq
            self.assertTrue(mock == 3)
            self.assertFalse(mock == 4)


            

Reported by Pylint.

Unused argument 'self'
Error

Line: 214 Column: 20

                          self.assertTrue(mock == 3)
            self.assertFalse(mock == 4)

            def ne(self, other):
                return other == 3
            mock.__ne__ = ne
            self.assertTrue(mock != 3)
            self.assertFalse(mock != 4)


            

Reported by Pylint.

Lib/importlib/metadata/__init__.py
92 issues
Unable to import '__init__._meta'
Error

Line: 18 Column: 1

              import collections

from . import _adapters, _meta
from ._meta import PackageMetadata
from ._collections import FreezableDefaultDict, Pair
from ._functools import method_cache
from ._itertools import unique_everseen
from ._meta import PackageMetadata, SimplePath


            

Reported by Pylint.

Unable to import '__init__._collections'
Error

Line: 19 Column: 1

              
from . import _adapters, _meta
from ._meta import PackageMetadata
from ._collections import FreezableDefaultDict, Pair
from ._functools import method_cache
from ._itertools import unique_everseen
from ._meta import PackageMetadata, SimplePath

from contextlib import suppress

            

Reported by Pylint.

Unable to import '__init__._functools'
Error

Line: 20 Column: 1

              from . import _adapters, _meta
from ._meta import PackageMetadata
from ._collections import FreezableDefaultDict, Pair
from ._functools import method_cache
from ._itertools import unique_everseen
from ._meta import PackageMetadata, SimplePath

from contextlib import suppress
from importlib import import_module

            

Reported by Pylint.

Unable to import '__init__._itertools'
Error

Line: 21 Column: 1

              from ._meta import PackageMetadata
from ._collections import FreezableDefaultDict, Pair
from ._functools import method_cache
from ._itertools import unique_everseen
from ._meta import PackageMetadata, SimplePath

from contextlib import suppress
from importlib import import_module
from importlib.abc import MetaPathFinder

            

Reported by Pylint.

Unable to import '__init__._meta'
Error

Line: 22 Column: 1

              from ._collections import FreezableDefaultDict, Pair
from ._functools import method_cache
from ._itertools import unique_everseen
from ._meta import PackageMetadata, SimplePath

from contextlib import suppress
from importlib import import_module
from importlib.abc import MetaPathFinder
from itertools import starmap

            

Reported by Pylint.

Argument 'stacklevel' passed by position and keyword in function call
Error

Line: 247 Column: 9

                  )

    def __setitem__(self, *args, **kwargs):
        self._warn()
        return super().__setitem__(*args, **kwargs)

    def __delitem__(self, *args, **kwargs):
        self._warn()
        return super().__delitem__(*args, **kwargs)

            

Reported by Pylint.

Argument 'stacklevel' passed by position and keyword in function call
Error

Line: 251 Column: 9

                      return super().__setitem__(*args, **kwargs)

    def __delitem__(self, *args, **kwargs):
        self._warn()
        return super().__delitem__(*args, **kwargs)

    def append(self, *args, **kwargs):
        self._warn()
        return super().append(*args, **kwargs)

            

Reported by Pylint.

Argument 'stacklevel' passed by position and keyword in function call
Error

Line: 255 Column: 9

                      return super().__delitem__(*args, **kwargs)

    def append(self, *args, **kwargs):
        self._warn()
        return super().append(*args, **kwargs)

    def reverse(self, *args, **kwargs):
        self._warn()
        return super().reverse(*args, **kwargs)

            

Reported by Pylint.

Argument 'stacklevel' passed by position and keyword in function call
Error

Line: 259 Column: 9

                      return super().append(*args, **kwargs)

    def reverse(self, *args, **kwargs):
        self._warn()
        return super().reverse(*args, **kwargs)

    def extend(self, *args, **kwargs):
        self._warn()
        return super().extend(*args, **kwargs)

            

Reported by Pylint.

Argument 'stacklevel' passed by position and keyword in function call
Error

Line: 263 Column: 9

                      return super().reverse(*args, **kwargs)

    def extend(self, *args, **kwargs):
        self._warn()
        return super().extend(*args, **kwargs)

    def pop(self, *args, **kwargs):
        self._warn()
        return super().pop(*args, **kwargs)

            

Reported by Pylint.

Lib/test/test_frame.py
92 issues
Class 'tb_frame' has no 'clear' member
Error

Line: 55 Column: 9

                      exc = self.outer(c=c)
        del c
        f = exc.__traceback__.tb_frame
        f.clear()
        self.assertIsNot(f.f_code, None)
        self.assertIsNot(f.f_locals, None)
        self.assertIsNot(f.f_builtins, None)
        self.assertIsNot(f.f_globals, None)


            

Reported by Pylint.

Class 'tb_frame' has no 'f_code' member
Error

Line: 56 Column: 26

                      del c
        f = exc.__traceback__.tb_frame
        f.clear()
        self.assertIsNot(f.f_code, None)
        self.assertIsNot(f.f_locals, None)
        self.assertIsNot(f.f_builtins, None)
        self.assertIsNot(f.f_globals, None)

    def test_clear_generator(self):

            

Reported by Pylint.

Class 'tb_frame' has no 'f_locals' member
Error

Line: 57 Column: 26

                      f = exc.__traceback__.tb_frame
        f.clear()
        self.assertIsNot(f.f_code, None)
        self.assertIsNot(f.f_locals, None)
        self.assertIsNot(f.f_builtins, None)
        self.assertIsNot(f.f_globals, None)

    def test_clear_generator(self):
        endly = False

            

Reported by Pylint.

Class 'tb_frame' has no 'f_builtins' member
Error

Line: 58 Column: 26

                      f.clear()
        self.assertIsNot(f.f_code, None)
        self.assertIsNot(f.f_locals, None)
        self.assertIsNot(f.f_builtins, None)
        self.assertIsNot(f.f_globals, None)

    def test_clear_generator(self):
        endly = False
        def g():

            

Reported by Pylint.

Class 'tb_frame' has no 'f_globals' member
Error

Line: 59 Column: 26

                      self.assertIsNot(f.f_code, None)
        self.assertIsNot(f.f_locals, None)
        self.assertIsNot(f.f_builtins, None)
        self.assertIsNot(f.f_globals, None)

    def test_clear_generator(self):
        endly = False
        def g():
            nonlocal endly

            

Reported by Pylint.

Class 'gi_frame' has no 'clear' member
Error

Line: 74 Column: 9

                      next(gen)
        self.assertFalse(endly)
        # Clearing the frame closes the generator
        gen.gi_frame.clear()
        self.assertTrue(endly)

    def test_clear_executing(self):
        # Attempting to clear an executing frame is forbidden.
        try:

            

Reported by Pylint.

Class 'tb_frame' has no 'clear' member
Error

Line: 84 Column: 13

                      except ZeroDivisionError as e:
            f = e.__traceback__.tb_frame
        with self.assertRaises(RuntimeError):
            f.clear()
        with self.assertRaises(RuntimeError):
            f.f_back.clear()

    def test_clear_executing_generator(self):
        # Attempting to clear an executing generator frame is forbidden.

            

Reported by Pylint.

Class 'tb_frame' has no 'f_back' member
Error

Line: 86 Column: 13

                      with self.assertRaises(RuntimeError):
            f.clear()
        with self.assertRaises(RuntimeError):
            f.f_back.clear()

    def test_clear_executing_generator(self):
        # Attempting to clear an executing generator frame is forbidden.
        endly = False
        def g():

            

Reported by Pylint.

Class 'tb_frame' has no 'clear' member
Error

Line: 98 Column: 21

                          except ZeroDivisionError as e:
                f = e.__traceback__.tb_frame
                with self.assertRaises(RuntimeError):
                    f.clear()
                with self.assertRaises(RuntimeError):
                    f.f_back.clear()
                yield f
            finally:
                endly = True

            

Reported by Pylint.

Class 'tb_frame' has no 'f_back' member
Error

Line: 100 Column: 21

                              with self.assertRaises(RuntimeError):
                    f.clear()
                with self.assertRaises(RuntimeError):
                    f.f_back.clear()
                yield f
            finally:
                endly = True
        gen = g()
        f = next(gen)

            

Reported by Pylint.

Lib/test/test_webbrowser.py
91 issues
Class 'Popen' has no 'call_args' member
Error

Line: 42 Column: 22

                      support.patch(self, subprocess, 'Popen', popen)
        browser = self.browser_class(name=CMD_NAME)
        getattr(browser, meth)(*args, **kw)
        popen_args = subprocess.Popen.call_args[0][0]
        self.assertEqual(popen_args[0], CMD_NAME)
        popen_args.pop(0)
        for option in options:
            self.assertIn(option, popen_args)
            popen_args.pop(popen_args.index(option))

            

Reported by Pylint.

Unused argument 'seconds'
Error

Line: 21 Column: 20

                  def poll(self):
        return 0

    def wait(self, seconds=None):
        return 0


class CommandTestMixin:


            

Reported by Pylint.

Dangerous default value {} as argument
Error

Line: 27 Column: 5

              
class CommandTestMixin:

    def _test(self, meth, *, args=[URL], kw={}, options, arguments):
        """Given a web browser instance method name along with arguments and
        keywords for same (which defaults to the single argument URL), creates
        a browser instance from the class pointed to by self.browser, calls the
        indicated instance method with the indicated arguments, and compares
        the resulting options and arguments passed to Popen by the browser

            

Reported by Pylint.

Dangerous default value [] as argument
Error

Line: 27 Column: 5

              
class CommandTestMixin:

    def _test(self, meth, *, args=[URL], kw={}, options, arguments):
        """Given a web browser instance method name along with arguments and
        keywords for same (which defaults to the single argument URL), creates
        a browser instance from the class pointed to by self.browser, calls the
        indicated instance method with the indicated arguments, and compares
        the resulting options and arguments passed to Popen by the browser

            

Reported by Pylint.

Access to a protected member _tryorder of a client class
Error

Line: 224 Column: 32

              
    def setUp(self):
        # Ensure we don't alter the real registered browser details
        self._saved_tryorder = webbrowser._tryorder
        webbrowser._tryorder = []
        self._saved_browsers = webbrowser._browsers
        webbrowser._browsers = {}

    def tearDown(self):

            

Reported by Pylint.

Access to a protected member _tryorder of a client class
Error

Line: 225 Column: 9

                  def setUp(self):
        # Ensure we don't alter the real registered browser details
        self._saved_tryorder = webbrowser._tryorder
        webbrowser._tryorder = []
        self._saved_browsers = webbrowser._browsers
        webbrowser._browsers = {}

    def tearDown(self):
        webbrowser._tryorder = self._saved_tryorder

            

Reported by Pylint.

Access to a protected member _browsers of a client class
Error

Line: 226 Column: 32

                      # Ensure we don't alter the real registered browser details
        self._saved_tryorder = webbrowser._tryorder
        webbrowser._tryorder = []
        self._saved_browsers = webbrowser._browsers
        webbrowser._browsers = {}

    def tearDown(self):
        webbrowser._tryorder = self._saved_tryorder
        webbrowser._browsers = self._saved_browsers

            

Reported by Pylint.

Access to a protected member _browsers of a client class
Error

Line: 227 Column: 9

                      self._saved_tryorder = webbrowser._tryorder
        webbrowser._tryorder = []
        self._saved_browsers = webbrowser._browsers
        webbrowser._browsers = {}

    def tearDown(self):
        webbrowser._tryorder = self._saved_tryorder
        webbrowser._browsers = self._saved_browsers


            

Reported by Pylint.

Access to a protected member _tryorder of a client class
Error

Line: 230 Column: 9

                      webbrowser._browsers = {}

    def tearDown(self):
        webbrowser._tryorder = self._saved_tryorder
        webbrowser._browsers = self._saved_browsers

    def _check_registration(self, preferred):
        class ExampleBrowser:
            pass

            

Reported by Pylint.

Access to a protected member _browsers of a client class
Error

Line: 231 Column: 9

              
    def tearDown(self):
        webbrowser._tryorder = self._saved_tryorder
        webbrowser._browsers = self._saved_browsers

    def _check_registration(self, preferred):
        class ExampleBrowser:
            pass


            

Reported by Pylint.

Lib/test/test_poplib.py
91 issues
The raise statement is not inside an except clause
Error

Line: 83 Column: 9

                          self.push('-ERR unrecognized POP3 command "%s".' %cmd)

    def handle_error(self):
        raise

    def push(self, data):
        asynchat.async_chat.push(self, data.encode("ISO-8859-1") + b'\r\n')

    def cmd_echo(self, arg):

            

Reported by Pylint.

The raise statement is not inside an except clause
Error

Line: 255 Column: 9

                      return 0

    def handle_error(self):
        raise


class TestPOP3Class(TestCase):
    def assertOK(self, resp):
        self.assertTrue(resp.startswith(b"+OK"))

            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 102 Column: 24

                          self.push("-ERR wrong password")
        self.push('+OK 10 messages')

    def cmd_stat(self, arg):
        self.push('+OK 10 100')

    def cmd_list(self, arg):
        if arg:
            self.push('+OK %s %s' % (arg, arg))

            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 114 Column: 24

              
    cmd_uidl = cmd_list

    def cmd_retr(self, arg):
        self.push('+OK %s bytes' %len(RETR_RESP))
        asynchat.async_chat.push(self, RETR_RESP)

    cmd_top = cmd_retr


            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 120 Column: 24

              
    cmd_top = cmd_retr

    def cmd_dele(self, arg):
        self.push('+OK message marked for deletion.')

    def cmd_noop(self, arg):
        self.push('+OK done nothing.')


            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 123 Column: 24

                  def cmd_dele(self, arg):
        self.push('+OK message marked for deletion.')

    def cmd_noop(self, arg):
        self.push('+OK done nothing.')

    def cmd_rpop(self, arg):
        self.push('+OK done nothing.')


            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 126 Column: 24

                  def cmd_noop(self, arg):
        self.push('+OK done nothing.')

    def cmd_rpop(self, arg):
        self.push('+OK done nothing.')

    def cmd_apop(self, arg):
        self.push('+OK done nothing.')


            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 129 Column: 24

                  def cmd_rpop(self, arg):
        self.push('+OK done nothing.')

    def cmd_apop(self, arg):
        self.push('+OK done nothing.')

    def cmd_quit(self, arg):
        self.push('+OK closing.')
        self.close_when_done()

            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 132 Column: 24

                  def cmd_apop(self, arg):
        self.push('+OK done nothing.')

    def cmd_quit(self, arg):
        self.push('+OK closing.')
        self.close_when_done()

    def _get_capas(self):
        _capas = dict(self.CAPAS)

            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 142 Column: 24

                          _capas['STLS'] = []
        return _capas

    def cmd_capa(self, arg):
        self.push('+OK Capability list follows')
        if self._get_capas():
            for cap, params in self._get_capas().items():
                _ln = [cap]
                if params:

            

Reported by Pylint.

Lib/asyncio/proactor_events.py
91 issues
Attempted relative import beyond top-level package
Error

Line: 17 Column: 1

              import threading
import collections

from . import base_events
from . import constants
from . import futures
from . import exceptions
from . import protocols
from . import sslproto

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 18 Column: 1

              import collections

from . import base_events
from . import constants
from . import futures
from . import exceptions
from . import protocols
from . import sslproto
from . import transports

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 19 Column: 1

              
from . import base_events
from . import constants
from . import futures
from . import exceptions
from . import protocols
from . import sslproto
from . import transports
from . import trsock

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 20 Column: 1

              from . import base_events
from . import constants
from . import futures
from . import exceptions
from . import protocols
from . import sslproto
from . import transports
from . import trsock
from .log import logger

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 21 Column: 1

              from . import constants
from . import futures
from . import exceptions
from . import protocols
from . import sslproto
from . import transports
from . import trsock
from .log import logger


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 22 Column: 1

              from . import futures
from . import exceptions
from . import protocols
from . import sslproto
from . import transports
from . import trsock
from .log import logger



            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 23 Column: 1

              from . import exceptions
from . import protocols
from . import sslproto
from . import transports
from . import trsock
from .log import logger


def _set_socket_extra(transport, sock):

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 24 Column: 1

              from . import protocols
from . import sslproto
from . import transports
from . import trsock
from .log import logger


def _set_socket_extra(transport, sock):
    transport._extra['socket'] = trsock.TransportSocket(sock)

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 25 Column: 1

              from . import sslproto
from . import transports
from . import trsock
from .log import logger


def _set_socket_extra(transport, sock):
    transport._extra['socket'] = trsock.TransportSocket(sock)


            

Reported by Pylint.

Instance of 'BaseProactorEventLoop' has no '_internal_fds' member
Error

Line: 758 Column: 9

                      self._ssock = None
        self._csock.close()
        self._csock = None
        self._internal_fds -= 1

    def _make_self_pipe(self):
        # A self-socket, really. :-)
        self._ssock, self._csock = socket.socketpair()
        self._ssock.setblocking(False)

            

Reported by Pylint.

Lib/ctypes/test/test_buffers.py
91 issues
Unused import LittleEndianStructure from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest

class StringBufferTestCase(unittest.TestCase):

    def test_buffer(self):
        b = create_string_buffer(32)
        self.assertEqual(len(b), 32)

            

Reported by Pylint.

Unused import set_last_error from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest

class StringBufferTestCase(unittest.TestCase):

    def test_buffer(self):
        b = create_string_buffer(32)
        self.assertEqual(len(b), 32)

            

Reported by Pylint.

Unused import get_last_error from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest

class StringBufferTestCase(unittest.TestCase):

    def test_buffer(self):
        b = create_string_buffer(32)
        self.assertEqual(len(b), 32)

            

Reported by Pylint.

Unused import pointer from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest

class StringBufferTestCase(unittest.TestCase):

    def test_buffer(self):
        b = create_string_buffer(32)
        self.assertEqual(len(b), 32)

            

Reported by Pylint.

Unused import POINTER from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest

class StringBufferTestCase(unittest.TestCase):

    def test_buffer(self):
        b = create_string_buffer(32)
        self.assertEqual(len(b), 32)

            

Reported by Pylint.

Unused import set_errno from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest

class StringBufferTestCase(unittest.TestCase):

    def test_buffer(self):
        b = create_string_buffer(32)
        self.assertEqual(len(b), 32)

            

Reported by Pylint.

Unused import get_errno from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest

class StringBufferTestCase(unittest.TestCase):

    def test_buffer(self):
        b = create_string_buffer(32)
        self.assertEqual(len(b), 32)

            

Reported by Pylint.

Unused import resize from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest

class StringBufferTestCase(unittest.TestCase):

    def test_buffer(self):
        b = create_string_buffer(32)
        self.assertEqual(len(b), 32)

            

Reported by Pylint.

Unused import alignment from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest

class StringBufferTestCase(unittest.TestCase):

    def test_buffer(self):
        b = create_string_buffer(32)
        self.assertEqual(len(b), 32)

            

Reported by Pylint.

Unused import addressof from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest

class StringBufferTestCase(unittest.TestCase):

    def test_buffer(self):
        b = create_string_buffer(32)
        self.assertEqual(len(b), 32)

            

Reported by Pylint.

Lib/idlelib/idle_test/test_query.py
91 issues
Attribute 'askfilename' defined outside __init__
Error

Line: 193 Column: 17

                              ('htest', lambda a,b,c: __file__, __file__)):
            with self.subTest():
                dialog.pathvar.set(path)
                dialog.askfilename = func
                dialog.browse_file()
                self.assertEqual(dialog.pathvar.get(), result)


class HelpsourcePathokTest(unittest.TestCase):

            

Reported by Pylint.

Unused argument 'widget'
Error

Line: 206 Column: 38

                      def __init__(self, dummy_path):
            self.path = Var(value=dummy_path)
            self.path_error = {'text': ''}
        def showerror(self, message, widget=None):
            self.path_error['text'] = message

    orig_platform = query.platform  # Set in test_path_ok_file.
    @classmethod
    def tearDownClass(cls):

            

Reported by Pylint.

Unused variable 'Equal'
Error

Line: 226 Column: 9

              
    def test_path_ok_web(self):
        dialog = self.Dummy_HelpSource('')
        Equal = self.assertEqual
        for url in 'www.py.org', 'http://py.org':
            with self.subTest():
                dialog.path.set(url)
                self.assertEqual(dialog.path_ok(), url)
                self.assertEqual(dialog.path_error['text'], '')

            

Reported by Pylint.

Attribute 'name' defined outside __init__
Error

Line: 262 Column: 17

                                                 ('doc', None, None),
                                   ('doc', 'doc.txt', ('doc', 'doc.txt'))):
            with self.subTest():
                dialog.name, dialog.path = name, path
                self.assertEqual(dialog.entry_ok(), result)


# 2 CustomRun test classes each test one method.


            

Reported by Pylint.

Attribute 'path' defined outside __init__
Error

Line: 262 Column: 30

                                                 ('doc', None, None),
                                   ('doc', 'doc.txt', ('doc', 'doc.txt'))):
            with self.subTest():
                dialog.name, dialog.path = name, path
                self.assertEqual(dialog.entry_ok(), result)


# 2 CustomRun test classes each test one method.


            

Reported by Pylint.

Attribute 'cli_args' defined outside __init__
Error

Line: 312 Column: 21

                          for cli_args, result in ((None, None),
                                     (['my arg'], (['my arg'], restart))):
                with self.subTest(restart=restart, cli_args=cli_args):
                    dialog.cli_args = cli_args
                    self.assertEqual(dialog.entry_ok(), result)


# GUI TESTS


            

Reported by Pylint.

Unused variable 'Equal'
Error

Line: 371 Column: 9

                      root = Tk()
        root.withdraw()
        dialog =  query.SectionName(root, 'T', 't', {'abc'}, _utest=True)
        Equal = self.assertEqual
        self.assertEqual(dialog.used_names, {'abc'})
        dialog.entry.insert(0, 'okay')
        dialog.button_ok.invoke()
        self.assertEqual(dialog.result, 'okay')
        root.destroy()

            

Reported by Pylint.

standard import "import unittest" should be placed before "from idlelib import query"
Error

Line: 13 Column: 1

              HelpSource htests.  These are run by running query.py.
"""
from idlelib import query
import unittest
from test.support import requires
from tkinter import Tk, END

import sys
from unittest import mock

            

Reported by Pylint.

standard import "from test.support import requires" should be placed before "from idlelib import query"
Error

Line: 14 Column: 1

              """
from idlelib import query
import unittest
from test.support import requires
from tkinter import Tk, END

import sys
from unittest import mock
from idlelib.idle_test.mock_tk import Var

            

Reported by Pylint.

standard import "from tkinter import Tk, END" should be placed before "from idlelib import query"
Error

Line: 15 Column: 1

              from idlelib import query
import unittest
from test.support import requires
from tkinter import Tk, END

import sys
from unittest import mock
from idlelib.idle_test.mock_tk import Var


            

Reported by Pylint.

Lib/test/test_gdb.py
90 issues
Consider explicitly re-raising using the 'from' keyword
Error

Line: 35 Column: 9

                  except OSError:
        # This is what "no gdb" looks like.  There may, however, be other
        # errors that manifest this way too.
        raise unittest.SkipTest("Couldn't find gdb on the path")

    # Regex to parse:
    # 'GNU gdb (GDB; SUSE Linux Enterprise 12) 7.7\n' -> 7.7
    # 'GNU gdb (GDB) Fedora 7.9.1-17.fc22\n' -> 7.9
    # 'GNU gdb 6.1.1 [FreeBSD]\n' -> 6.1

            

Reported by Pylint.

Redefining built-in 'breakpoint'
Error

Line: 146 Column: 25

                  """Test that the debugger can debug Python."""

    def get_stack_trace(self, source=None, script=None,
                        breakpoint=BREAKPOINT_FN,
                        cmds_after_breakpoint=None,
                        import_site=False):
        '''
        Run 'python -c SOURCE' under gdb with a breakpoint.


            

Reported by Pylint.

Access to a protected member _args_from_interpreter_flags of a client class
Error

Line: 213 Column: 21

                      args = ['--eval-command=%s' % cmd for cmd in commands]
        args += ["--args",
                 sys.executable]
        args.extend(subprocess._args_from_interpreter_flags())

        if not import_site:
            # -S suppresses the default 'import site'
            args += ["-S"]


            

Reported by Pylint.

Unused variable 'gdb_output'
Error

Line: 418 Column: 19

              
        # Ensure that we handle sets containing the "dummy" key value,
        # which happens on deletion:
        gdb_repr, gdb_output = self.get_gdb_repr('''s = set(['a','b'])
s.remove('a')
id(s)''')
        self.assertEqual(gdb_repr, "{'b'}")

    def test_frozensets(self):

            

Reported by Pylint.

Unused variable 'gdb_output'
Error

Line: 436 Column: 19

              
    def test_exceptions(self):
        # Test a RuntimeError
        gdb_repr, gdb_output = self.get_gdb_repr('''
try:
    raise RuntimeError("I am an error")
except RuntimeError as e:
    id(e)
''')

            

Reported by Pylint.

Unused variable 'gdb_output'
Error

Line: 458 Column: 19

              
    def test_modern_class(self):
        'Verify the pretty-printing of new-style class instances'
        gdb_repr, gdb_output = self.get_gdb_repr('''
class Foo:
    pass
foo = Foo()
foo.an_int = 42
id(foo)''')

            

Reported by Pylint.

Unused variable 'gdb_output'
Error

Line: 470 Column: 19

              
    def test_subclassing_list(self):
        'Verify the pretty-printing of an instance of a list subclass'
        gdb_repr, gdb_output = self.get_gdb_repr('''
class Foo(list):
    pass
foo = Foo()
foo += [1, 2, 3]
foo.an_int = 42

            

Reported by Pylint.

Unused variable 'gdb_output'
Error

Line: 486 Column: 19

                      'Verify the pretty-printing of an instance of a tuple subclass'
        # This should exercise the negative tp_dictoffset code in the
        # new-style class support
        gdb_repr, gdb_output = self.get_gdb_repr('''
class Foo(tuple):
    pass
foo = Foo((1, 2, 3))
foo.an_int = 42
id(foo)''')

            

Reported by Pylint.

Unused variable 'gdb_output'
Error

Line: 528 Column: 19

              
    def test_NULL_ptr(self):
        'Ensure that a NULL PyObject* is handled gracefully'
        gdb_repr, gdb_output = (
            self.get_gdb_repr('id(42)',
                              cmds_after_breakpoint=['set variable v=0',
                                                     'backtrace'])
            )


            

Reported by Pylint.

Unused variable 'gdb_output'
Error

Line: 567 Column: 19

              
        # (this was the issue causing tracebacks in
        #  http://bugs.python.org/issue8032#msg100537 )
        gdb_repr, gdb_output = self.get_gdb_repr('id(__builtins__.help)', import_site=True)

        m = re.match(r'<_Helper\(\) at remote 0x-?[0-9a-f]+>', gdb_repr)
        self.assertTrue(m,
                        msg='Unexpected rendering %r' % gdb_repr)


            

Reported by Pylint.

Lib/email/headerregistry.py
90 issues
Class 'BaseHeader' has no 'parse' member
Error

Line: 192 Column: 9

              
    def __new__(cls, name, value):
        kwds = {'defects': []}
        cls.parse(value, kwds)
        if utils._has_surrogates(kwds['decoded']):
            kwds['decoded'] = utils._sanitize(kwds['decoded'])
        self = str.__new__(cls, kwds['decoded'])
        del kwds['decoded']
        self.init(name, **kwds)

            

Reported by Pylint.

Super of 'DateHeader' has no 'init' member
Error

Line: 315 Column: 9

              
    def init(self, *args, **kw):
        self._datetime = kw.pop('datetime')
        super().init(*args, **kw)

    @property
    def datetime(self):
        return self._datetime


            

Reported by Pylint.

Super of 'AddressHeader' has no 'init' member
Error

Line: 368 Column: 9

                  def init(self, *args, **kw):
        self._groups = tuple(kw.pop('groups'))
        self._addresses = None
        super().init(*args, **kw)

    @property
    def groups(self):
        return self._groups


            

Reported by Pylint.

Instance of 'SingleAddressHeader' has no 'name' member
Error

Line: 393 Column: 44

                  def address(self):
        if len(self.addresses)!=1:
            raise ValueError(("value of single address header {} is not "
                "a single address").format(self.name))
        return self.addresses[0]


class UniqueSingleAddressHeader(SingleAddressHeader):


            

Reported by Pylint.

Super of 'MIMEVersionHeader' has no 'init' member
Error

Line: 424 Column: 9

                      self._version = kw.pop('version')
        self._major = kw.pop('major')
        self._minor = kw.pop('minor')
        super().init(*args, **kw)

    @property
    def major(self):
        return self._major


            

Reported by Pylint.

Class 'ParameterizedMIMEHeader' has no 'value_parser' member
Error

Line: 448 Column: 43

              
    @classmethod
    def parse(cls, value, kwds):
        kwds['parse_tree'] = parse_tree = cls.value_parser(value)
        kwds['decoded'] = str(parse_tree)
        kwds['defects'].extend(parse_tree.all_defects)
        if parse_tree.params is None:
            kwds['params'] = {}
        else:

            

Reported by Pylint.

Super of 'ParameterizedMIMEHeader' has no 'init' member
Error

Line: 461 Column: 9

              
    def init(self, *args, **kw):
        self._params = kw.pop('params')
        super().init(*args, **kw)

    @property
    def params(self):
        return MappingProxyType(self._params)


            

Reported by Pylint.

Instance of 'ContentTypeHeader' has no '_parse_tree' member
Error

Line: 474 Column: 42

              
    def init(self, *args, **kw):
        super().init(*args, **kw)
        self._maintype = utils._sanitize(self._parse_tree.maintype)
        self._subtype = utils._sanitize(self._parse_tree.subtype)

    @property
    def maintype(self):
        return self._maintype

            

Reported by Pylint.

Instance of 'ContentTypeHeader' has no '_parse_tree' member
Error

Line: 475 Column: 41

                  def init(self, *args, **kw):
        super().init(*args, **kw)
        self._maintype = utils._sanitize(self._parse_tree.maintype)
        self._subtype = utils._sanitize(self._parse_tree.subtype)

    @property
    def maintype(self):
        return self._maintype


            

Reported by Pylint.

Instance of 'ContentDispositionHeader' has no '_parse_tree' member
Error

Line: 496 Column: 14

              
    def init(self, *args, **kw):
        super().init(*args, **kw)
        cd = self._parse_tree.content_disposition
        self._content_disposition = cd if cd is None else utils._sanitize(cd)

    @property
    def content_disposition(self):
        return self._content_disposition

            

Reported by Pylint.