The following issues were found

Lib/asyncio/__init__.py
33 issues
Unable to import '__init__.base_events'
Error

Line: 8 Column: 1

              import sys

# This relies on each of the submodules having an __all__ variable.
from .base_events import *
from .coroutines import *
from .events import *
from .exceptions import *
from .futures import *
from .locks import *

            

Reported by Pylint.

Unable to import '__init__.coroutines'
Error

Line: 9 Column: 1

              
# This relies on each of the submodules having an __all__ variable.
from .base_events import *
from .coroutines import *
from .events import *
from .exceptions import *
from .futures import *
from .locks import *
from .protocols import *

            

Reported by Pylint.

Unable to import '__init__.events'
Error

Line: 10 Column: 1

              # This relies on each of the submodules having an __all__ variable.
from .base_events import *
from .coroutines import *
from .events import *
from .exceptions import *
from .futures import *
from .locks import *
from .protocols import *
from .runners import *

            

Reported by Pylint.

Unable to import '__init__.exceptions'
Error

Line: 11 Column: 1

              from .base_events import *
from .coroutines import *
from .events import *
from .exceptions import *
from .futures import *
from .locks import *
from .protocols import *
from .runners import *
from .queues import *

            

Reported by Pylint.

Unable to import '__init__.futures'
Error

Line: 12 Column: 1

              from .coroutines import *
from .events import *
from .exceptions import *
from .futures import *
from .locks import *
from .protocols import *
from .runners import *
from .queues import *
from .streams import *

            

Reported by Pylint.

Unable to import '__init__.locks'
Error

Line: 13 Column: 1

              from .events import *
from .exceptions import *
from .futures import *
from .locks import *
from .protocols import *
from .runners import *
from .queues import *
from .streams import *
from .subprocess import *

            

Reported by Pylint.

Unable to import '__init__.protocols'
Error

Line: 14 Column: 1

              from .exceptions import *
from .futures import *
from .locks import *
from .protocols import *
from .runners import *
from .queues import *
from .streams import *
from .subprocess import *
from .tasks import *

            

Reported by Pylint.

Unable to import '__init__.runners'
Error

Line: 15 Column: 1

              from .futures import *
from .locks import *
from .protocols import *
from .runners import *
from .queues import *
from .streams import *
from .subprocess import *
from .tasks import *
from .threads import *

            

Reported by Pylint.

Unable to import '__init__.queues'
Error

Line: 16 Column: 1

              from .locks import *
from .protocols import *
from .runners import *
from .queues import *
from .streams import *
from .subprocess import *
from .tasks import *
from .threads import *
from .transports import *

            

Reported by Pylint.

Unable to import '__init__.streams'
Error

Line: 17 Column: 1

              from .protocols import *
from .runners import *
from .queues import *
from .streams import *
from .subprocess import *
from .tasks import *
from .threads import *
from .transports import *


            

Reported by Pylint.

Lib/idlelib/stackviewer.py
33 issues
Global variable 'node' undefined at the module level
Error

Line: 11 Column: 5

              from idlelib.tree import TreeNode, TreeItem, ScrolledCanvas

def StackBrowser(root, flist=None, tb=None, top=None):
    global sc, item, node  # For testing.
    if top is None:
        top = tk.Toplevel(root)
    sc = ScrolledCanvas(top, bg="white", highlightthickness=0)
    sc.frame.pack(expand=1, fill="both")
    item = StackTreeItem(flist, tb)

            

Reported by Pylint.

Global variable 'sc' undefined at the module level
Error

Line: 11 Column: 5

              from idlelib.tree import TreeNode, TreeItem, ScrolledCanvas

def StackBrowser(root, flist=None, tb=None, top=None):
    global sc, item, node  # For testing.
    if top is None:
        top = tk.Toplevel(root)
    sc = ScrolledCanvas(top, bg="white", highlightthickness=0)
    sc.frame.pack(expand=1, fill="both")
    item = StackTreeItem(flist, tb)

            

Reported by Pylint.

Global variable 'item' undefined at the module level
Error

Line: 11 Column: 5

              from idlelib.tree import TreeNode, TreeItem, ScrolledCanvas

def StackBrowser(root, flist=None, tb=None, top=None):
    global sc, item, node  # For testing.
    if top is None:
        top = tk.Toplevel(root)
    sc = ScrolledCanvas(top, bg="white", highlightthickness=0)
    sc.frame.pack(expand=1, fill="both")
    item = StackTreeItem(flist, tb)

            

Reported by Pylint.

__init__ method from base class 'TreeItem' is not called
Error

Line: 23 Column: 5

              
class StackTreeItem(TreeItem):

    def __init__(self, flist=None, tb=None):
        self.flist = flist
        self.stack = self.get_stack(tb)
        self.text = self.get_exception()

    def get_stack(self, tb):

            

Reported by Pylint.

Redefining built-in 'type'
Error

Line: 40 Column: 9

                      return stack

    def get_exception(self):
        type = sys.last_type
        value = sys.last_value
        if hasattr(type, "__name__"):
            type = type.__name__
        s = str(type)
        if value is not None:

            

Reported by Pylint.

Redefining name 'item' from outer scope (line 16)
Error

Line: 55 Column: 13

                  def GetSubList(self):
        sublist = []
        for info in self.stack:
            item = FrameTreeItem(info, self.flist)
            sublist.append(item)
        return sublist


class FrameTreeItem(TreeItem):

            

Reported by Pylint.

__init__ method from base class 'TreeItem' is not called
Error

Line: 62 Column: 5

              
class FrameTreeItem(TreeItem):

    def __init__(self, info, flist):
        self.info = info
        self.flist = flist

    def GetText(self):
        frame, lineno = self.info

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 70 Column: 9

                      frame, lineno = self.info
        try:
            modname = frame.f_globals["__name__"]
        except:
            modname = "?"
        code = frame.f_code
        filename = code.co_filename
        funcname = code.co_name
        sourceline = linecache.getline(filename, lineno)

            

Reported by Pylint.

Redefining name 'item' from outer scope (line 16)
Error

Line: 78 Column: 13

                      sourceline = linecache.getline(filename, lineno)
        sourceline = sourceline.strip()
        if funcname in ("?", "", None):
            item = "%s, line %d: %s" % (modname, lineno, sourceline)
        else:
            item = "%s.%s(...), line %d: %s" % (modname, funcname,
                                             lineno, sourceline)
        return item


            

Reported by Pylint.

Unused variable 'lineno'
Error

Line: 85 Column: 16

                      return item

    def GetSubList(self):
        frame, lineno = self.info
        sublist = []
        if frame.f_globals is not frame.f_locals:
            item = VariablesTreeItem("<locals>", frame.f_locals, self.flist)
            sublist.append(item)
        item = VariablesTreeItem("<globals>", frame.f_globals, self.flist)

            

Reported by Pylint.

Lib/idlelib/idle_test/test_replace.py
33 issues
standard import "import unittest" should be placed before "from idlelib.replace import ReplaceDialog"
Error

Line: 4 Column: 1

              "Test replace, coverage 78%."

from idlelib.replace import ReplaceDialog
import unittest
from test.support import requires
requires('gui')
from tkinter import Tk, Text

from unittest.mock import Mock

            

Reported by Pylint.

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

Line: 5 Column: 1

              
from idlelib.replace import ReplaceDialog
import unittest
from test.support import requires
requires('gui')
from tkinter import Tk, Text

from unittest.mock import Mock
from idlelib.idle_test.mock_tk import Mbox

            

Reported by Pylint.

Import "from tkinter import Tk, Text" should be placed at the top of the module
Error

Line: 7 Column: 1

              import unittest
from test.support import requires
requires('gui')
from tkinter import Tk, Text

from unittest.mock import Mock
from idlelib.idle_test.mock_tk import Mbox
import idlelib.searchengine as se


            

Reported by Pylint.

standard import "from tkinter import Tk, Text" should be placed before "from idlelib.replace import ReplaceDialog"
Error

Line: 7 Column: 1

              import unittest
from test.support import requires
requires('gui')
from tkinter import Tk, Text

from unittest.mock import Mock
from idlelib.idle_test.mock_tk import Mbox
import idlelib.searchengine as se


            

Reported by Pylint.

standard import "from unittest.mock import Mock" should be placed before "from idlelib.replace import ReplaceDialog"
Error

Line: 9 Column: 1

              requires('gui')
from tkinter import Tk, Text

from unittest.mock import Mock
from idlelib.idle_test.mock_tk import Mbox
import idlelib.searchengine as se

orig_mbox = se.messagebox
showerror = Mbox.showerror

            

Reported by Pylint.

Import "from unittest.mock import Mock" should be placed at the top of the module
Error

Line: 9 Column: 1

              requires('gui')
from tkinter import Tk, Text

from unittest.mock import Mock
from idlelib.idle_test.mock_tk import Mbox
import idlelib.searchengine as se

orig_mbox = se.messagebox
showerror = Mbox.showerror

            

Reported by Pylint.

Import "from idlelib.idle_test.mock_tk import Mbox" should be placed at the top of the module
Error

Line: 10 Column: 1

              from tkinter import Tk, Text

from unittest.mock import Mock
from idlelib.idle_test.mock_tk import Mbox
import idlelib.searchengine as se

orig_mbox = se.messagebox
showerror = Mbox.showerror


            

Reported by Pylint.

Import "import idlelib.searchengine as se" should be placed at the top of the module
Error

Line: 11 Column: 1

              
from unittest.mock import Mock
from idlelib.idle_test.mock_tk import Mbox
import idlelib.searchengine as se

orig_mbox = se.messagebox
showerror = Mbox.showerror



            

Reported by Pylint.

Missing class docstring
Error

Line: 17 Column: 1

              showerror = Mbox.showerror


class ReplaceDialogTest(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.root = Tk()
        cls.root.withdraw()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 55 Column: 5

                      showerror.message = ''
        self.text.delete('1.0', 'end')

    def test_replace_simple(self):
        # Test replace function with all options at default setting.
        # Wrap around - True
        # Regular Expression - False
        # Match case - False
        # Match word - False

            

Reported by Pylint.

Lib/test/test_thread.py
33 issues
Unused variable 'i'
Error

Line: 64 Column: 17

                  def test_starting_threads(self):
        with threading_helper.wait_threads_exit():
            # Basic test for thread creation.
            for i in range(NUMTASKS):
                self.newtask()
            verbose_print("waiting for tasks to complete...")
            self.done_mutex.acquire()
            verbose_print("all tasks done")


            

Reported by Pylint.

Unused variable 'i'
Error

Line: 99 Column: 21

                          self.next_ident = 0
            self.created = 0
            with threading_helper.wait_threads_exit():
                for i in range(NUMTASKS):
                    self.newtask()

                verbose_print("waiting for all tasks to complete")
                self.done_mutex.acquire()
                verbose_print("all tasks done")

            

Reported by Pylint.

Access to a protected member _count of a client class
Error

Line: 110 Column: 16

              
    def test__count(self):
        # Test the _count() function.
        orig = thread._count()
        mut = thread.allocate_lock()
        mut.acquire()
        started = []

        def task():

            

Reported by Pylint.

Access to a protected member _count of a client class
Error

Line: 124 Column: 30

                          thread.start_new_thread(task, ())
            while not started:
                time.sleep(POLL_SLEEP)
            self.assertEqual(thread._count(), orig + 1)
            # Allow the task to finish.
            mut.release()
            # The only reliable way to be sure that the thread ended from the
            # interpreter's point of view is to wait for the function object to be
            # destroyed.

            

Reported by Pylint.

Unused variable 'wr'
Error

Line: 131 Column: 13

                          # interpreter's point of view is to wait for the function object to be
            # destroyed.
            done = []
            wr = weakref.ref(task, lambda _: done.append(None))
            del task
            while not done:
                time.sleep(POLL_SLEEP)
            self.assertEqual(thread._count(), orig)


            

Reported by Pylint.

Access to a protected member _count of a client class
Error

Line: 135 Column: 30

                          del task
            while not done:
                time.sleep(POLL_SLEEP)
            self.assertEqual(thread._count(), orig)

    def test_unraisable_exception(self):
        def task():
            started.release()
            raise ValueError("task failed")

            

Reported by Pylint.

Attribute 'bar' defined outside __init__
Error

Line: 185 Column: 13

              
    def test_barrier(self):
        with threading_helper.wait_threads_exit():
            self.bar = Barrier(NUMTASKS)
            self.running = NUMTASKS
            for i in range(NUMTASKS):
                thread.start_new_thread(self.task2, (i,))
            verbose_print("waiting for tasks to end")
            self.done_mutex.acquire()

            

Reported by Pylint.

Access to a protected member _exit of a client class
Error

Line: 245 Column: 17

                              os.close(read_fd)
                os.write(write_fd, b"OK")
            finally:
                os._exit(0)

        with threading_helper.wait_threads_exit():
            thread.start_new_thread(fork_thread, (self.read_fd, self.write_fd))
            self.assertEqual(os.read(self.read_fd, 2), b"OK")
            os.close(self.write_fd)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import os
import unittest
import random
from test import support
from test.support import threading_helper
import _thread as thread
import time
import weakref


            

Reported by Pylint.

Imports from package test are not grouped
Error

Line: 10 Column: 1

              import time
import weakref

from test import lock_tests

NUMTASKS = 10
NUMTRIPS = 3
POLL_SLEEP = 0.010 # seconds = 10 ms


            

Reported by Pylint.

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

Line: 154 Column: 1

                      The optional file argument directs where the traceback is
        sent; it defaults to sys.stderr.
        """
        import linecache, traceback
        if self.src is not None:
            linecache.cache[dummy_src_name] = (len(self.src),
                                               None,
                                               self.src.split("\n"),
                                               dummy_src_name)

            

Reported by Pylint.

function already defined line 318
Error

Line: 320 Column: 13

                      # determine number so that 0.2 <= total time < 2.0
        callback = None
        if verbose:
            def callback(number, time_taken):
                msg = "{num} loop{s} -> {secs:.{prec}g} secs"
                plural = (number != 1)
                print(msg.format(num=number, s='s' if plural else '',
                                  secs=time_taken, prec=precision))
        try:

            

Reported by Pylint.

Redefining built-in 'globals'
Error

Line: 103 Column: 18

                  """

    def __init__(self, stmt="pass", setup="pass", timer=default_timer,
                 globals=None):
        """Constructor.  See class doc string."""
        self.timer = timer
        local_ns = {}
        global_ns = _globals() if globals is None else globals
        init = ''

            

Reported by Pylint.

Use of exec detected.
Security

Line: 134
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html

                      src = template.format(stmt=stmt, setup=setup, init=init)
        self.src = src  # Save for traceback display
        code = compile(src, dummy_src_name, "exec")
        exec(code, global_ns, local_ns)
        self.inner = local_ns["inner"]

    def print_exc(self, file=None):
        """Helper to print a traceback from the timed code.


            

Reported by Bandit.

Use of exec
Error

Line: 134 Column: 9

                      src = template.format(stmt=stmt, setup=setup, init=init)
        self.src = src  # Save for traceback display
        code = compile(src, dummy_src_name, "exec")
        exec(code, global_ns, local_ns)
        self.inner = local_ns["inner"]

    def print_exc(self, file=None):
        """Helper to print a traceback from the timed code.


            

Reported by Pylint.

Redefining name 'repeat' from outer scope (line 236)
Error

Line: 184 Column: 22

                              gc.enable()
        return timing

    def repeat(self, repeat=default_repeat, number=default_number):
        """Call timeit() a few times.

        This is a convenience function that calls the timeit()
        repeatedly, returning a list of results.  The first argument
        specifies how many times to call timeit(), defaulting to 5;

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 205 Column: 13

                      vector and apply common sense rather than statistics.
        """
        r = []
        for i in range(repeat):
            t = self.timeit(number)
            r.append(t)
        return r

    def autorange(self, callback=None):

            

Reported by Pylint.

Redefining built-in 'globals'
Error

Line: 232 Column: 35

                          i *= 10

def timeit(stmt="pass", setup="pass", timer=default_timer,
           number=default_number, globals=None):
    """Convenience function to create Timer object and call timeit method."""
    return Timer(stmt, setup, timer, globals).timeit(number)

def repeat(stmt="pass", setup="pass", timer=default_timer,
           repeat=default_repeat, number=default_number, globals=None):

            

Reported by Pylint.

Redefining built-in 'globals'
Error

Line: 237 Column: 58

                  return Timer(stmt, setup, timer, globals).timeit(number)

def repeat(stmt="pass", setup="pass", timer=default_timer,
           repeat=default_repeat, number=default_number, globals=None):
    """Convenience function to create Timer object and call repeat method."""
    return Timer(stmt, setup, timer, globals).repeat(repeat, number)

def main(args=None, *, _wrap_timer=None):
    """Main program, used when run as a script.

            

Reported by Pylint.

Redefining name 'repeat' from outer scope (line 236)
Error

Line: 237 Column: 12

                  return Timer(stmt, setup, timer, globals).timeit(number)

def repeat(stmt="pass", setup="pass", timer=default_timer,
           repeat=default_repeat, number=default_number, globals=None):
    """Convenience function to create Timer object and call repeat method."""
    return Timer(stmt, setup, timer, globals).repeat(repeat, number)

def main(args=None, *, _wrap_timer=None):
    """Main program, used when run as a script.

            

Reported by Pylint.

Lib/test/test_tools/test_pindent.py
33 issues
Unused support imported from test
Error

Line: 8 Column: 1

              import unittest
import subprocess
import textwrap
from test import support
from test.support import os_helper
from test.support.script_helper import assert_python_ok

from test.test_tools import scriptsdir, skip_if_missing


            

Reported by Pylint.

Unused variable 'rc'
Error

Line: 45 Column: 13

                          with open(data_path, 'w') as f:
                f.write(closed)

            rc, out, err = assert_python_ok(self.script, '-d', data_path)
            self.assertEqual(out, b'')
            self.assertEqual(err, b'')
            backup = data_path + '~'
            self.assertTrue(os.path.exists(backup))
            with open(backup) as f:

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

Line: 6
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

              import os
import sys
import unittest
import subprocess
import textwrap
from test import support
from test.support import os_helper
from test.support.script_helper import assert_python_ok


            

Reported by Bandit.

Missing class docstring
Error

Line: 17 Column: 1

              skip_if_missing()


class PindentTests(unittest.TestCase):
    script = os.path.join(scriptsdir, 'pindent.py')

    def assertFileEqual(self, fn1, fn2):
        with open(fn1) as f1, open(fn2) as f2:
            self.assertEqual(f1.readlines(), f2.readlines())

            

Reported by Pylint.

Method name "assertFileEqual" doesn't conform to snake_case naming style
Error

Line: 20 Column: 5

              class PindentTests(unittest.TestCase):
    script = os.path.join(scriptsdir, 'pindent.py')

    def assertFileEqual(self, fn1, fn2):
        with open(fn1) as f1, open(fn2) as f2:
            self.assertEqual(f1.readlines(), f2.readlines())

    def pindent(self, source, *args):
        with subprocess.Popen(

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 20 Column: 5

              class PindentTests(unittest.TestCase):
    script = os.path.join(scriptsdir, 'pindent.py')

    def assertFileEqual(self, fn1, fn2):
        with open(fn1) as f1, open(fn2) as f2:
            self.assertEqual(f1.readlines(), f2.readlines())

    def pindent(self, source, *args):
        with subprocess.Popen(

            

Reported by Pylint.

Variable name "f1" doesn't conform to snake_case naming style
Error

Line: 21 Column: 27

                  script = os.path.join(scriptsdir, 'pindent.py')

    def assertFileEqual(self, fn1, fn2):
        with open(fn1) as f1, open(fn2) as f2:
            self.assertEqual(f1.readlines(), f2.readlines())

    def pindent(self, source, *args):
        with subprocess.Popen(
                (sys.executable, self.script) + args,

            

Reported by Pylint.

Variable name "f2" doesn't conform to snake_case naming style
Error

Line: 21 Column: 44

                  script = os.path.join(scriptsdir, 'pindent.py')

    def assertFileEqual(self, fn1, fn2):
        with open(fn1) as f1, open(fn2) as f2:
            self.assertEqual(f1.readlines(), f2.readlines())

    def pindent(self, source, *args):
        with subprocess.Popen(
                (sys.executable, self.script) + args,

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 24 Column: 5

                      with open(fn1) as f1, open(fn2) as f2:
            self.assertEqual(f1.readlines(), f2.readlines())

    def pindent(self, source, *args):
        with subprocess.Popen(
                (sys.executable, self.script) + args,
                stdin=subprocess.PIPE, stdout=subprocess.PIPE,
                universal_newlines=True) as proc:
            out, err = proc.communicate(source)

            

Reported by Pylint.

subprocess call - check for execution of untrusted input.
Security injection

Line: 25
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html

                          self.assertEqual(f1.readlines(), f2.readlines())

    def pindent(self, source, *args):
        with subprocess.Popen(
                (sys.executable, self.script) + args,
                stdin=subprocess.PIPE, stdout=subprocess.PIPE,
                universal_newlines=True) as proc:
            out, err = proc.communicate(source)
        self.assertIsNone(err)

            

Reported by Bandit.

Lib/test/test_contains.py
33 issues
Value 'a' doesn't support membership test
Error

Line: 27 Column: 51

                      self.assertNotIn(0, b)
        self.assertIn(1, c)
        self.assertNotIn(0, c)
        self.assertRaises(TypeError, lambda: 1 in a)
        self.assertRaises(TypeError, lambda: 1 not in a)

        # test char in string
        self.assertIn('c', 'abc')
        self.assertNotIn('d', 'abc')

            

Reported by Pylint.

Value 'a' doesn't support membership test
Error

Line: 28 Column: 55

                      self.assertIn(1, c)
        self.assertNotIn(0, c)
        self.assertRaises(TypeError, lambda: 1 in a)
        self.assertRaises(TypeError, lambda: 1 not in a)

        # test char in string
        self.assertIn('c', 'abc')
        self.assertNotIn('d', 'abc')


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from collections import deque
import unittest
from test.support import NEVER_EQ


class base_set:
    def __init__(self, el):
        self.el = el


            

Reported by Pylint.

Class name "base_set" doesn't conform to PascalCase naming style
Error

Line: 6 Column: 1

              from test.support import NEVER_EQ


class base_set:
    def __init__(self, el):
        self.el = el

class myset(base_set):
    def __contains__(self, el):

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 6 Column: 1

              from test.support import NEVER_EQ


class base_set:
    def __init__(self, el):
        self.el = el

class myset(base_set):
    def __contains__(self, el):

            

Reported by Pylint.

Missing class docstring
Error

Line: 6 Column: 1

              from test.support import NEVER_EQ


class base_set:
    def __init__(self, el):
        self.el = el

class myset(base_set):
    def __contains__(self, el):

            

Reported by Pylint.

Attribute name "el" doesn't conform to snake_case naming style
Error

Line: 8 Column: 9

              
class base_set:
    def __init__(self, el):
        self.el = el

class myset(base_set):
    def __contains__(self, el):
        return self.el == el


            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 10 Column: 1

                  def __init__(self, el):
        self.el = el

class myset(base_set):
    def __contains__(self, el):
        return self.el == el

class seq(base_set):
    def __getitem__(self, n):

            

Reported by Pylint.

Class name "myset" doesn't conform to PascalCase naming style
Error

Line: 10 Column: 1

                  def __init__(self, el):
        self.el = el

class myset(base_set):
    def __contains__(self, el):
        return self.el == el

class seq(base_set):
    def __getitem__(self, n):

            

Reported by Pylint.

Missing class docstring
Error

Line: 10 Column: 1

                  def __init__(self, el):
        self.el = el

class myset(base_set):
    def __contains__(self, el):
        return self.el == el

class seq(base_set):
    def __getitem__(self, n):

            

Reported by Pylint.

Lib/test/test_fcntl.py
33 issues
Redefining name 'lockdata' from outer scope (line 48)
Error

Line: 35 Column: 9

                      else:
            off_t = 'lxxxx'
            pid_t = 'l'
        lockdata = struct.pack(off_t + off_t + pid_t + 'hh', 0, 0, 0,
                               fcntl.F_WRLCK, 0)
    elif sys.platform.startswith('gnukfreebsd'):
        lockdata = struct.pack('qqihhi', 0, 0, 0, fcntl.F_WRLCK, 0, 0)
    elif sys.platform in ['hp-uxB', 'unixware7']:
        lockdata = struct.pack('hhlllii', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 19 Column: 1

              


def get_lockdata():
    try:
        os.O_LARGEFILE
    except AttributeError:
        start_len = "ll"
    else:

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 50 Column: 1

              
lockdata = get_lockdata()

class BadFile:
    def __init__(self, fn):
        self.fn = fn
    def fileno(self):
        return self.fn


            

Reported by Pylint.

Missing class docstring
Error

Line: 50 Column: 1

              
lockdata = get_lockdata()

class BadFile:
    def __init__(self, fn):
        self.fn = fn
    def fileno(self):
        return self.fn


            

Reported by Pylint.

Attribute name "fn" doesn't conform to snake_case naming style
Error

Line: 52 Column: 9

              
class BadFile:
    def __init__(self, fn):
        self.fn = fn
    def fileno(self):
        return self.fn

def try_lockf_on_other_process_fail(fname, cmd):
    f = open(fname, 'wb+')

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 53 Column: 5

              class BadFile:
    def __init__(self, fn):
        self.fn = fn
    def fileno(self):
        return self.fn

def try_lockf_on_other_process_fail(fname, cmd):
    f = open(fname, 'wb+')
    try:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 56 Column: 1

                  def fileno(self):
        return self.fn

def try_lockf_on_other_process_fail(fname, cmd):
    f = open(fname, 'wb+')
    try:
        fcntl.lockf(f, cmd)
    except BlockingIOError:
        pass

            

Reported by Pylint.

Variable name "f" doesn't conform to snake_case naming style
Error

Line: 57 Column: 5

                      return self.fn

def try_lockf_on_other_process_fail(fname, cmd):
    f = open(fname, 'wb+')
    try:
        fcntl.lockf(f, cmd)
    except BlockingIOError:
        pass
    finally:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 65 Column: 1

                  finally:
        f.close()

def try_lockf_on_other_process(fname, cmd):
    f = open(fname, 'wb+')
    fcntl.lockf(f, cmd)
    fcntl.lockf(f, fcntl.LOCK_UN)
    f.close()


            

Reported by Pylint.

Variable name "f" doesn't conform to snake_case naming style
Error

Line: 66 Column: 5

                      f.close()

def try_lockf_on_other_process(fname, cmd):
    f = open(fname, 'wb+')
    fcntl.lockf(f, cmd)
    fcntl.lockf(f, fcntl.LOCK_UN)
    f.close()

class TestFcntl(unittest.TestCase):

            

Reported by Pylint.

Lib/test/test_json/test_float.py
32 issues
Instance of 'TestFloat' has no 'assertEqual' member
Error

Line: 8 Column: 13

              class TestFloat:
    def test_floats(self):
        for num in [1617161771.7650001, math.pi, math.pi**100, math.pi**-100, 3.1]:
            self.assertEqual(float(self.dumps(num)), num)
            self.assertEqual(self.loads(self.dumps(num)), num)

    def test_ints(self):
        for num in [1, 1<<32, 1<<64]:
            self.assertEqual(self.dumps(num), str(num))

            

Reported by Pylint.

Instance of 'TestFloat' has no 'dumps' member
Error

Line: 8 Column: 36

              class TestFloat:
    def test_floats(self):
        for num in [1617161771.7650001, math.pi, math.pi**100, math.pi**-100, 3.1]:
            self.assertEqual(float(self.dumps(num)), num)
            self.assertEqual(self.loads(self.dumps(num)), num)

    def test_ints(self):
        for num in [1, 1<<32, 1<<64]:
            self.assertEqual(self.dumps(num), str(num))

            

Reported by Pylint.

Instance of 'TestFloat' has no 'loads' member
Error

Line: 9 Column: 30

                  def test_floats(self):
        for num in [1617161771.7650001, math.pi, math.pi**100, math.pi**-100, 3.1]:
            self.assertEqual(float(self.dumps(num)), num)
            self.assertEqual(self.loads(self.dumps(num)), num)

    def test_ints(self):
        for num in [1, 1<<32, 1<<64]:
            self.assertEqual(self.dumps(num), str(num))
            self.assertEqual(int(self.dumps(num)), num)

            

Reported by Pylint.

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

Line: 9 Column: 13

                  def test_floats(self):
        for num in [1617161771.7650001, math.pi, math.pi**100, math.pi**-100, 3.1]:
            self.assertEqual(float(self.dumps(num)), num)
            self.assertEqual(self.loads(self.dumps(num)), num)

    def test_ints(self):
        for num in [1, 1<<32, 1<<64]:
            self.assertEqual(self.dumps(num), str(num))
            self.assertEqual(int(self.dumps(num)), num)

            

Reported by Pylint.

Instance of 'TestFloat' has no 'dumps' member
Error

Line: 9 Column: 41

                  def test_floats(self):
        for num in [1617161771.7650001, math.pi, math.pi**100, math.pi**-100, 3.1]:
            self.assertEqual(float(self.dumps(num)), num)
            self.assertEqual(self.loads(self.dumps(num)), num)

    def test_ints(self):
        for num in [1, 1<<32, 1<<64]:
            self.assertEqual(self.dumps(num), str(num))
            self.assertEqual(int(self.dumps(num)), num)

            

Reported by Pylint.

Instance of 'TestFloat' has no 'dumps' member
Error

Line: 13 Column: 30

              
    def test_ints(self):
        for num in [1, 1<<32, 1<<64]:
            self.assertEqual(self.dumps(num), str(num))
            self.assertEqual(int(self.dumps(num)), num)

    def test_out_of_range(self):
        self.assertEqual(self.loads('[23456789012E666]'), [float('inf')])
        self.assertEqual(self.loads('[-23456789012E666]'), [float('-inf')])

            

Reported by Pylint.

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

Line: 13 Column: 13

              
    def test_ints(self):
        for num in [1, 1<<32, 1<<64]:
            self.assertEqual(self.dumps(num), str(num))
            self.assertEqual(int(self.dumps(num)), num)

    def test_out_of_range(self):
        self.assertEqual(self.loads('[23456789012E666]'), [float('inf')])
        self.assertEqual(self.loads('[-23456789012E666]'), [float('-inf')])

            

Reported by Pylint.

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

Line: 14 Column: 13

                  def test_ints(self):
        for num in [1, 1<<32, 1<<64]:
            self.assertEqual(self.dumps(num), str(num))
            self.assertEqual(int(self.dumps(num)), num)

    def test_out_of_range(self):
        self.assertEqual(self.loads('[23456789012E666]'), [float('inf')])
        self.assertEqual(self.loads('[-23456789012E666]'), [float('-inf')])


            

Reported by Pylint.

Instance of 'TestFloat' has no 'dumps' member
Error

Line: 14 Column: 34

                  def test_ints(self):
        for num in [1, 1<<32, 1<<64]:
            self.assertEqual(self.dumps(num), str(num))
            self.assertEqual(int(self.dumps(num)), num)

    def test_out_of_range(self):
        self.assertEqual(self.loads('[23456789012E666]'), [float('inf')])
        self.assertEqual(self.loads('[-23456789012E666]'), [float('-inf')])


            

Reported by Pylint.

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

Line: 17 Column: 9

                          self.assertEqual(int(self.dumps(num)), num)

    def test_out_of_range(self):
        self.assertEqual(self.loads('[23456789012E666]'), [float('inf')])
        self.assertEqual(self.loads('[-23456789012E666]'), [float('-inf')])

    def test_allow_nan(self):
        for val in (float('inf'), float('-inf'), float('nan')):
            out = self.dumps([val])

            

Reported by Pylint.

Lib/test/test_asyncio/test_transports.py
32 issues
Access to a protected member _extra of a client class
Error

Line: 14 Column: 26

              
    def test_ctor_extra_is_none(self):
        transport = asyncio.Transport()
        self.assertEqual(transport._extra, {})

    def test_get_extra_info(self):
        transport = asyncio.Transport({'extra': 'info'})
        self.assertEqual('info', transport.get_extra_info('extra'))
        self.assertIsNone(transport.get_extra_info('unknown'))

            

Reported by Pylint.

Method 'write_eof' is abstract in class 'WriteTransport' but is not overridden
Error

Line: 27 Column: 9

                  def test_writelines(self):
        writer = mock.Mock()

        class MyTransport(asyncio.Transport):
            def write(self, data):
                writer(data)

        transport = MyTransport()


            

Reported by Pylint.

Method 'set_write_buffer_limits' is abstract in class 'WriteTransport' but is not overridden
Error

Line: 27 Column: 9

                  def test_writelines(self):
        writer = mock.Mock()

        class MyTransport(asyncio.Transport):
            def write(self, data):
                writer(data)

        transport = MyTransport()


            

Reported by Pylint.

Method 'set_protocol' is abstract in class 'BaseTransport' but is not overridden
Error

Line: 27 Column: 9

                  def test_writelines(self):
        writer = mock.Mock()

        class MyTransport(asyncio.Transport):
            def write(self, data):
                writer(data)

        transport = MyTransport()


            

Reported by Pylint.

Method 'abort' is abstract in class 'WriteTransport' but is not overridden
Error

Line: 27 Column: 9

                  def test_writelines(self):
        writer = mock.Mock()

        class MyTransport(asyncio.Transport):
            def write(self, data):
                writer(data)

        transport = MyTransport()


            

Reported by Pylint.

Method 'can_write_eof' is abstract in class 'WriteTransport' but is not overridden
Error

Line: 27 Column: 9

                  def test_writelines(self):
        writer = mock.Mock()

        class MyTransport(asyncio.Transport):
            def write(self, data):
                writer(data)

        transport = MyTransport()


            

Reported by Pylint.

Method 'close' is abstract in class 'BaseTransport' but is not overridden
Error

Line: 27 Column: 9

                  def test_writelines(self):
        writer = mock.Mock()

        class MyTransport(asyncio.Transport):
            def write(self, data):
                writer(data)

        transport = MyTransport()


            

Reported by Pylint.

Method 'get_protocol' is abstract in class 'BaseTransport' but is not overridden
Error

Line: 27 Column: 9

                  def test_writelines(self):
        writer = mock.Mock()

        class MyTransport(asyncio.Transport):
            def write(self, data):
                writer(data)

        transport = MyTransport()


            

Reported by Pylint.

Method 'get_write_buffer_size' is abstract in class 'WriteTransport' but is not overridden
Error

Line: 27 Column: 9

                  def test_writelines(self):
        writer = mock.Mock()

        class MyTransport(asyncio.Transport):
            def write(self, data):
                writer(data)

        transport = MyTransport()


            

Reported by Pylint.

Method 'is_closing' is abstract in class 'BaseTransport' but is not overridden
Error

Line: 27 Column: 9

                  def test_writelines(self):
        writer = mock.Mock()

        class MyTransport(asyncio.Transport):
            def write(self, data):
                writer(data)

        transport = MyTransport()


            

Reported by Pylint.