The following issues were found

Lib/lib2to3/fixes/fix_imports2.py
3 issues
Attempted relative import beyond top-level package
Error

Line: 3 Column: 1

              """Fix incompatible imports and module references that must be fixed after
fix_imports."""
from . import fix_imports


MAPPING = {
            'whichdb': 'dbm',
            'anydbm': 'dbm',
          }

            

Reported by Pylint.

Missing class docstring
Error

Line: 12 Column: 1

                        }


class FixImports2(fix_imports.FixImports):

    run_order = 7

    mapping = MAPPING

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 12 Column: 1

                        }


class FixImports2(fix_imports.FixImports):

    run_order = 7

    mapping = MAPPING

            

Reported by Pylint.

Lib/_compression.py
3 issues
Using a conditional statement with a constant value
Error

Line: 13 Column: 9

                  """Mode-checking helper functions."""

    def _check_not_closed(self):
        if self.closed:
            raise ValueError("I/O operation on closed file")

    def _check_can_read(self):
        if not self.readable():
            raise io.UnsupportedOperation("File not open for reading")

            

Reported by Pylint.

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

Line: 39 Column: 5

                  def readable(self):
        return True

    def __init__(self, fp, decomp_factory, trailing_error=(), **decomp_args):
        self._fp = fp
        self._eof = False
        self._pos = 0  # Current offset in decompressed stream

        # Set to size of decompressed stream once it is known, for SEEK_END

            

Reported by Pylint.

Too many instance attributes (8/7)
Error

Line: 33 Column: 1

                                                        "does not support seeking")


class DecompressReader(io.RawIOBase):
    """Adapts the decompressor API to a RawIOBase reader API"""

    def readable(self):
        return True


            

Reported by Pylint.

Lib/ctypes/test/__init__.py
3 issues
Missing module docstring
Error

Line: 1 Column: 1

              import os
import unittest
from test import support
from test.support import import_helper


# skip tests if _ctypes was not built
ctypes = import_helper.import_module('ctypes')
ctypes_symbols = dir(ctypes)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 1

              ctypes = import_helper.import_module('ctypes')
ctypes_symbols = dir(ctypes)

def need_symbol(name):
    return unittest.skipUnless(name in ctypes_symbols,
                               '{!r} is required'.format(name))

def load_tests(*args):
    return support.load_package_tests(os.path.dirname(__file__), *args)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 15 Column: 1

                  return unittest.skipUnless(name in ctypes_symbols,
                               '{!r} is required'.format(name))

def load_tests(*args):
    return support.load_package_tests(os.path.dirname(__file__), *args)

            

Reported by Pylint.

Lib/distutils/tests/test_install_headers.py
3 issues
Missing class docstring
Error

Line: 9 Column: 1

              from distutils.tests import support
from test.support import run_unittest

class InstallHeadersTestCase(support.TempdirManager,
                             support.LoggingSilencer,
                             support.EnvironGuard,
                             unittest.TestCase):

    def test_simple_run(self):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 14 Column: 5

                                           support.EnvironGuard,
                             unittest.TestCase):

    def test_simple_run(self):
        # we have two headers
        header_list = self.mkdtemp()
        header1 = os.path.join(header_list, 'header1')
        header2 = os.path.join(header_list, 'header2')
        self.write_file(header1)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 35 Column: 1

                      # let's check the results
        self.assertEqual(len(cmd.get_outputs()), 2)

def test_suite():
    return unittest.makeSuite(InstallHeadersTestCase)

if __name__ == "__main__":
    run_unittest(test_suite())

            

Reported by Pylint.

Lib/idlelib/history.py
3 issues
Unused argument 'event'
Error

Line: 31 Column: 28

                      text.bind("<<history-previous>>", self.history_prev)
        text.bind("<<history-next>>", self.history_next)

    def history_next(self, event):
        "Fetch later statement; start with earliest if cyclic."
        self.fetch(reverse=False)
        return "break"

    def history_prev(self, event):

            

Reported by Pylint.

Unused argument 'event'
Error

Line: 36 Column: 28

                      self.fetch(reverse=False)
        return "break"

    def history_prev(self, event):
        "Fetch earlier statement; start with most recent."
        self.fetch(reverse=True)
        return "break"

    def fetch(self, reverse):

            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 72 Column: 17

                          pointer += -1 if reverse else 1
            if pointer < 0 or pointer >= nhist:
                self.text.bell()
                if not self.cyclic and pointer < 0:  # abort history_prev
                    return
                else:
                    if self.text.get("iomark", "end-1c") != prefix:
                        self.text.delete("iomark", "end-1c")
                        self.text.insert("iomark", prefix, "stdin")

            

Reported by Pylint.

Doc/includes/sqlite3/adapter_datetime.py
3 issues
Missing module docstring
Error

Line: 1 Column: 1

              import sqlite3
import datetime
import time

def adapt_datetime(ts):
    return time.mktime(ts.timetuple())

sqlite3.register_adapter(datetime.datetime, adapt_datetime)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 5 Column: 1

              import datetime
import time

def adapt_datetime(ts):
    return time.mktime(ts.timetuple())

sqlite3.register_adapter(datetime.datetime, adapt_datetime)

con = sqlite3.connect(":memory:")

            

Reported by Pylint.

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

Line: 5 Column: 1

              import datetime
import time

def adapt_datetime(ts):
    return time.mktime(ts.timetuple())

sqlite3.register_adapter(datetime.datetime, adapt_datetime)

con = sqlite3.connect(":memory:")

            

Reported by Pylint.

Doc/includes/sqlite3/executemany_2.py
3 issues
Missing module docstring
Error

Line: 1 Column: 1

              import sqlite3
import string

def char_generator():
    for c in string.ascii_lowercase:
        yield (c,)

con = sqlite3.connect(":memory:")
cur = con.cursor()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 4 Column: 1

              import sqlite3
import string

def char_generator():
    for c in string.ascii_lowercase:
        yield (c,)

con = sqlite3.connect(":memory:")
cur = con.cursor()

            

Reported by Pylint.

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

Line: 5 Column: 9

              import string

def char_generator():
    for c in string.ascii_lowercase:
        yield (c,)

con = sqlite3.connect(":memory:")
cur = con.cursor()
cur.execute("create table characters(c)")

            

Reported by Pylint.

Doc/includes/email-read-alternative.py
3 issues
Unable to import 'imaginary'
Error

Line: 12 Column: 1

              from email.parser import BytesParser

# An imaginary module that would make this work and be safe.
from imaginary import magic_html_parser

# In a real program you'd get the filename from the arguments.
with open('outgoing.msg', 'rb') as fp:
    msg = BytesParser(policy=policy.default).parse(fp)


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import os
import sys
import tempfile
import mimetypes
import webbrowser

# Import the email modules we'll need
from email import policy
from email.parser import BytesParser

            

Reported by Pylint.

Module name "email-read-alternative" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              import os
import sys
import tempfile
import mimetypes
import webbrowser

# Import the email modules we'll need
from email import policy
from email.parser import BytesParser

            

Reported by Pylint.

Lib/json/tool.py
3 issues
Consider explicitly re-raising using the 'from' keyword
Error

Line: 71 Column: 13

                              json.dump(obj, outfile, **dump_args)
                outfile.write('\n')
        except ValueError as e:
            raise SystemExit(e)


if __name__ == '__main__':
    try:
        main()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 18 Column: 1

              import sys


def main():
    prog = 'python -m json.tool'
    description = ('A simple command line interface for json module '
                   'to validate and pretty-print JSON objects.')
    parser = argparse.ArgumentParser(prog=prog, description=description)
    parser.add_argument('infile', nargs='?',

            

Reported by Pylint.

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

Line: 70 Column: 9

                          for obj in objs:
                json.dump(obj, outfile, **dump_args)
                outfile.write('\n')
        except ValueError as e:
            raise SystemExit(e)


if __name__ == '__main__':
    try:

            

Reported by Pylint.

Include/pyhash.h
3 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 57 Column: 14 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              #ifndef Py_LIMITED_API
typedef union {
    /* ensure 24 bytes */
    unsigned char uc[24];
    /* two Py_hash_t for FNV */
    struct {
        Py_hash_t prefix;
        Py_hash_t suffix;
    } fnv;

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 70 Column: 18 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

                  } siphash;
    /* a different (!) Py_hash_t for small string optimization */
    struct {
        unsigned char padding[16];
        Py_hash_t suffix;
    } djbx33a;
    struct {
        unsigned char padding[16];
        Py_hash_t hashsalt;

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 74 Column: 18 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

                      Py_hash_t suffix;
    } djbx33a;
    struct {
        unsigned char padding[16];
        Py_hash_t hashsalt;
    } expat;
} _Py_HashSecret_t;
PyAPI_DATA(_Py_HashSecret_t) _Py_HashSecret;


            

Reported by FlawFinder.