The following issues were found

Lib/token.py
9 issues
Missing function or method docstring
Error

Line: 130 Column: 1

                  '~': TILDE,
}

def ISTERMINAL(x):
    return x < NT_OFFSET

def ISNONTERMINAL(x):
    return x >= NT_OFFSET


            

Reported by Pylint.

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

Line: 130 Column: 1

                  '~': TILDE,
}

def ISTERMINAL(x):
    return x < NT_OFFSET

def ISNONTERMINAL(x):
    return x >= NT_OFFSET


            

Reported by Pylint.

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

Line: 130 Column: 1

                  '~': TILDE,
}

def ISTERMINAL(x):
    return x < NT_OFFSET

def ISNONTERMINAL(x):
    return x >= NT_OFFSET


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 133 Column: 1

              def ISTERMINAL(x):
    return x < NT_OFFSET

def ISNONTERMINAL(x):
    return x >= NT_OFFSET

def ISEOF(x):
    return x == ENDMARKER

            

Reported by Pylint.

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

Line: 133 Column: 1

              def ISTERMINAL(x):
    return x < NT_OFFSET

def ISNONTERMINAL(x):
    return x >= NT_OFFSET

def ISEOF(x):
    return x == ENDMARKER

            

Reported by Pylint.

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

Line: 133 Column: 1

              def ISTERMINAL(x):
    return x < NT_OFFSET

def ISNONTERMINAL(x):
    return x >= NT_OFFSET

def ISEOF(x):
    return x == ENDMARKER

            

Reported by Pylint.

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

Line: 136 Column: 1

              def ISNONTERMINAL(x):
    return x >= NT_OFFSET

def ISEOF(x):
    return x == ENDMARKER

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 136 Column: 1

              def ISNONTERMINAL(x):
    return x >= NT_OFFSET

def ISEOF(x):
    return x == ENDMARKER

            

Reported by Pylint.

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

Line: 136 Column: 1

              def ISNONTERMINAL(x):
    return x >= NT_OFFSET

def ISEOF(x):
    return x == ENDMARKER

            

Reported by Pylint.

Lib/test/dataclass_module_2_str.py
9 issues
Missing module docstring
Error

Line: 1 Column: 1

              from __future__ import annotations
USING_STRINGS = True

# dataclass_module_2.py and dataclass_module_2_str.py are identical
# except only the latter uses string annotations.

from dataclasses import dataclass, InitVar
from typing import ClassVar


            

Reported by Pylint.

Import "from dataclasses import dataclass, InitVar" should be placed at the top of the module
Error

Line: 7 Column: 1

              # dataclass_module_2.py and dataclass_module_2_str.py are identical
# except only the latter uses string annotations.

from dataclasses import dataclass, InitVar
from typing import ClassVar

T_CV2 = ClassVar[int]
T_CV3 = ClassVar


            

Reported by Pylint.

Import "from typing import ClassVar" should be placed at the top of the module
Error

Line: 8 Column: 1

              # except only the latter uses string annotations.

from dataclasses import dataclass, InitVar
from typing import ClassVar

T_CV2 = ClassVar[int]
T_CV3 = ClassVar

T_IV2 = InitVar[int]

            

Reported by Pylint.

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

Line: 10 Column: 1

              from dataclasses import dataclass, InitVar
from typing import ClassVar

T_CV2 = ClassVar[int]
T_CV3 = ClassVar

T_IV2 = InitVar[int]
T_IV3 = InitVar


            

Reported by Pylint.

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

Line: 14 Column: 1

              T_CV3 = ClassVar

T_IV2 = InitVar[int]
T_IV3 = InitVar

@dataclass
class CV:
    T_CV4 = ClassVar
    cv0: ClassVar[int] = 20

            

Reported by Pylint.

Missing class docstring
Error

Line: 17 Column: 1

              T_IV3 = InitVar

@dataclass
class CV:
    T_CV4 = ClassVar
    cv0: ClassVar[int] = 20
    cv1: ClassVar = 30
    cv2: T_CV2
    cv3: T_CV3

            

Reported by Pylint.

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

Line: 18 Column: 5

              
@dataclass
class CV:
    T_CV4 = ClassVar
    cv0: ClassVar[int] = 20
    cv1: ClassVar = 30
    cv2: T_CV2
    cv3: T_CV3
    not_cv4: T_CV4  # When using string annotations, this field is not recognized as a ClassVar.

            

Reported by Pylint.

Missing class docstring
Error

Line: 26 Column: 1

                  not_cv4: T_CV4  # When using string annotations, this field is not recognized as a ClassVar.

@dataclass
class IV:
    T_IV4 = InitVar
    iv0: InitVar[int]
    iv1: InitVar
    iv2: T_IV2
    iv3: T_IV3

            

Reported by Pylint.

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

Line: 27 Column: 5

              
@dataclass
class IV:
    T_IV4 = InitVar
    iv0: InitVar[int]
    iv1: InitVar
    iv2: T_IV2
    iv3: T_IV3
    not_iv4: T_IV4  # When using string annotations, this field is not recognized as an InitVar.

            

Reported by Pylint.

Lib/opcode.py
9 issues
Unused stack_effect imported from _opcode
Error

Line: 19 Column: 5

              #     --Larry Hastings, 2013/11/23

try:
    from _opcode import stack_effect
    __all__.append('stack_effect')
except ImportError:
    pass

cmp_op = ('<', '<=', '==', '!=', '>', '>=')

            

Reported by Pylint.

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

Line: 38 Column: 1

              opmap = {}
opname = ['<%r>' % (op,) for op in range(256)]

def def_op(name, op):
    opname[op] = name
    opmap[name] = op

def name_op(name, op):
    def_op(name, op)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 38 Column: 1

              opmap = {}
opname = ['<%r>' % (op,) for op in range(256)]

def def_op(name, op):
    opname[op] = name
    opmap[name] = op

def name_op(name, op):
    def_op(name, op)

            

Reported by Pylint.

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

Line: 42 Column: 1

                  opname[op] = name
    opmap[name] = op

def name_op(name, op):
    def_op(name, op)
    hasname.append(op)

def jrel_op(name, op):
    def_op(name, op)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 42 Column: 1

                  opname[op] = name
    opmap[name] = op

def name_op(name, op):
    def_op(name, op)
    hasname.append(op)

def jrel_op(name, op):
    def_op(name, op)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 46 Column: 1

                  def_op(name, op)
    hasname.append(op)

def jrel_op(name, op):
    def_op(name, op)
    hasjrel.append(op)

def jabs_op(name, op):
    def_op(name, op)

            

Reported by Pylint.

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

Line: 46 Column: 1

                  def_op(name, op)
    hasname.append(op)

def jrel_op(name, op):
    def_op(name, op)
    hasjrel.append(op)

def jabs_op(name, op):
    def_op(name, op)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 50 Column: 1

                  def_op(name, op)
    hasjrel.append(op)

def jabs_op(name, op):
    def_op(name, op)
    hasjabs.append(op)

# Instruction opcodes for compiled code
# Blank lines correspond to available opcodes

            

Reported by Pylint.

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

Line: 50 Column: 1

                  def_op(name, op)
    hasjrel.append(op)

def jabs_op(name, op):
    def_op(name, op)
    hasjabs.append(op)

# Instruction opcodes for compiled code
# Blank lines correspond to available opcodes

            

Reported by Pylint.

Lib/test/test_osx_env.py
9 issues
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

              """

from test.support.os_helper import EnvironmentVarGuard
import subprocess
import sys
import sysconfig
import unittest

@unittest.skipUnless(sys.platform == 'darwin' and

            

Reported by Bandit.

Missing class docstring
Error

Line: 14 Column: 1

              @unittest.skipUnless(sys.platform == 'darwin' and
                     sysconfig.get_config_var('WITH_NEXT_FRAMEWORK'),
                     'unnecessary on this platform')
class OSXEnvironmentVariableTestCase(unittest.TestCase):
    def _check_sys(self, ev, cond, sv, val = sys.executable + 'dummy'):
        with EnvironmentVarGuard() as evg:
            subpc = [str(sys.executable), '-c',
                'import sys; sys.exit(2 if "%s" %s %s else 3)' % (val, cond, sv)]
            # ensure environment variable does not exist

            

Reported by Pylint.

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

Line: 15 Column: 5

                                   sysconfig.get_config_var('WITH_NEXT_FRAMEWORK'),
                     'unnecessary on this platform')
class OSXEnvironmentVariableTestCase(unittest.TestCase):
    def _check_sys(self, ev, cond, sv, val = sys.executable + 'dummy'):
        with EnvironmentVarGuard() as evg:
            subpc = [str(sys.executable), '-c',
                'import sys; sys.exit(2 if "%s" %s %s else 3)' % (val, cond, sv)]
            # ensure environment variable does not exist
            evg.unset(ev)

            

Reported by Pylint.

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

Line: 15 Column: 5

                                   sysconfig.get_config_var('WITH_NEXT_FRAMEWORK'),
                     'unnecessary on this platform')
class OSXEnvironmentVariableTestCase(unittest.TestCase):
    def _check_sys(self, ev, cond, sv, val = sys.executable + 'dummy'):
        with EnvironmentVarGuard() as evg:
            subpc = [str(sys.executable), '-c',
                'import sys; sys.exit(2 if "%s" %s %s else 3)' % (val, cond, sv)]
            # ensure environment variable does not exist
            evg.unset(ev)

            

Reported by Pylint.

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

Line: 22 Column: 13

                          # ensure environment variable does not exist
            evg.unset(ev)
            # test that test on sys.xxx normally fails
            rc = subprocess.call(subpc)
            self.assertEqual(rc, 3, "expected %s not %s %s" % (ev, cond, sv))
            # set environ variable
            evg.set(ev, val)
            # test that sys.xxx has been influenced by the environ value
            rc = subprocess.call(subpc)

            

Reported by Pylint.

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

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

                          # ensure environment variable does not exist
            evg.unset(ev)
            # test that test on sys.xxx normally fails
            rc = subprocess.call(subpc)
            self.assertEqual(rc, 3, "expected %s not %s %s" % (ev, cond, sv))
            # set environ variable
            evg.set(ev, val)
            # test that sys.xxx has been influenced by the environ value
            rc = subprocess.call(subpc)

            

Reported by Bandit.

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

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

                          # set environ variable
            evg.set(ev, val)
            # test that sys.xxx has been influenced by the environ value
            rc = subprocess.call(subpc)
            self.assertEqual(rc, 2, "expected %s %s %s" % (ev, cond, sv))

    def test_pythonexecutable_sets_sys_executable(self):
        self._check_sys('PYTHONEXECUTABLE', '==', 'sys.executable')


            

Reported by Bandit.

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

Line: 27 Column: 13

                          # set environ variable
            evg.set(ev, val)
            # test that sys.xxx has been influenced by the environ value
            rc = subprocess.call(subpc)
            self.assertEqual(rc, 2, "expected %s %s %s" % (ev, cond, sv))

    def test_pythonexecutable_sets_sys_executable(self):
        self._check_sys('PYTHONEXECUTABLE', '==', 'sys.executable')


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 30 Column: 5

                          rc = subprocess.call(subpc)
            self.assertEqual(rc, 2, "expected %s %s %s" % (ev, cond, sv))

    def test_pythonexecutable_sets_sys_executable(self):
        self._check_sys('PYTHONEXECUTABLE', '==', 'sys.executable')

if __name__ == "__main__":
    unittest.main()

            

Reported by Pylint.

Lib/test/test_future3.py
9 issues
Redefining name 'x' from outer scope (line 6)
Error

Line: 8 Column: 5

              
x = 2
def nester():
    x = 3
    def inner():
        return x
    return inner()



            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from __future__ import nested_scopes
from __future__ import division

import unittest

x = 2
def nester():
    x = 3
    def inner():

            

Reported by Pylint.

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

Line: 6 Column: 1

              
import unittest

x = 2
def nester():
    x = 3
    def inner():
        return x
    return inner()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              import unittest

x = 2
def nester():
    x = 3
    def inner():
        return x
    return inner()


            

Reported by Pylint.

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

Line: 8 Column: 5

              
x = 2
def nester():
    x = 3
    def inner():
        return x
    return inner()



            

Reported by Pylint.

Missing class docstring
Error

Line: 14 Column: 1

                  return inner()


class TestFuture(unittest.TestCase):

    def test_floor_div_operator(self):
        self.assertEqual(7 // 2, 3)

    def test_true_div_as_default(self):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 16 Column: 5

              
class TestFuture(unittest.TestCase):

    def test_floor_div_operator(self):
        self.assertEqual(7 // 2, 3)

    def test_true_div_as_default(self):
        self.assertAlmostEqual(7 / 2, 3.5)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 19 Column: 5

                  def test_floor_div_operator(self):
        self.assertEqual(7 // 2, 3)

    def test_true_div_as_default(self):
        self.assertAlmostEqual(7 / 2, 3.5)

    def test_nested_scopes(self):
        self.assertEqual(nester(), 3)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 22 Column: 5

                  def test_true_div_as_default(self):
        self.assertAlmostEqual(7 / 2, 3.5)

    def test_nested_scopes(self):
        self.assertEqual(nester(), 3)

if __name__ == "__main__":
    unittest.main()

            

Reported by Pylint.

Lib/test/crashers/mutation_inside_cyclegc.py
9 issues
Unused argument 'x'
Error

Line: 18 Column: 14

              class A(object):
    pass

def callback(x):
    del lst[:]


keepalive = []


            

Reported by Pylint.

Attribute 'cycle' defined outside __init__
Error

Line: 27 Column: 5

              for i in range(100):
    lst = [str(i)]
    a = A()
    a.cycle = a
    keepalive.append(weakref.ref(a, callback))
    del a
    while lst:
        keepalive.append(lst[:])

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              
# The cycle GC collector can be executed when any GC-tracked object is
# allocated, e.g. during a call to PyList_New(), PyDict_New(), ...
# Moreover, it can invoke arbitrary Python code via a weakref callback.
# This means that there are many places in the source where an arbitrary
# mutation could unexpectedly occur.

# The example below shows list_slice() not expecting the call to
# PyList_New to mutate the input list.  (Of course there are many

            

Reported by Pylint.

Class 'A' inherits from object, can be safely removed from bases in python3
Error

Line: 15 Column: 1

              
import weakref

class A(object):
    pass

def callback(x):
    del lst[:]


            

Reported by Pylint.

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

Line: 15 Column: 1

              
import weakref

class A(object):
    pass

def callback(x):
    del lst[:]


            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 15 Column: 1

              
import weakref

class A(object):
    pass

def callback(x):
    del lst[:]


            

Reported by Pylint.

Missing class docstring
Error

Line: 15 Column: 1

              
import weakref

class A(object):
    pass

def callback(x):
    del lst[:]


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 18 Column: 1

              class A(object):
    pass

def callback(x):
    del lst[:]


keepalive = []


            

Reported by Pylint.

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

Line: 18 Column: 1

              class A(object):
    pass

def callback(x):
    del lst[:]


keepalive = []


            

Reported by Pylint.

Lib/test/support/bytecode_helper.py
9 issues
Missing function or method docstring
Error

Line: 12 Column: 5

              class BytecodeTestCase(unittest.TestCase):
    """Custom assertion methods for inspecting bytecode."""

    def get_disassembly_as_string(self, co):
        s = io.StringIO()
        dis.dis(co, file=s)
        return s.getvalue()

    def assertInBytecode(self, x, opname, argval=_UNSPECIFIED):

            

Reported by Pylint.

Method could be a function
Error

Line: 12 Column: 5

              class BytecodeTestCase(unittest.TestCase):
    """Custom assertion methods for inspecting bytecode."""

    def get_disassembly_as_string(self, co):
        s = io.StringIO()
        dis.dis(co, file=s)
        return s.getvalue()

    def assertInBytecode(self, x, opname, argval=_UNSPECIFIED):

            

Reported by Pylint.

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

Line: 12 Column: 5

              class BytecodeTestCase(unittest.TestCase):
    """Custom assertion methods for inspecting bytecode."""

    def get_disassembly_as_string(self, co):
        s = io.StringIO()
        dis.dis(co, file=s)
        return s.getvalue()

    def assertInBytecode(self, x, opname, argval=_UNSPECIFIED):

            

Reported by Pylint.

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

Line: 13 Column: 9

                  """Custom assertion methods for inspecting bytecode."""

    def get_disassembly_as_string(self, co):
        s = io.StringIO()
        dis.dis(co, file=s)
        return s.getvalue()

    def assertInBytecode(self, x, opname, argval=_UNSPECIFIED):
        """Returns instr if opname is found, otherwise throws AssertionError"""

            

Reported by Pylint.

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

Line: 17 Column: 5

                      dis.dis(co, file=s)
        return s.getvalue()

    def assertInBytecode(self, x, opname, argval=_UNSPECIFIED):
        """Returns instr if opname is found, otherwise throws AssertionError"""
        for instr in dis.get_instructions(x):
            if instr.opname == opname:
                if argval is _UNSPECIFIED or instr.argval == argval:
                    return instr

            

Reported by Pylint.

Either all return statements in a function should return an expression, or none of them should.
Error

Line: 17 Column: 5

                      dis.dis(co, file=s)
        return s.getvalue()

    def assertInBytecode(self, x, opname, argval=_UNSPECIFIED):
        """Returns instr if opname is found, otherwise throws AssertionError"""
        for instr in dis.get_instructions(x):
            if instr.opname == opname:
                if argval is _UNSPECIFIED or instr.argval == argval:
                    return instr

            

Reported by Pylint.

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

Line: 17 Column: 5

                      dis.dis(co, file=s)
        return s.getvalue()

    def assertInBytecode(self, x, opname, argval=_UNSPECIFIED):
        """Returns instr if opname is found, otherwise throws AssertionError"""
        for instr in dis.get_instructions(x):
            if instr.opname == opname:
                if argval is _UNSPECIFIED or instr.argval == argval:
                    return instr

            

Reported by Pylint.

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

Line: 31 Column: 5

                          msg = msg % (opname, argval, disassembly)
        self.fail(msg)

    def assertNotInBytecode(self, x, opname, argval=_UNSPECIFIED):
        """Throws AssertionError if opname is found"""
        for instr in dis.get_instructions(x):
            if instr.opname == opname:
                disassembly = self.get_disassembly_as_string(x)
                if argval is _UNSPECIFIED:

            

Reported by Pylint.

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

Line: 31 Column: 5

                          msg = msg % (opname, argval, disassembly)
        self.fail(msg)

    def assertNotInBytecode(self, x, opname, argval=_UNSPECIFIED):
        """Throws AssertionError if opname is found"""
        for instr in dis.get_instructions(x):
            if instr.opname == opname:
                disassembly = self.get_disassembly_as_string(x)
                if argval is _UNSPECIFIED:

            

Reported by Pylint.

Lib/test/support/import_helper.py
9 issues
Attempted relative import beyond top-level package
Error

Line: 9 Column: 1

              import unittest
import warnings

from .os_helper import unlink


@contextlib.contextmanager
def _ignore_deprecated_imports(ignore=True):
    """Context manager to suppress package and module deprecation

            

Reported by Pylint.

XXX: This kind of problem can affect more than just encodings.
Error

Line: 231 Column: 3

                               if k.startswith('encodings.')]
    sys.modules.clear()
    sys.modules.update(encodings)
    # XXX: This kind of problem can affect more than just encodings.
    # In particular extension modules (such as _ssl) don't cope
    # with reloading properly. Really, test modules should be cleaning
    # out the test specific modules they know they added (ala test_runpy)
    # rather than relying on this function (as test_importhooks and test_pkg
    # do currently). Implicitly imported *real* modules should be left alone

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import contextlib
import importlib
import importlib.util
import os
import sys
import unittest
import warnings

from .os_helper import unlink

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 28 Column: 1

                      yield


def unload(name):
    try:
        del sys.modules[name]
    except KeyError:
        pass


            

Reported by Pylint.

Class 'CleanImport' inherits from object, can be safely removed from bases in python3
Error

Line: 162 Column: 1

                      return fresh_module


class CleanImport(object):
    """Context manager to force import to return a new module reference.

    This is useful for testing module-level behaviours, such as
    the emission of a DeprecationWarning on import.


            

Reported by Pylint.

Class 'DirsOnSysPath' inherits from object, can be safely removed from bases in python3
Error

Line: 194 Column: 1

                      sys.modules.update(self.original_modules)


class DirsOnSysPath(object):
    """Context manager to temporarily add directories to sys.path.

    This makes a copy of sys.path, appends any directories given
    as positional arguments, then reverts sys.path to the copied
    settings when the context ends.

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 219 Column: 1

                      sys.path[:] = self.original_value


def modules_setup():
    return sys.modules.copy(),


def modules_cleanup(oldmodules):
    # Encoders/decoders are registered permanently within the internal

            

Reported by Pylint.

Disallow trailing comma tuple
Error

Line: 220 Column: 1

              

def modules_setup():
    return sys.modules.copy(),


def modules_cleanup(oldmodules):
    # Encoders/decoders are registered permanently within the internal
    # codec cache. If we destroy the corresponding modules their

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 223 Column: 1

                  return sys.modules.copy(),


def modules_cleanup(oldmodules):
    # Encoders/decoders are registered permanently within the internal
    # codec cache. If we destroy the corresponding modules their
    # globals will be set to None which will trip up the cached functions.
    encodings = [(k, v) for k, v in sys.modules.items()
                 if k.startswith('encodings.')]

            

Reported by Pylint.

Lib/test/test_listcomps.py
9 issues
Module 'sys' has no 'gettotalrefcount' member
Error

Line: 160 Column: 25

                      for i in range(len(counts)):
            support.run_doctest(test_listcomps, verbose)
            gc.collect()
            counts[i] = sys.gettotalrefcount()
        print(counts)

if __name__ == "__main__":
    test_main(verbose=True)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              doctests = """
########### Tests borrowed from or inspired by test_genexps.py ############

Test simple loop with conditional

    >>> sum([i*i for i in range(100) if i&1 == 1])
    166650

Test simple nesting

            

Reported by Pylint.

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

Line: 1 Column: 1

              doctests = """
########### Tests borrowed from or inspired by test_genexps.py ############

Test simple loop with conditional

    >>> sum([i*i for i in range(100) if i&1 == 1])
    166650

Test simple nesting

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 147 Column: 1

              
__test__ = {'doctests' : doctests}

def test_main(verbose=None):
    import sys
    from test import support
    from test import test_listcomps
    support.run_doctest(test_listcomps, verbose)


            

Reported by Pylint.

Import outside toplevel (sys)
Error

Line: 148 Column: 5

              __test__ = {'doctests' : doctests}

def test_main(verbose=None):
    import sys
    from test import support
    from test import test_listcomps
    support.run_doctest(test_listcomps, verbose)

    # verify reference counting

            

Reported by Pylint.

Import outside toplevel (test.support)
Error

Line: 149 Column: 5

              
def test_main(verbose=None):
    import sys
    from test import support
    from test import test_listcomps
    support.run_doctest(test_listcomps, verbose)

    # verify reference counting
    if verbose and hasattr(sys, "gettotalrefcount"):

            

Reported by Pylint.

Import outside toplevel (test.test_listcomps)
Error

Line: 150 Column: 5

              def test_main(verbose=None):
    import sys
    from test import support
    from test import test_listcomps
    support.run_doctest(test_listcomps, verbose)

    # verify reference counting
    if verbose and hasattr(sys, "gettotalrefcount"):
        import gc

            

Reported by Pylint.

Import outside toplevel (gc)
Error

Line: 155 Column: 9

              
    # verify reference counting
    if verbose and hasattr(sys, "gettotalrefcount"):
        import gc
        counts = [None] * 5
        for i in range(len(counts)):
            support.run_doctest(test_listcomps, verbose)
            gc.collect()
            counts[i] = sys.gettotalrefcount()

            

Reported by Pylint.

Consider using enumerate instead of iterating with range and len
Error

Line: 157 Column: 9

                  if verbose and hasattr(sys, "gettotalrefcount"):
        import gc
        counts = [None] * 5
        for i in range(len(counts)):
            support.run_doctest(test_listcomps, verbose)
            gc.collect()
            counts[i] = sys.gettotalrefcount()
        print(counts)


            

Reported by Pylint.

Lib/test/dataclass_module_2.py
9 issues
Missing module docstring
Error

Line: 1 Column: 1

              #from __future__ import annotations
USING_STRINGS = False

# dataclass_module_2.py and dataclass_module_2_str.py are identical
# except only the latter uses string annotations.

from dataclasses import dataclass, InitVar
from typing import ClassVar


            

Reported by Pylint.

Import "from dataclasses import dataclass, InitVar" should be placed at the top of the module
Error

Line: 7 Column: 1

              # dataclass_module_2.py and dataclass_module_2_str.py are identical
# except only the latter uses string annotations.

from dataclasses import dataclass, InitVar
from typing import ClassVar

T_CV2 = ClassVar[int]
T_CV3 = ClassVar


            

Reported by Pylint.

Import "from typing import ClassVar" should be placed at the top of the module
Error

Line: 8 Column: 1

              # except only the latter uses string annotations.

from dataclasses import dataclass, InitVar
from typing import ClassVar

T_CV2 = ClassVar[int]
T_CV3 = ClassVar

T_IV2 = InitVar[int]

            

Reported by Pylint.

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

Line: 10 Column: 1

              from dataclasses import dataclass, InitVar
from typing import ClassVar

T_CV2 = ClassVar[int]
T_CV3 = ClassVar

T_IV2 = InitVar[int]
T_IV3 = InitVar


            

Reported by Pylint.

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

Line: 14 Column: 1

              T_CV3 = ClassVar

T_IV2 = InitVar[int]
T_IV3 = InitVar

@dataclass
class CV:
    T_CV4 = ClassVar
    cv0: ClassVar[int] = 20

            

Reported by Pylint.

Missing class docstring
Error

Line: 17 Column: 1

              T_IV3 = InitVar

@dataclass
class CV:
    T_CV4 = ClassVar
    cv0: ClassVar[int] = 20
    cv1: ClassVar = 30
    cv2: T_CV2
    cv3: T_CV3

            

Reported by Pylint.

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

Line: 18 Column: 5

              
@dataclass
class CV:
    T_CV4 = ClassVar
    cv0: ClassVar[int] = 20
    cv1: ClassVar = 30
    cv2: T_CV2
    cv3: T_CV3
    not_cv4: T_CV4  # When using string annotations, this field is not recognized as a ClassVar.

            

Reported by Pylint.

Missing class docstring
Error

Line: 26 Column: 1

                  not_cv4: T_CV4  # When using string annotations, this field is not recognized as a ClassVar.

@dataclass
class IV:
    T_IV4 = InitVar
    iv0: InitVar[int]
    iv1: InitVar
    iv2: T_IV2
    iv3: T_IV3

            

Reported by Pylint.

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

Line: 27 Column: 5

              
@dataclass
class IV:
    T_IV4 = InitVar
    iv0: InitVar[int]
    iv1: InitVar
    iv2: T_IV2
    iv3: T_IV3
    not_iv4: T_IV4  # When using string annotations, this field is not recognized as an InitVar.

            

Reported by Pylint.