The following issues were found

Tools/demo/eiffel.py
40 issues
Redefining built-in 'dict'
Error

Line: 14 Column: 36

              
class EiffelBaseMetaClass(type):

    def __new__(meta, name, bases, dict):
        meta.convert_methods(dict)
        return super(EiffelBaseMetaClass, meta).__new__(
            meta, name, bases, dict)

    @classmethod

            

Reported by Pylint.

Redefining built-in 'dict'
Error

Line: 20 Column: 30

                          meta, name, bases, dict)

    @classmethod
    def convert_methods(cls, dict):
        """Replace functions in dict with EiffelMethod wrappers.

        The dict is modified in place.

        If a method ends in _pre or _post, it is removed from the dict

            

Reported by Pylint.

Parameters differ from overridden 'm2_post' method
Error

Line: 130 Column: 13

                          def m2(self, arg):
                return arg**2

            def m2_post(self, Result, arg):
                super(Sub, self).m2_post(Result, arg)
                assert Result < 100

        t = Test()
        self.assertEqual(t.m(1), 2)

            

Reported by Pylint.

Missing class docstring
Error

Line: 12 Column: 1

              import unittest
from types import FunctionType as function

class EiffelBaseMetaClass(type):

    def __new__(meta, name, bases, dict):
        meta.convert_methods(dict)
        return super(EiffelBaseMetaClass, meta).__new__(
            meta, name, bases, dict)

            

Reported by Pylint.

Metaclass class method __new__ should have 'cls' as first argument
Error

Line: 14 Column: 5

              
class EiffelBaseMetaClass(type):

    def __new__(meta, name, bases, dict):
        meta.convert_methods(dict)
        return super(EiffelBaseMetaClass, meta).__new__(
            meta, name, bases, dict)

    @classmethod

            

Reported by Pylint.

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

Line: 30 Column: 16

                      """
        # find methods with pre or post conditions
        methods = []
        for k, v in dict.items():
            if k.endswith('_pre') or k.endswith('_post'):
                assert isinstance(v, function)
            elif isinstance(v, function):
                methods.append(k)
        for m in methods:

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 32
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                      methods = []
        for k, v in dict.items():
            if k.endswith('_pre') or k.endswith('_post'):
                assert isinstance(v, function)
            elif isinstance(v, function):
                methods.append(k)
        for m in methods:
            pre = dict.get("%s_pre" % m)
            post = dict.get("%s_post" % m)

            

Reported by Bandit.

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

Line: 35 Column: 13

                              assert isinstance(v, function)
            elif isinstance(v, function):
                methods.append(k)
        for m in methods:
            pre = dict.get("%s_pre" % m)
            post = dict.get("%s_post" % m)
            if pre or post:
                dict[m] = cls.make_eiffel_method(dict[m], pre, post)


            

Reported by Pylint.

Missing class docstring
Error

Line: 42 Column: 1

                              dict[m] = cls.make_eiffel_method(dict[m], pre, post)


class EiffelMetaClass1(EiffelBaseMetaClass):
    # an implementation of the "eiffel" meta class that uses nested functions

    @staticmethod
    def make_eiffel_method(func, pre, post):
        def method(self, *args, **kwargs):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 46 Column: 5

                  # an implementation of the "eiffel" meta class that uses nested functions

    @staticmethod
    def make_eiffel_method(func, pre, post):
        def method(self, *args, **kwargs):
            if pre:
                pre(self, *args, **kwargs)
            rv = func(self, *args, **kwargs)
            if post:

            

Reported by Pylint.

Lib/test/test_type_annotations.py
39 issues
Class 'Foo' has no '__annotations__' member
Error

Line: 12 Column: 17

                      foo = type("Foo", (), {})
        for i in range(3):
            self.assertFalse("__annotations__" in foo.__dict__)
            d = foo.__annotations__
            self.assertTrue("__annotations__" in foo.__dict__)
            self.assertEqual(foo.__annotations__, d)
            self.assertEqual(foo.__dict__['__annotations__'], d)
            del foo.__annotations__


            

Reported by Pylint.

Class 'Foo' has no '__annotations__' member
Error

Line: 14 Column: 30

                          self.assertFalse("__annotations__" in foo.__dict__)
            d = foo.__annotations__
            self.assertTrue("__annotations__" in foo.__dict__)
            self.assertEqual(foo.__annotations__, d)
            self.assertEqual(foo.__dict__['__annotations__'], d)
            del foo.__annotations__

    def test_setting_annotations(self):
        foo = type("Foo", (), {})

            

Reported by Pylint.

Class 'Foo' has no '__annotations__' member
Error

Line: 16 Column: 17

                          self.assertTrue("__annotations__" in foo.__dict__)
            self.assertEqual(foo.__annotations__, d)
            self.assertEqual(foo.__dict__['__annotations__'], d)
            del foo.__annotations__

    def test_setting_annotations(self):
        foo = type("Foo", (), {})
        for i in range(3):
            self.assertFalse("__annotations__" in foo.__dict__)

            

Reported by Pylint.

Class 'Foo' has no '__annotations__' member
Error

Line: 25 Column: 30

                          d = {'a': int}
            foo.__annotations__ = d
            self.assertTrue("__annotations__" in foo.__dict__)
            self.assertEqual(foo.__annotations__, d)
            self.assertEqual(foo.__dict__['__annotations__'], d)
            del foo.__annotations__

    def test_annotations_getset_raises(self):
        # builtin types don't have __annotations__ (yet!)

            

Reported by Pylint.

Class 'Foo' has no '__annotations__' member
Error

Line: 27 Column: 17

                          self.assertTrue("__annotations__" in foo.__dict__)
            self.assertEqual(foo.__annotations__, d)
            self.assertEqual(foo.__dict__['__annotations__'], d)
            del foo.__annotations__

    def test_annotations_getset_raises(self):
        # builtin types don't have __annotations__ (yet!)
        with self.assertRaises(AttributeError):
            print(float.__annotations__)

            

Reported by Pylint.

Class 'Foo' has no '__annotations__' member
Error

Line: 41 Column: 13

                      # double delete
        foo = type("Foo", (), {})
        foo.__annotations__ = {}
        del foo.__annotations__
        with self.assertRaises(AttributeError):
            del foo.__annotations__

    def test_annotations_are_created_correctly(self):
        class C:

            

Reported by Pylint.

Class 'Foo' has no '__annotations__' member
Error

Line: 43 Column: 17

                      foo.__annotations__ = {}
        del foo.__annotations__
        with self.assertRaises(AttributeError):
            del foo.__annotations__

    def test_annotations_are_created_correctly(self):
        class C:
            a:int=3
            b:str=4

            

Reported by Pylint.

Class 'C' has no '__annotations__' member
Error

Line: 50 Column: 13

                          a:int=3
            b:str=4
        self.assertTrue("__annotations__" in C.__dict__)
        del C.__annotations__
        self.assertFalse("__annotations__" in C.__dict__)

    def test_descriptor_still_works(self):
        class C:
            def __init__(self, name=None, bases=None, d=None):

            

Reported by Pylint.

Invalid metaclass 'C' used
Error

Line: 91 Column: 9

                      self.assertEqual(c.__annotations__, {})


        class D(metaclass=C):
            pass

        self.assertEqual(D.__annotations__, {})
        d = {'a':'int'}
        D.__annotations__ = d

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 10 Column: 13

                      # the annotations dict is stored in type.__dict__.
        # a freshly created type shouldn't have an annotations dict yet.
        foo = type("Foo", (), {})
        for i in range(3):
            self.assertFalse("__annotations__" in foo.__dict__)
            d = foo.__annotations__
            self.assertTrue("__annotations__" in foo.__dict__)
            self.assertEqual(foo.__annotations__, d)
            self.assertEqual(foo.__dict__['__annotations__'], d)

            

Reported by Pylint.

Tools/c-analyzer/c_parser/_state_machine.py
39 issues
Undefined variable 'ANON_IDENTIFIER'
Error

Line: 3 Column: 14

              
f'''
    struct {ANON_IDENTIFIER};
    struct {{ ... }}
    struct {IDENTIFIER} {{ ... }}

    union {ANON_IDENTIFIER};
    union {{ ... }}
    union {IDENTIFIER} {{ ... }}

            

Reported by Pylint.

Undefined variable 'ANON_IDENTIFIER'
Error

Line: 3 Column: 14

              
f'''
    struct {ANON_IDENTIFIER};
    struct {{ ... }}
    struct {IDENTIFIER} {{ ... }}

    union {ANON_IDENTIFIER};
    union {{ ... }}
    union {IDENTIFIER} {{ ... }}

            

Reported by Pylint.

Undefined variable 'ANON_IDENTIFIER'
Error

Line: 3 Column: 14

              
f'''
    struct {ANON_IDENTIFIER};
    struct {{ ... }}
    struct {IDENTIFIER} {{ ... }}

    union {ANON_IDENTIFIER};
    union {{ ... }}
    union {IDENTIFIER} {{ ... }}

            

Reported by Pylint.

Undefined variable 'IDENTIFIER'
Error

Line: 5 Column: 14

              f'''
    struct {ANON_IDENTIFIER};
    struct {{ ... }}
    struct {IDENTIFIER} {{ ... }}

    union {ANON_IDENTIFIER};
    union {{ ... }}
    union {IDENTIFIER} {{ ... }}


            

Reported by Pylint.

Undefined variable 'IDENTIFIER'
Error

Line: 5 Column: 14

              f'''
    struct {ANON_IDENTIFIER};
    struct {{ ... }}
    struct {IDENTIFIER} {{ ... }}

    union {ANON_IDENTIFIER};
    union {{ ... }}
    union {IDENTIFIER} {{ ... }}


            

Reported by Pylint.

Undefined variable 'IDENTIFIER'
Error

Line: 5 Column: 14

              f'''
    struct {ANON_IDENTIFIER};
    struct {{ ... }}
    struct {IDENTIFIER} {{ ... }}

    union {ANON_IDENTIFIER};
    union {{ ... }}
    union {IDENTIFIER} {{ ... }}


            

Reported by Pylint.

Undefined variable 'IDENTIFIER'
Error

Line: 5 Column: 14

              f'''
    struct {ANON_IDENTIFIER};
    struct {{ ... }}
    struct {IDENTIFIER} {{ ... }}

    union {ANON_IDENTIFIER};
    union {{ ... }}
    union {IDENTIFIER} {{ ... }}


            

Reported by Pylint.

Undefined variable 'IDENTIFIER'
Error

Line: 5 Column: 14

              f'''
    struct {ANON_IDENTIFIER};
    struct {{ ... }}
    struct {IDENTIFIER} {{ ... }}

    union {ANON_IDENTIFIER};
    union {{ ... }}
    union {IDENTIFIER} {{ ... }}


            

Reported by Pylint.

Undefined variable 'IDENTIFIER'
Error

Line: 5 Column: 14

              f'''
    struct {ANON_IDENTIFIER};
    struct {{ ... }}
    struct {IDENTIFIER} {{ ... }}

    union {ANON_IDENTIFIER};
    union {{ ... }}
    union {IDENTIFIER} {{ ... }}


            

Reported by Pylint.

Undefined variable 'IDENTIFIER'
Error

Line: 5 Column: 14

              f'''
    struct {ANON_IDENTIFIER};
    struct {{ ... }}
    struct {IDENTIFIER} {{ ... }}

    union {ANON_IDENTIFIER};
    union {{ ... }}
    union {IDENTIFIER} {{ ... }}


            

Reported by Pylint.

Lib/test/test_timeout.py
39 issues
Instance of 'TimeoutTestCase' has no 'sock' member
Error

Line: 128 Column: 9

                      The method is run at most `count` times and must raise a TimeoutError
        within `timeout` + self.fuzz seconds.
        """
        self.sock.settimeout(timeout)
        method = getattr(self.sock, method)
        for i in range(count):
            t1 = time.monotonic()
            try:
                method(*args)

            

Reported by Pylint.

Instance of 'TimeoutTestCase' has no 'sock' member
Error

Line: 129 Column: 26

                      within `timeout` + self.fuzz seconds.
        """
        self.sock.settimeout(timeout)
        method = getattr(self.sock, method)
        for i in range(count):
            t1 = time.monotonic()
            try:
                method(*args)
            except TimeoutError as e:

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 130 Column: 13

                      """
        self.sock.settimeout(timeout)
        method = getattr(self.sock, method)
        for i in range(count):
            t1 = time.monotonic()
            try:
                method(*args)
            except TimeoutError as e:
                delta = time.monotonic() - t1

            

Reported by Pylint.

Unused variable 'e'
Error

Line: 134 Column: 13

                          t1 = time.monotonic()
            try:
                method(*args)
            except TimeoutError as e:
                delta = time.monotonic() - t1
                break
        else:
            self.fail('TimeoutError was not raised')
        # These checks should account for timing unprecision

            

Reported by Pylint.

Import "import time" should be placed at the top of the module
Error

Line: 11 Column: 1

              # This requires the 'network' resource as given on the regrtest command line.
skip_expected = not support.is_resource_enabled('network')

import time
import errno
import socket


@functools.lru_cache()

            

Reported by Pylint.

Import "import errno" should be placed at the top of the module
Error

Line: 12 Column: 1

              skip_expected = not support.is_resource_enabled('network')

import time
import errno
import socket


@functools.lru_cache()
def resolve_address(host, port):

            

Reported by Pylint.

Import "import socket" should be placed at the top of the module
Error

Line: 13 Column: 1

              
import time
import errno
import socket


@functools.lru_cache()
def resolve_address(host, port):
    """Resolve an (host, port) to an address.

            

Reported by Pylint.

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

Line: 37 Column: 5

                  def tearDown(self):
        self.sock.close()

    def testObjectCreation(self):
        # Test Socket creation
        self.assertEqual(self.sock.gettimeout(), None,
                         "timeout not disabled by default")

    def testFloatReturnValue(self):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 37 Column: 5

                  def tearDown(self):
        self.sock.close()

    def testObjectCreation(self):
        # Test Socket creation
        self.assertEqual(self.sock.gettimeout(), None,
                         "timeout not disabled by default")

    def testFloatReturnValue(self):

            

Reported by Pylint.

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

Line: 42 Column: 5

                      self.assertEqual(self.sock.gettimeout(), None,
                         "timeout not disabled by default")

    def testFloatReturnValue(self):
        # Test return value of gettimeout()
        self.sock.settimeout(7.345)
        self.assertEqual(self.sock.gettimeout(), 7.345)

        self.sock.settimeout(3)

            

Reported by Pylint.

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

Line: 5 Column: 1

              
import io
import sys
import traceback

from . import util
from functools import wraps

__unittest = True

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 7 Column: 1

              import sys
import traceback

from . import util
from functools import wraps

__unittest = True

def failfast(method):

            

Reported by Pylint.

Unused argument 'descriptions'
Error

Line: 38 Column: 37

                  _previousTestClass = None
    _testRunEntered = False
    _moduleSetUpFailed = False
    def __init__(self, stream=None, descriptions=None, verbosity=None):
        self.failfast = False
        self.failures = []
        self.errors = []
        self.testsRun = 0
        self.skipped = []

            

Reported by Pylint.

Unused argument 'verbosity'
Error

Line: 38 Column: 56

                  _previousTestClass = None
    _testRunEntered = False
    _moduleSetUpFailed = False
    def __init__(self, stream=None, descriptions=None, verbosity=None):
        self.failfast = False
        self.failures = []
        self.errors = []
        self.testsRun = 0
        self.skipped = []

            

Reported by Pylint.

Unused argument 'stream'
Error

Line: 38 Column: 24

                  _previousTestClass = None
    _testRunEntered = False
    _moduleSetUpFailed = False
    def __init__(self, stream=None, descriptions=None, verbosity=None):
        self.failfast = False
        self.failures = []
        self.errors = []
        self.testsRun = 0
        self.skipped = []

            

Reported by Pylint.

Unused argument 'test'
Error

Line: 58 Column: 25

                  def printErrors(self):
        "Called by TestRunner after test run"

    def startTest(self, test):
        "Called when the given test is about to be run"
        self.testsRun += 1
        self._mirrorOutput = False
        self._setupStdout()


            

Reported by Pylint.

Unused argument 'test'
Error

Line: 78 Column: 24

                      See startTest for a method called before each test.
        """

    def stopTest(self, test):
        """Called when the given test has been run"""
        self._restoreStdout()
        self._mirrorOutput = False

    def _restoreStdout(self):

            

Reported by Pylint.

Unnecessary pass statement
Error

Line: 144 Column: 9

              
    def addSuccess(self, test):
        "Called when a test has completed successfully"
        pass

    def addSkip(self, test, reason):
        """Called when a test is skipped."""
        self.skipped.append((test, reason))


            

Reported by Pylint.

standard import "from functools import wraps" should be placed before "from . import util"
Error

Line: 8 Column: 1

              import traceback

from . import util
from functools import wraps

__unittest = True

def failfast(method):
    @wraps(method)

            

Reported by Pylint.

Constant name "__unittest" doesn't conform to UPPER_CASE naming style
Error

Line: 10 Column: 1

              from . import util
from functools import wraps

__unittest = True

def failfast(method):
    @wraps(method)
    def inner(self, *args, **kw):
        if getattr(self, 'failfast', False):

            

Reported by Pylint.

Lib/string.py
39 issues
Redefining built-in 'id'
Error

Line: 75 Column: 13

                          pattern = cls.pattern
        else:
            delim = _re.escape(cls.delimiter)
            id = cls.idpattern
            bid = cls.braceidpattern or cls.idpattern
            pattern = fr"""
            {delim}(?:
              (?P<escaped>{delim})  |   # Escape sequence of two delimiters
              (?P<named>{id})       |   # delimiter and a Python identifier

            

Reported by Pylint.

Dangerous default value _sentinel_dict (builtins.dict) as argument
Error

Line: 104 Column: 5

                      raise ValueError('Invalid placeholder in string: line %d, col %d' %
                         (lineno, colno))

    def substitute(self, mapping=_sentinel_dict, /, **kws):
        if mapping is _sentinel_dict:
            mapping = kws
        elif kws:
            mapping = _ChainMap(kws, mapping)
        # Helper function for .sub()

            

Reported by Pylint.

Dangerous default value _sentinel_dict (builtins.dict) as argument
Error

Line: 123 Column: 5

                                           self.pattern)
        return self.pattern.sub(convert, self.template)

    def safe_substitute(self, mapping=_sentinel_dict, /, **kws):
        if mapping is _sentinel_dict:
            mapping = kws
        elif kws:
            mapping = _ChainMap(kws, mapping)
        # Helper function for .sub()

            

Reported by Pylint.

Constant name "whitespace" doesn't conform to UPPER_CASE naming style
Error

Line: 24 Column: 1

              import _string

# Some strings for ctype-style character classification
whitespace = ' \t\n\r\v\f'
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_letters = ascii_lowercase + ascii_uppercase
digits = '0123456789'
hexdigits = digits + 'abcdef' + 'ABCDEF'

            

Reported by Pylint.

Constant name "ascii_lowercase" doesn't conform to UPPER_CASE naming style
Error

Line: 25 Column: 1

              
# Some strings for ctype-style character classification
whitespace = ' \t\n\r\v\f'
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_letters = ascii_lowercase + ascii_uppercase
digits = '0123456789'
hexdigits = digits + 'abcdef' + 'ABCDEF'
octdigits = '01234567'

            

Reported by Pylint.

Constant name "ascii_uppercase" doesn't conform to UPPER_CASE naming style
Error

Line: 26 Column: 1

              # Some strings for ctype-style character classification
whitespace = ' \t\n\r\v\f'
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_letters = ascii_lowercase + ascii_uppercase
digits = '0123456789'
hexdigits = digits + 'abcdef' + 'ABCDEF'
octdigits = '01234567'
punctuation = r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""

            

Reported by Pylint.

Constant name "ascii_letters" doesn't conform to UPPER_CASE naming style
Error

Line: 27 Column: 1

              whitespace = ' \t\n\r\v\f'
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_letters = ascii_lowercase + ascii_uppercase
digits = '0123456789'
hexdigits = digits + 'abcdef' + 'ABCDEF'
octdigits = '01234567'
punctuation = r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
printable = digits + ascii_letters + punctuation + whitespace

            

Reported by Pylint.

Constant name "digits" doesn't conform to UPPER_CASE naming style
Error

Line: 28 Column: 1

              ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_letters = ascii_lowercase + ascii_uppercase
digits = '0123456789'
hexdigits = digits + 'abcdef' + 'ABCDEF'
octdigits = '01234567'
punctuation = r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
printable = digits + ascii_letters + punctuation + whitespace


            

Reported by Pylint.

Constant name "hexdigits" doesn't conform to UPPER_CASE naming style
Error

Line: 29 Column: 1

              ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_letters = ascii_lowercase + ascii_uppercase
digits = '0123456789'
hexdigits = digits + 'abcdef' + 'ABCDEF'
octdigits = '01234567'
punctuation = r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
printable = digits + ascii_letters + punctuation + whitespace

# Functions which aren't available as string methods.

            

Reported by Pylint.

Constant name "octdigits" doesn't conform to UPPER_CASE naming style
Error

Line: 30 Column: 1

              ascii_letters = ascii_lowercase + ascii_uppercase
digits = '0123456789'
hexdigits = digits + 'abcdef' + 'ABCDEF'
octdigits = '01234567'
punctuation = r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
printable = digits + ascii_letters + punctuation + whitespace

# Functions which aren't available as string methods.


            

Reported by Pylint.

Lib/multiprocessing/dummy/__init__.py
39 issues
Unable to import '__init__.connection'
Error

Line: 25 Column: 1

              import weakref
import array

from .connection import Pipe
from threading import Lock, RLock, Semaphore, BoundedSemaphore
from threading import Event, Condition, Barrier
from queue import Queue

#

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 123 Column: 5

                  pass

def Pool(processes=None, initializer=None, initargs=()):
    from ..pool import ThreadPool
    return ThreadPool(processes, initializer, initargs)

JoinableQueue = Queue

            

Reported by Pylint.

Dangerous default value {} as argument
Error

Line: 36 Column: 5

              
class DummyProcess(threading.Thread):

    def __init__(self, group=None, target=None, name=None, args=(), kwargs={}):
        threading.Thread.__init__(self, group, target, name, args, kwargs)
        self._pid = None
        self._children = weakref.WeakKeyDictionary()
        self._start_called = False
        self._parent = current_process()

            

Reported by Pylint.

Access to a protected member _children of a client class
Error

Line: 50 Column: 13

                                  self._parent, current_process()))
        self._start_called = True
        if hasattr(self._parent, '_children'):
            self._parent._children[self] = None
        threading.Thread.start(self)

    @property
    def exitcode(self):
        if self._start_called and not self.is_alive():

            

Reported by Pylint.

Access to a protected member _children of a client class
Error

Line: 66 Column: 1

              
Process = DummyProcess
current_process = threading.current_thread
current_process()._children = weakref.WeakKeyDictionary()

def active_children():
    children = current_process()._children
    for p in list(children):
        if not p.is_alive():

            

Reported by Pylint.

Access to a protected member _children of a client class
Error

Line: 69 Column: 16

              current_process()._children = weakref.WeakKeyDictionary()

def active_children():
    children = current_process()._children
    for p in list(children):
        if not p.is_alive():
            children.pop(p, None)
    return list(children)


            

Reported by Pylint.

Redefining built-in 'dict'
Error

Line: 94 Column: 1

                      temp.sort()
        return '%s(%s)' % (self.__class__.__name__, ', '.join(temp))

dict = dict
list = list

def Array(typecode, sequence, lock=True):
    return array.array(typecode, sequence)


            

Reported by Pylint.

Assigning the same variable 'dict' to itself
Error

Line: 94 Column: 1

                      temp.sort()
        return '%s(%s)' % (self.__class__.__name__, ', '.join(temp))

dict = dict
list = list

def Array(typecode, sequence, lock=True):
    return array.array(typecode, sequence)


            

Reported by Pylint.

Assigning the same variable 'list' to itself
Error

Line: 95 Column: 1

                      return '%s(%s)' % (self.__class__.__name__, ', '.join(temp))

dict = dict
list = list

def Array(typecode, sequence, lock=True):
    return array.array(typecode, sequence)

class Value(object):

            

Reported by Pylint.

Redefining built-in 'list'
Error

Line: 95 Column: 1

                      return '%s(%s)' % (self.__class__.__name__, ', '.join(temp))

dict = dict
list = list

def Array(typecode, sequence, lock=True):
    return array.array(typecode, sequence)

class Value(object):

            

Reported by Pylint.

Lib/test/test_cmd.py
39 issues
Module 'test.support' has no 'import_module' member
Error

Line: 228 Column: 13

                  support.run_unittest(TestAlternateInput)

def test_coverage(coverdir):
    trace = support.import_module('trace')
    tracer=trace.Trace(ignoredirs=[sys.base_prefix, sys.base_exec_prefix,],
                        trace=0, count=1)
    tracer.run('import importlib; importlib.reload(cmd); test_main()')
    r=tracer.results()
    print("Writing coverage results...")

            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 167 Column: 23

                      print("help text for add")
        return

    def do_exit(self, arg):
        return True


class TestAlternateInput(unittest.TestCase):


            

Reported by Pylint.

Unused argument 'args'
Error

Line: 178 Column: 26

                      def do_print(self, args):
            print(args, file=self.stdout)

        def do_EOF(self, args):
            return True


    class simplecmd2(simplecmd):


            

Reported by Pylint.

Redefining built-in 'input'
Error

Line: 190 Column: 9

              

    def test_file_with_missing_final_nl(self):
        input = io.StringIO("print test\nprint test2")
        output = io.StringIO()
        cmd = self.simplecmd(stdin=input, stdout=output)
        cmd.use_rawinput = False
        cmd.cmdloop()
        self.assertMultiLineEqual(output.getvalue(),

            

Reported by Pylint.

Redefining name 'cmd' from outer scope (line 7)
Error

Line: 192 Column: 9

                  def test_file_with_missing_final_nl(self):
        input = io.StringIO("print test\nprint test2")
        output = io.StringIO()
        cmd = self.simplecmd(stdin=input, stdout=output)
        cmd.use_rawinput = False
        cmd.cmdloop()
        self.assertMultiLineEqual(output.getvalue(),
            ("(Cmd) test\n"
             "(Cmd) test2\n"

            

Reported by Pylint.

Redefining built-in 'input'
Error

Line: 202 Column: 9

              

    def test_input_reset_at_EOF(self):
        input = io.StringIO("print test\nprint test2")
        output = io.StringIO()
        cmd = self.simplecmd2(stdin=input, stdout=output)
        cmd.use_rawinput = False
        cmd.cmdloop()
        self.assertMultiLineEqual(output.getvalue(),

            

Reported by Pylint.

Redefining name 'cmd' from outer scope (line 7)
Error

Line: 204 Column: 9

                  def test_input_reset_at_EOF(self):
        input = io.StringIO("print test\nprint test2")
        output = io.StringIO()
        cmd = self.simplecmd2(stdin=input, stdout=output)
        cmd.use_rawinput = False
        cmd.cmdloop()
        self.assertMultiLineEqual(output.getvalue(),
            ("(Cmd) test\n"
             "(Cmd) test2\n"

            

Reported by Pylint.

Probable insecure usage of temp file/directory.
Security

Line: 238
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b108_hardcoded_tmp_directory.html

              
if __name__ == "__main__":
    if "-c" in sys.argv:
        test_coverage('/tmp/cmd.cover')
    elif "-i" in sys.argv:
        samplecmdclass().cmdloop()
    else:
        test_main()

            

Reported by Bandit.

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

Line: 13 Column: 1

              import io
from test import support

class samplecmdclass(cmd.Cmd):
    """
    Instance the sampleclass:
    >>> mycmd = samplecmdclass()

    Test for the function parseline():

            

Reported by Pylint.

Method could be a function
Error

Line: 145 Column: 5

                  def completedefault(self, *ignored):
        print("This is the completedefault method")

    def complete_command(self):
        print("complete command")

    def do_shell(self, s):
        pass


            

Reported by Pylint.

Lib/test/test_asyncio/test_pep492.py
39 issues
Access to a protected member _process_events of a client class
Error

Line: 37 Column: 9

                  def setUp(self):
        super().setUp()
        self.loop = asyncio.BaseEventLoop()
        self.loop._process_events = mock.Mock()
        self.loop._selector = mock.Mock()
        self.loop._selector.select.return_value = ()
        self.set_event_loop(self.loop)



            

Reported by Pylint.

Access to a protected member _selector of a client class
Error

Line: 38 Column: 9

                      super().setUp()
        self.loop = asyncio.BaseEventLoop()
        self.loop._process_events = mock.Mock()
        self.loop._selector = mock.Mock()
        self.loop._selector.select.return_value = ()
        self.set_event_loop(self.loop)


class LockTests(BaseTest):

            

Reported by Pylint.

Access to a protected member _selector of a client class
Error

Line: 39 Column: 9

                      self.loop = asyncio.BaseEventLoop()
        self.loop._process_events = mock.Mock()
        self.loop._selector = mock.Mock()
        self.loop._selector.select.return_value = ()
        self.set_event_loop(self.loop)


class LockTests(BaseTest):


            

Reported by Pylint.

Access to a protected member _GeneratorWrapper of a client class
Error

Line: 161 Column: 44

              
        async def coro():
            wrapper = func()
            self.assertIsInstance(wrapper, types._GeneratorWrapper)
            return await wrapper

        data = self.loop.run_until_complete(coro())
        self.assertEqual(data, 'spam')


            

Reported by Pylint.

Function name "tearDownModule" doesn't conform to snake_case naming style
Error

Line: 13 Column: 1

              from test.test_asyncio import utils as test_utils


def tearDownModule():
    asyncio.set_event_loop_policy(None)


# Test that asyncio.iscoroutine() uses collections.abc.Coroutine
class FakeCoro:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

              from test.test_asyncio import utils as test_utils


def tearDownModule():
    asyncio.set_event_loop_policy(None)


# Test that asyncio.iscoroutine() uses collections.abc.Coroutine
class FakeCoro:

            

Reported by Pylint.

Missing class docstring
Error

Line: 18 Column: 1

              

# Test that asyncio.iscoroutine() uses collections.abc.Coroutine
class FakeCoro:
    def send(self, value):
        pass

    def throw(self, typ, val=None, tb=None):
        pass

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 19 Column: 5

              
# Test that asyncio.iscoroutine() uses collections.abc.Coroutine
class FakeCoro:
    def send(self, value):
        pass

    def throw(self, typ, val=None, tb=None):
        pass


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 22 Column: 5

                  def send(self, value):
        pass

    def throw(self, typ, val=None, tb=None):
        pass

    def close(self):
        pass


            

Reported by Pylint.

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

Line: 22 Column: 5

                  def send(self, value):
        pass

    def throw(self, typ, val=None, tb=None):
        pass

    def close(self):
        pass


            

Reported by Pylint.

Lib/idlelib/idle_test/mock_tk.py
39 issues
Unable to import '_tkinter'
Error

Line: 7 Column: 1

              typically required in spite of what the doc strings say.
"""
import re
from _tkinter import TclError


class Event:
    '''Minimal mock with attributes for testing event handlers.


            

Reported by Pylint.

Method should have "self" as first argument
Error

Line: 299 Column: 5

                  #  The following is a Misc method inherited by Text.
    # It should properly go in a Misc mock, but is included here for now.

    def bind(sequence=None, func=None, add=None):
        "Bind to this widget at event sequence a call to function func."
        pass


class Entry:

            

Reported by Pylint.

Attribute 'title' defined outside __init__
Error

Line: 52 Column: 9

                      self.result = result  # Return None for all show funcs
    def __call__(self, title, message, *args, **kwds):
        # Save all args for possible examination by tester
        self.title = title
        self.message = message
        self.args = args
        self.kwds = kwds
        return self.result  # Set by tester for ask functions


            

Reported by Pylint.

Attribute 'message' defined outside __init__
Error

Line: 53 Column: 9

                  def __call__(self, title, message, *args, **kwds):
        # Save all args for possible examination by tester
        self.title = title
        self.message = message
        self.args = args
        self.kwds = kwds
        return self.result  # Set by tester for ask functions



            

Reported by Pylint.

Attribute 'args' defined outside __init__
Error

Line: 54 Column: 9

                      # Save all args for possible examination by tester
        self.title = title
        self.message = message
        self.args = args
        self.kwds = kwds
        return self.result  # Set by tester for ask functions


class Mbox:

            

Reported by Pylint.

Attribute 'kwds' defined outside __init__
Error

Line: 55 Column: 9

                      self.title = title
        self.message = message
        self.args = args
        self.kwds = kwds
        return self.result  # Set by tester for ask functions


class Mbox:
    """Mock for tkinter.messagebox with an Mbox_func for each function.

            

Reported by Pylint.

Dangerous default value {} as argument
Error

Line: 107 Column: 5

                  For testing, we are not concerned with Tk Text's treatment of,
    for instance, 0-width characters or character + accent.
   """
    def __init__(self, master=None, cnf={}, **kw):
        '''Initialize mock, non-gui, text-only Text widget.

        At present, all args are ignored. Almost all affect visual behavior.
        There are just a few Text-only options that affect text behavior.
        '''

            

Reported by Pylint.

Unused argument 'kw'
Error

Line: 107 Column: 1

                  For testing, we are not concerned with Tk Text's treatment of,
    for instance, 0-width characters or character + accent.
   """
    def __init__(self, master=None, cnf={}, **kw):
        '''Initialize mock, non-gui, text-only Text widget.

        At present, all args are ignored. Almost all affect visual behavior.
        There are just a few Text-only options that affect text behavior.
        '''

            

Reported by Pylint.

Unused argument 'cnf'
Error

Line: 107 Column: 37

                  For testing, we are not concerned with Tk Text's treatment of,
    for instance, 0-width characters or character + accent.
   """
    def __init__(self, master=None, cnf={}, **kw):
        '''Initialize mock, non-gui, text-only Text widget.

        At present, all args are ignored. Almost all affect visual behavior.
        There are just a few Text-only options that affect text behavior.
        '''

            

Reported by Pylint.

Unused argument 'master'
Error

Line: 107 Column: 24

                  For testing, we are not concerned with Tk Text's treatment of,
    for instance, 0-width characters or character + accent.
   """
    def __init__(self, master=None, cnf={}, **kw):
        '''Initialize mock, non-gui, text-only Text widget.

        At present, all args are ignored. Almost all affect visual behavior.
        There are just a few Text-only options that affect text behavior.
        '''

            

Reported by Pylint.