The following issues were found

Lib/test/test_importlib/resources/util.py
60 issues
Attempted relative import beyond top-level package
Error

Line: 8 Column: 1

              import types
from pathlib import Path, PurePath

from .. import data01
from .. import zipdata01
from importlib.abc import ResourceReader
from test.support import import_helper



            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 9 Column: 1

              from pathlib import Path, PurePath

from .. import data01
from .. import zipdata01
from importlib.abc import ResourceReader
from test.support import import_helper


from importlib.machinery import ModuleSpec

            

Reported by Pylint.

Instance of 'Reader' has no 'file' member
Error

Line: 26 Column: 23

              
    def open_resource(self, path):
        self._path = path
        if isinstance(self.file, Exception):
            raise self.file
        return self.file

    def resource_path(self, path_):
        self._path = path_

            

Reported by Pylint.

Instance of 'Reader' has no 'file' member
Error

Line: 27 Column: 19

                  def open_resource(self, path):
        self._path = path
        if isinstance(self.file, Exception):
            raise self.file
        return self.file

    def resource_path(self, path_):
        self._path = path_
        if isinstance(self.path, Exception):

            

Reported by Pylint.

Instance of 'Reader' has no 'file' member
Error

Line: 28 Column: 16

                      self._path = path
        if isinstance(self.file, Exception):
            raise self.file
        return self.file

    def resource_path(self, path_):
        self._path = path_
        if isinstance(self.path, Exception):
            raise self.path

            

Reported by Pylint.

Instance of 'Reader' has no 'path' member; maybe '_path'?
Error

Line: 32 Column: 23

              
    def resource_path(self, path_):
        self._path = path_
        if isinstance(self.path, Exception):
            raise self.path
        return self.path

    def is_resource(self, path_):
        self._path = path_

            

Reported by Pylint.

Instance of 'Reader' has no 'path' member; maybe '_path'?
Error

Line: 33 Column: 19

                  def resource_path(self, path_):
        self._path = path_
        if isinstance(self.path, Exception):
            raise self.path
        return self.path

    def is_resource(self, path_):
        self._path = path_
        if isinstance(self.path, Exception):

            

Reported by Pylint.

Instance of 'Reader' has no 'path' member; maybe '_path'?
Error

Line: 34 Column: 16

                      self._path = path_
        if isinstance(self.path, Exception):
            raise self.path
        return self.path

    def is_resource(self, path_):
        self._path = path_
        if isinstance(self.path, Exception):
            raise self.path

            

Reported by Pylint.

Instance of 'Reader' has no 'path' member; maybe '_path'?
Error

Line: 38 Column: 23

              
    def is_resource(self, path_):
        self._path = path_
        if isinstance(self.path, Exception):
            raise self.path

        def part(entry):
            return entry.split('/')


            

Reported by Pylint.

Instance of 'Reader' has no 'path' member; maybe '_path'?
Error

Line: 39 Column: 19

                  def is_resource(self, path_):
        self._path = path_
        if isinstance(self.path, Exception):
            raise self.path

        def part(entry):
            return entry.split('/')

        return any(

            

Reported by Pylint.

Lib/stat.py
60 issues
Unused argument 'mode'
Error

Line: 78 Column: 14

                  """Return True if mode is from a socket."""
    return S_IFMT(mode) == S_IFSOCK

def S_ISDOOR(mode):
    """Return True if mode is from a door."""
    return False

def S_ISPORT(mode):
    """Return True if mode is from an event port."""

            

Reported by Pylint.

Unused argument 'mode'
Error

Line: 82 Column: 14

                  """Return True if mode is from a door."""
    return False

def S_ISPORT(mode):
    """Return True if mode is from an event port."""
    return False

def S_ISWHT(mode):
    """Return True if mode is from a whiteout."""

            

Reported by Pylint.

Unused argument 'mode'
Error

Line: 86 Column: 13

                  """Return True if mode is from an event port."""
    return False

def S_ISWHT(mode):
    """Return True if mode is from a whiteout."""
    return False

# Names for permission bits


            

Reported by Pylint.

Unused import UF_APPEND from wildcard import
Error

Line: 193 Column: 5

              
# If available, use C implementation
try:
    from _stat import *
except ImportError:
    pass

            

Reported by Pylint.

Unused import UF_OPAQUE from wildcard import
Error

Line: 193 Column: 5

              
# If available, use C implementation
try:
    from _stat import *
except ImportError:
    pass

            

Reported by Pylint.

Unused import filemode from wildcard import
Error

Line: 193 Column: 5

              
# If available, use C implementation
try:
    from _stat import *
except ImportError:
    pass

            

Reported by Pylint.

Unused import UF_NOUNLINK from wildcard import
Error

Line: 193 Column: 5

              
# If available, use C implementation
try:
    from _stat import *
except ImportError:
    pass

            

Reported by Pylint.

Unused import UF_IMMUTABLE from wildcard import
Error

Line: 193 Column: 5

              
# If available, use C implementation
try:
    from _stat import *
except ImportError:
    pass

            

Reported by Pylint.

Unused import SF_ARCHIVED from wildcard import
Error

Line: 193 Column: 5

              
# If available, use C implementation
try:
    from _stat import *
except ImportError:
    pass

            

Reported by Pylint.

Unused import SF_SNAPSHOT from wildcard import
Error

Line: 193 Column: 5

              
# If available, use C implementation
try:
    from _stat import *
except ImportError:
    pass

            

Reported by Pylint.

Lib/test/test_http_cookies.py
60 issues
Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Security blacklist

Line: 214
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle

              
        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
            with self.subTest(proto=proto):
                C1 = pickle.loads(pickle.dumps(C, protocol=proto))
                self.assertEqual(C1.output(), expected_output)

    def test_illegal_chars(self):
        rawdata = "a=b; c,d=e"
        C = cookies.SimpleCookie()

            

Reported by Bandit.

Access to a protected member _reserved of a client class
Error

Line: 242 Column: 41

                      self.assertIsNone(morsel.key)
        self.assertIsNone(morsel.value)
        self.assertIsNone(morsel.coded_value)
        self.assertEqual(morsel.keys(), cookies.Morsel._reserved.keys())
        for key, val in morsel.items():
            self.assertEqual(val, '', key)

    def test_reserved_keys(self):
        M = cookies.Morsel()

            

Reported by Pylint.

Access to a protected member _reserved of a client class
Error

Line: 249 Column: 18

                  def test_reserved_keys(self):
        M = cookies.Morsel()
        # tests valid and invalid reserved keys for Morsels
        for i in M._reserved:
            # Test that all valid keys are reported as reserved and set them
            self.assertTrue(M.isReservedKey(i))
            M[i] = '%s_value' % i
        for i in M._reserved:
            # Test that valid key values come out fine

            

Reported by Pylint.

Access to a protected member _reserved of a client class
Error

Line: 253 Column: 18

                          # Test that all valid keys are reported as reserved and set them
            self.assertTrue(M.isReservedKey(i))
            M[i] = '%s_value' % i
        for i in M._reserved:
            # Test that valid key values come out fine
            self.assertEqual(M[i], '%s_value' % i)
        for i in "the holy hand grenade".split():
            # Test that invalid keys raise CookieError
            self.assertRaises(cookies.CookieError,

            

Reported by Pylint.

Access to a protected member _reserved of a client class
Error

Line: 264 Column: 18

                  def test_setter(self):
        M = cookies.Morsel()
        # tests the .set method to set keys and their values
        for i in M._reserved:
            # Makes sure that all reserved keys can't be set this way
            self.assertRaises(cookies.CookieError,
                              M.set, i, '%s_value' % i, '%s_value' % i)
        for i in "thou cast _the- !holy! ^hand| +*grenade~".split():
            # Try typical use case. Setting decent values.

            

Reported by Pylint.

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Security blacklist

Line: 437
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle

                      })
        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
            with self.subTest(proto=proto):
                morsel_b = pickle.loads(pickle.dumps(morsel_a, proto))
                self.assertIsInstance(morsel_b, cookies.Morsel)
                self.assertEqual(morsel_b, morsel_a)
                self.assertEqual(str(morsel_b), str(morsel_a))

    def test_repr(self):

            

Reported by Bandit.

Missing module docstring
Error

Line: 1 Column: 1

              # Simple test suite for http/cookies.py

import copy
from test.support import run_unittest, run_doctest
import unittest
from http import cookies
import pickle



            

Reported by Pylint.

Consider possible security implications associated with pickle module.
Security blacklist

Line: 7
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b403-import-pickle

              from test.support import run_unittest, run_doctest
import unittest
from http import cookies
import pickle


class CookieTests(unittest.TestCase):

    def test_basic(self):

            

Reported by Bandit.

Missing class docstring
Error

Line: 10 Column: 1

              import pickle


class CookieTests(unittest.TestCase):

    def test_basic(self):
        cases = [
            {'data': 'chips=ahoy; vienna=finger',
             'dict': {'chips':'ahoy', 'vienna':'finger'},

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 12 Column: 5

              
class CookieTests(unittest.TestCase):

    def test_basic(self):
        cases = [
            {'data': 'chips=ahoy; vienna=finger',
             'dict': {'chips':'ahoy', 'vienna':'finger'},
             'repr': "<SimpleCookie: chips='ahoy' vienna='finger'>",
             'output': 'Set-Cookie: chips=ahoy\nSet-Cookie: vienna=finger'},

            

Reported by Pylint.

Lib/idlelib/colorizer.py
59 issues
Redefining built-in 'any'
Error

Line: 12 Column: 1

              DEBUG = False


def any(name, alternates):
    "Return a named group pattern matching list of alternates."
    return "(?P<%s>" % name + "|".join(alternates) + ")"


def make_pat():

            

Reported by Pylint.

Redefining name 'prog' from outer scope (line 66)
Error

Line: 56 Column: 5

                  sq3string = stringprefix + r"'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?"
    dq3string = stringprefix + r'"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?'
    string = any("STRING", [sq3string, dq3string, sqstring, dqstring])
    prog = re.compile("|".join([
                                builtin, comment, string, kw,
                                match_softkw, case_default,
                                case_softkw_and_pattern,
                                any("SYNC", [r"\n"]),
                               ]),

            

Reported by Pylint.

Attribute 'stop_colorizing' defined outside __init__
Error

Line: 152 Column: 13

                          self.notify_range("1.0", "end")
        else:
            # No delegate - stop any colorizing.
            self.stop_colorizing = True
            self.allow_colorizing = False

    def config_colors(self):
        "Configure text widget tags with colors from tagdefs."
        for tag, cnf in self.tagdefs.items():

            

Reported by Pylint.

Attribute 'allow_colorizing' defined outside __init__
Error

Line: 153 Column: 13

                      else:
            # No delegate - stop any colorizing.
            self.stop_colorizing = True
            self.allow_colorizing = False

    def config_colors(self):
        "Configure text widget tags with colors from tagdefs."
        for tag, cnf in self.tagdefs.items():
            self.tag_configure(tag, **cnf)

            

Reported by Pylint.

Attribute 'stop_colorizing' defined outside __init__
Error

Line: 200 Column: 13

                          if DEBUG: print("colorizing already scheduled")
            return
        if self.colorizing:
            self.stop_colorizing = True
            if DEBUG: print("stop colorizing")
        if self.allow_colorizing:
            if DEBUG: print("schedule colorizing")
            self.after_id = self.after(1, self.recolorize)
        return

            

Reported by Pylint.

Attribute 'after_id' defined outside __init__
Error

Line: 204 Column: 13

                          if DEBUG: print("stop colorizing")
        if self.allow_colorizing:
            if DEBUG: print("schedule colorizing")
            self.after_id = self.after(1, self.recolorize)
        return

    def close(self):
        if self.after_id:
            after_id = self.after_id

            

Reported by Pylint.

Attribute 'after_id' defined outside __init__
Error

Line: 210 Column: 13

                  def close(self):
        if self.after_id:
            after_id = self.after_id
            self.after_id = None
            if DEBUG: print("cancel scheduled recolorizer")
            self.after_cancel(after_id)
        self.allow_colorizing = False
        self.stop_colorizing = True


            

Reported by Pylint.

Attribute 'allow_colorizing' defined outside __init__
Error

Line: 213 Column: 9

                          self.after_id = None
            if DEBUG: print("cancel scheduled recolorizer")
            self.after_cancel(after_id)
        self.allow_colorizing = False
        self.stop_colorizing = True

    def toggle_colorize_event(self, event=None):
        """Toggle colorizing on and off.


            

Reported by Pylint.

Attribute 'stop_colorizing' defined outside __init__
Error

Line: 214 Column: 9

                          if DEBUG: print("cancel scheduled recolorizer")
            self.after_cancel(after_id)
        self.allow_colorizing = False
        self.stop_colorizing = True

    def toggle_colorize_event(self, event=None):
        """Toggle colorizing on and off.

        When toggling off, if colorizing is scheduled or is in

            

Reported by Pylint.

Unused argument 'event'
Error

Line: 216 Column: 37

                      self.allow_colorizing = False
        self.stop_colorizing = True

    def toggle_colorize_event(self, event=None):
        """Toggle colorizing on and off.

        When toggling off, if colorizing is scheduled or is in
        process, it will be cancelled and/or stopped.


            

Reported by Pylint.

Tools/demo/redemo.py
59 issues
Unable to import 'tkinter'
Error

Line: 5 Column: 1

              
"""Basic regular expression demonstration facility (Perl style syntax)."""

from tkinter import *
import re

class ReDemo:

    def __init__(self, master):

            

Reported by Pylint.

Undefined variable 'Label'
Error

Line: 13 Column: 30

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

        self.promptdisplay = Label(self.master, anchor=W,
                text="Enter a Perl-style regular expression:")
        self.promptdisplay.pack(side=TOP, fill=X)

        self.regexdisplay = Entry(self.master)
        self.regexdisplay.pack(fill=X)

            

Reported by Pylint.

Undefined variable 'W'
Error

Line: 13 Column: 56

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

        self.promptdisplay = Label(self.master, anchor=W,
                text="Enter a Perl-style regular expression:")
        self.promptdisplay.pack(side=TOP, fill=X)

        self.regexdisplay = Entry(self.master)
        self.regexdisplay.pack(fill=X)

            

Reported by Pylint.

Undefined variable 'X'
Error

Line: 15 Column: 48

              
        self.promptdisplay = Label(self.master, anchor=W,
                text="Enter a Perl-style regular expression:")
        self.promptdisplay.pack(side=TOP, fill=X)

        self.regexdisplay = Entry(self.master)
        self.regexdisplay.pack(fill=X)
        self.regexdisplay.focus_set()


            

Reported by Pylint.

Undefined variable 'TOP'
Error

Line: 15 Column: 38

              
        self.promptdisplay = Label(self.master, anchor=W,
                text="Enter a Perl-style regular expression:")
        self.promptdisplay.pack(side=TOP, fill=X)

        self.regexdisplay = Entry(self.master)
        self.regexdisplay.pack(fill=X)
        self.regexdisplay.focus_set()


            

Reported by Pylint.

Undefined variable 'Entry'
Error

Line: 17 Column: 29

                              text="Enter a Perl-style regular expression:")
        self.promptdisplay.pack(side=TOP, fill=X)

        self.regexdisplay = Entry(self.master)
        self.regexdisplay.pack(fill=X)
        self.regexdisplay.focus_set()

        self.addoptions()


            

Reported by Pylint.

Undefined variable 'X'
Error

Line: 18 Column: 37

                      self.promptdisplay.pack(side=TOP, fill=X)

        self.regexdisplay = Entry(self.master)
        self.regexdisplay.pack(fill=X)
        self.regexdisplay.focus_set()

        self.addoptions()

        self.statusdisplay = Label(self.master, text="", anchor=W)

            

Reported by Pylint.

Undefined variable 'Label'
Error

Line: 23 Column: 30

              
        self.addoptions()

        self.statusdisplay = Label(self.master, text="", anchor=W)
        self.statusdisplay.pack(side=TOP, fill=X)

        self.labeldisplay = Label(self.master, anchor=W,
                text="Enter a string to search:")
        self.labeldisplay.pack(fill=X)

            

Reported by Pylint.

Undefined variable 'W'
Error

Line: 23 Column: 65

              
        self.addoptions()

        self.statusdisplay = Label(self.master, text="", anchor=W)
        self.statusdisplay.pack(side=TOP, fill=X)

        self.labeldisplay = Label(self.master, anchor=W,
                text="Enter a string to search:")
        self.labeldisplay.pack(fill=X)

            

Reported by Pylint.

Undefined variable 'TOP'
Error

Line: 24 Column: 38

                      self.addoptions()

        self.statusdisplay = Label(self.master, text="", anchor=W)
        self.statusdisplay.pack(side=TOP, fill=X)

        self.labeldisplay = Label(self.master, anchor=W,
                text="Enter a string to search:")
        self.labeldisplay.pack(fill=X)
        self.labeldisplay.pack(fill=X)

            

Reported by Pylint.

Parser/asdl.py
59 issues
Redefining built-in 'type'
Error

Line: 68 Column: 24

                      return 'Constructor({0.name}, {0.fields})'.format(self)

class Field(AST):
    def __init__(self, type, name=None, seq=False, opt=False):
        self.type = type
        self.name = name
        self.seq = seq
        self.opt = opt


            

Reported by Pylint.

Redefining built-in 'type'
Error

Line: 158 Column: 25

                      for dfn in mod.dfns:
            self.visit(dfn)

    def visitType(self, type):
        self.visit(type.value, str(type.name))

    def visitSum(self, sum, name):
        for t in sum.types:
            self.visit(t, name)

            

Reported by Pylint.

Redefining built-in 'sum'
Error

Line: 161 Column: 24

                  def visitType(self, type):
        self.visit(type.value, str(type.name))

    def visitSum(self, sum, name):
        for t in sum.types:
            self.visit(t, name)

    def visitConstructor(self, cons, name):
        key = str(cons.name)

            

Reported by Pylint.

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

Line: 224 Column: 5

              Token = namedtuple('Token', 'kind value lineno')

class ASDLSyntaxError(Exception):
    def __init__(self, msg, lineno=None):
        self.msg = msg
        self.lineno = lineno or '<unknown>'

    def __str__(self):
        return 'Syntax error on line {0.lineno}: {0.msg}'.format(self)

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 250 Column: 21

                              try:
                    op_kind = TokenKind.operator_table[c]
                except KeyError:
                    raise ASDLSyntaxError('Invalid operator %s' % c, lineno)
                yield Token(op_kind, c, lineno)

class ASDLParser:
    """Parser for ASDL files.


            

Reported by Pylint.

Redefining built-in 'type'
Error

Line: 289 Column: 13

                      while self.cur_token.kind == TokenKind.TypeId:
            typename = self._advance()
            self._match(TokenKind.Equals)
            type = self._parse_type()
            defs.append(Type(typename, type))
        return defs

    def _parse_type(self):
        if self.cur_token.kind == TokenKind.LParen:

            

Reported by Pylint.

Redefining built-in 'id'
Error

Line: 318 Column: 13

                      while self.cur_token.kind == TokenKind.TypeId:
            typename = self._advance()
            is_seq, is_opt = self._parse_optional_field_quantifier()
            id = (self._advance() if self.cur_token.kind in self._id_kinds
                                  else None)
            fields.append(Field(typename, id, seq=is_seq, opt=is_opt))
            if self.cur_token.kind == TokenKind.RParen:
                break
            elif self.cur_token.kind == TokenKind.Comma:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #-------------------------------------------------------------------------------
# Parser for ASDL [1] definition files. Reads in an ASDL description and parses
# it into an AST that describes it.
#
# The EBNF we're parsing here: Figure 1 of the paper [1]. Extended to support
# modules and attributes after a product. Words starting with Capital letters
# are terminals. Literal tokens are in "double quotes". Others are
# non-terminals. Id is either TokenId or ConstructorId.
#

            

Reported by Pylint.

Missing class docstring
Error

Line: 38 Column: 1

              
builtin_types = {'identifier', 'string', 'int', 'constant'}

class AST:
    def __repr__(self):
        raise NotImplementedError

class Module(AST):
    def __init__(self, name, dfns):

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 38 Column: 1

              
builtin_types = {'identifier', 'string', 'int', 'constant'}

class AST:
    def __repr__(self):
        raise NotImplementedError

class Module(AST):
    def __init__(self, name, dfns):

            

Reported by Pylint.

Lib/test/test_importlib/test_windows.py
59 issues
Attempted relative import beyond top-level package
Error

Line: 1 Column: 1

              from . import util as test_util
machinery = test_util.import_importlib('importlib.machinery')

import os
import re
import sys
import unittest
import warnings
from test import support

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 12 Column: 1

              from test import support
from test.support import import_helper
from contextlib import contextmanager
from .util import temp_module

import_helper.import_module('winreg', required_on=['win'])
from winreg import (
    CreateKey, HKEY_CURRENT_USER,
    SetValue, REG_SZ, KEY_ALL_ACCESS,

            

Reported by Pylint.

Unable to import 'winreg'
Error

Line: 15 Column: 1

              from .util import temp_module

import_helper.import_module('winreg', required_on=['win'])
from winreg import (
    CreateKey, HKEY_CURRENT_USER,
    SetValue, REG_SZ, KEY_ALL_ACCESS,
    EnumKey, CloseKey, DeleteKey, OpenKey
)


            

Reported by Pylint.

Instance of 'WindowsRegistryFinderTests' has no 'machinery' member
Error

Line: 84 Column: 16

                  test_module = "spamham{}".format(os.getpid())

    def test_find_spec_missing(self):
        spec = self.machinery.WindowsRegistryFinder.find_spec('spam')
        self.assertIs(spec, None)

    def test_find_module_missing(self):
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", DeprecationWarning)

            

Reported by Pylint.

Instance of 'WindowsRegistryFinderTests' has no 'assertIs' member
Error

Line: 85 Column: 9

              
    def test_find_spec_missing(self):
        spec = self.machinery.WindowsRegistryFinder.find_spec('spam')
        self.assertIs(spec, None)

    def test_find_module_missing(self):
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", DeprecationWarning)
            loader = self.machinery.WindowsRegistryFinder.find_module('spam')

            

Reported by Pylint.

Instance of 'WindowsRegistryFinderTests' has no 'machinery' member
Error

Line: 90 Column: 22

                  def test_find_module_missing(self):
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", DeprecationWarning)
            loader = self.machinery.WindowsRegistryFinder.find_module('spam')
        self.assertIs(loader, None)

    def test_module_found(self):
        with setup_module(self.machinery, self.test_module):
            with warnings.catch_warnings():

            

Reported by Pylint.

Instance of 'WindowsRegistryFinderTests' has no 'assertIs' member
Error

Line: 91 Column: 9

                      with warnings.catch_warnings():
            warnings.simplefilter("ignore", DeprecationWarning)
            loader = self.machinery.WindowsRegistryFinder.find_module('spam')
        self.assertIs(loader, None)

    def test_module_found(self):
        with setup_module(self.machinery, self.test_module):
            with warnings.catch_warnings():
                warnings.simplefilter("ignore", DeprecationWarning)

            

Reported by Pylint.

Instance of 'WindowsRegistryFinderTests' has no 'machinery' member
Error

Line: 94 Column: 27

                      self.assertIs(loader, None)

    def test_module_found(self):
        with setup_module(self.machinery, self.test_module):
            with warnings.catch_warnings():
                warnings.simplefilter("ignore", DeprecationWarning)
                loader = self.machinery.WindowsRegistryFinder.find_module(self.test_module)
            spec = self.machinery.WindowsRegistryFinder.find_spec(self.test_module)
            self.assertIsNot(loader, None)

            

Reported by Pylint.

Instance of 'WindowsRegistryFinderTests' has no 'machinery' member
Error

Line: 97 Column: 26

                      with setup_module(self.machinery, self.test_module):
            with warnings.catch_warnings():
                warnings.simplefilter("ignore", DeprecationWarning)
                loader = self.machinery.WindowsRegistryFinder.find_module(self.test_module)
            spec = self.machinery.WindowsRegistryFinder.find_spec(self.test_module)
            self.assertIsNot(loader, None)
            self.assertIsNot(spec, None)

    def test_module_not_found(self):

            

Reported by Pylint.

Instance of 'WindowsRegistryFinderTests' has no 'machinery' member
Error

Line: 98 Column: 20

                          with warnings.catch_warnings():
                warnings.simplefilter("ignore", DeprecationWarning)
                loader = self.machinery.WindowsRegistryFinder.find_module(self.test_module)
            spec = self.machinery.WindowsRegistryFinder.find_spec(self.test_module)
            self.assertIsNot(loader, None)
            self.assertIsNot(spec, None)

    def test_module_not_found(self):
        with setup_module(self.machinery, self.test_module, path="."):

            

Reported by Pylint.

Lib/test/pydocfodder.py
59 issues
Class name "A_classic" doesn't conform to PascalCase naming style
Error

Line: 5 Column: 1

              
import types

class A_classic:
    "A classic class."
    def A_method(self):
        "Method defined in A."
    def AB_method(self):
        "Method defined in A and B."

            

Reported by Pylint.

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

Line: 7 Column: 5

              
class A_classic:
    "A classic class."
    def A_method(self):
        "Method defined in A."
    def AB_method(self):
        "Method defined in A and B."
    def AC_method(self):
        "Method defined in A and C."

            

Reported by Pylint.

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

Line: 9 Column: 5

                  "A classic class."
    def A_method(self):
        "Method defined in A."
    def AB_method(self):
        "Method defined in A and B."
    def AC_method(self):
        "Method defined in A and C."
    def AD_method(self):
        "Method defined in A and D."

            

Reported by Pylint.

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

Line: 11 Column: 5

                      "Method defined in A."
    def AB_method(self):
        "Method defined in A and B."
    def AC_method(self):
        "Method defined in A and C."
    def AD_method(self):
        "Method defined in A and D."
    def ABC_method(self):
        "Method defined in A, B and C."

            

Reported by Pylint.

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

Line: 13 Column: 5

                      "Method defined in A and B."
    def AC_method(self):
        "Method defined in A and C."
    def AD_method(self):
        "Method defined in A and D."
    def ABC_method(self):
        "Method defined in A, B and C."
    def ABD_method(self):
        "Method defined in A, B and D."

            

Reported by Pylint.

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

Line: 15 Column: 5

                      "Method defined in A and C."
    def AD_method(self):
        "Method defined in A and D."
    def ABC_method(self):
        "Method defined in A, B and C."
    def ABD_method(self):
        "Method defined in A, B and D."
    def ACD_method(self):
        "Method defined in A, C and D."

            

Reported by Pylint.

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

Line: 17 Column: 5

                      "Method defined in A and D."
    def ABC_method(self):
        "Method defined in A, B and C."
    def ABD_method(self):
        "Method defined in A, B and D."
    def ACD_method(self):
        "Method defined in A, C and D."
    def ABCD_method(self):
        "Method defined in A, B, C and D."

            

Reported by Pylint.

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

Line: 19 Column: 5

                      "Method defined in A, B and C."
    def ABD_method(self):
        "Method defined in A, B and D."
    def ACD_method(self):
        "Method defined in A, C and D."
    def ABCD_method(self):
        "Method defined in A, B, C and D."



            

Reported by Pylint.

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

Line: 21 Column: 5

                      "Method defined in A, B and D."
    def ACD_method(self):
        "Method defined in A, C and D."
    def ABCD_method(self):
        "Method defined in A, B, C and D."


class B_classic(A_classic):
    "A classic class, derived from A_classic."

            

Reported by Pylint.

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

Line: 25 Column: 1

                      "Method defined in A, B, C and D."


class B_classic(A_classic):
    "A classic class, derived from A_classic."
    def AB_method(self):
        "Method defined in A and B."
    def ABC_method(self):
        "Method defined in A, B and C."

            

Reported by Pylint.

Lib/multiprocessing/queues.py
59 issues
Attempted relative import beyond top-level package
Error

Line: 25 Column: 1

              
import _multiprocessing

from . import connection
from . import context
_ForkingPickler = context.reduction.ForkingPickler

from .util import debug, info, Finalize, register_after_fork, is_exiting


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 26 Column: 1

              import _multiprocessing

from . import connection
from . import context
_ForkingPickler = context.reduction.ForkingPickler

from .util import debug, info, Finalize, register_after_fork, is_exiting

#

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 29 Column: 1

              from . import context
_ForkingPickler = context.reduction.ForkingPickler

from .util import debug, info, Finalize, register_after_fork, is_exiting

#
# Queue type using a pipe, buffer and thread
#


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 40 Column: 13

                  def __init__(self, maxsize=0, *, ctx):
        if maxsize <= 0:
            # Can raise ImportError (see issues #3770 and #23400)
            from .synchronize import SEM_VALUE_MAX as maxsize
        self._maxsize = maxsize
        self._reader, self._writer = connection.Pipe(duplex=False)
        self._rlock = ctx.Lock()
        self._opid = os.getpid()
        if sys.platform == 'win32':

            

Reported by Pylint.

Access to member '_notempty' before its definition line 75
Error

Line: 73 Column: 13

              
    def _reset(self, after_fork=False):
        if after_fork:
            self._notempty._at_fork_reinit()
        else:
            self._notempty = threading.Condition(threading.Lock())
        self._buffer = collections.deque()
        self._thread = None
        self._jointhread = None

            

Reported by Pylint.

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

Line: 281 Column: 1

                      Private API hook called when feeding data in the background thread
        raises an exception.  For overriding by concurrent.futures.
        """
        import traceback
        traceback.print_exc()


_sentinel = object()


            

Reported by Pylint.

Unused import _multiprocessing
Error

Line: 23 Column: 1

              
from queue import Empty, Full

import _multiprocessing

from . import connection
from . import context
_ForkingPickler = context.reduction.ForkingPickler


            

Reported by Pylint.

Access to a protected member _at_fork_reinit of a client class
Error

Line: 73 Column: 13

              
    def _reset(self, after_fork=False):
        if after_fork:
            self._notempty._at_fork_reinit()
        else:
            self._notempty = threading.Condition(threading.Lock())
        self._buffer = collections.deque()
        self._thread = None
        self._jointhread = None

            

Reported by Pylint.

Access to a protected member _semlock of a client class
Error

Line: 126 Column: 32

              
    def qsize(self):
        # Raises NotImplementedError on Mac OSX because of broken sem_getvalue()
        return self._maxsize - self._sem._semlock._get_value()

    def empty(self):
        return not self._poll()

    def full(self):

            

Reported by Pylint.

Access to a protected member _get_value of a client class
Error

Line: 126 Column: 32

              
    def qsize(self):
        # Raises NotImplementedError on Mac OSX because of broken sem_getvalue()
        return self._maxsize - self._sem._semlock._get_value()

    def empty(self):
        return not self._poll()

    def full(self):

            

Reported by Pylint.

Lib/test/test_importlib/extension/test_loader.py
58 issues
Attempted relative import beyond top-level package
Error

Line: 2 Column: 1

              from warnings import catch_warnings
from .. import abc
from .. import util

machinery = util.import_importlib('importlib.machinery')

import os.path
import sys
import types

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 3 Column: 1

              from warnings import catch_warnings
from .. import abc
from .. import util

machinery = util.import_importlib('importlib.machinery')

import os.path
import sys
import types

            

Reported by Pylint.

Unused catch_warnings imported from warnings
Error

Line: 1 Column: 1

              from warnings import catch_warnings
from .. import abc
from .. import util

machinery = util.import_importlib('importlib.machinery')

import os.path
import sys
import types

            

Reported by Pylint.

Unused assert_python_failure imported from test.support.script_helper
Error

Line: 14 Column: 1

              import warnings
import importlib.util
import importlib
from test.support.script_helper import assert_python_failure

class LoaderTests(abc.LoaderTests):

    """Test load_module() for extension modules."""


            

Reported by Pylint.

Unused variable 'finder'
Error

Line: 96 Column: 9

              
    def setUp(self):
        self.name = '_testmultiphase'
        finder = self.machinery.FileFinder(None)
        self.spec = importlib.util.find_spec(self.name)
        assert self.spec
        self.loader = self.machinery.ExtensionFileLoader(
            self.name, self.spec.origin)


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 135 Column: 17

                                              ('__package__', '')]:
                self.assertEqual(getattr(module, attr), value)
            with self.assertRaises(AttributeError):
                module.__path__
            self.assertIs(module, sys.modules[self.name])
            self.assertIsInstance(module.__loader__,
                                  self.machinery.ExtensionFileLoader)

    def test_functionality(self):

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 149 Column: 17

                          self.assertEqual(ex.demo('abcd'), 'abcd')
            self.assertEqual(ex.demo(), None)
            with self.assertRaises(AttributeError):
                ex.abc
            ex.abc = 0
            self.assertEqual(ex.abc, 0)
            self.assertEqual(module.foo(9, 9), 18)
            self.assertIsInstance(module.Str(), str)
            self.assertEqual(module.Str(1) + '23', '123')

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from warnings import catch_warnings
from .. import abc
from .. import util

machinery = util.import_importlib('importlib.machinery')

import os.path
import sys
import types

            

Reported by Pylint.

standard import "import os.path" should be placed before "from .. import abc"
Error

Line: 7 Column: 1

              
machinery = util.import_importlib('importlib.machinery')

import os.path
import sys
import types
import unittest
import warnings
import importlib.util

            

Reported by Pylint.

Import "import os.path" should be placed at the top of the module
Error

Line: 7 Column: 1

              
machinery = util.import_importlib('importlib.machinery')

import os.path
import sys
import types
import unittest
import warnings
import importlib.util

            

Reported by Pylint.