The following issues were found

Modules/_decimal/tests/bench.py
53 issues
Redefining name 'n' from outer scope (line 103)
Error

Line: 27 Column: 18

              #
def pi_float():
    """native float"""
    lasts, t, s, n, na, d, da = 0, 3.0, 3, 1, 0, 0, 24
    while s != lasts:
        lasts = s
        n, na = n+na, na+8
        d, da = d+da, da+32
        t = (t * n) / d

            

Reported by Pylint.

Redefining name 'n' from outer scope (line 103)
Error

Line: 39 Column: 18

              def pi_cdecimal():
    """cdecimal"""
    D = C.Decimal
    lasts, t, s, n, na, d, da = D(0), D(3), D(3), D(1), D(0), D(0), D(24)
    while s != lasts:
        lasts = s
        n, na = n+na, na+8
        d, da = d+da, da+32
        t = (t * n) / d

            

Reported by Pylint.

Redefining name 'n' from outer scope (line 103)
Error

Line: 51 Column: 18

              def pi_decimal():
    """decimal"""
    D = P.Decimal
    lasts, t, s, n, na, d, da = D(0), D(3), D(3), D(1), D(0), D(0), D(24)
    while s != lasts:
        lasts = s
        n, na = n+na, na+8
        d, da = d+da, da+32
        t = (t * n) / d

            

Reported by Pylint.

Redefining name 'n' from outer scope (line 103)
Error

Line: 60 Column: 15

                      s += t
    return s

def factorial(n, m):
    if (n > m):
        return factorial(m, n)
    elif m == 0:
        return 1
    elif n == m:

            

Reported by Pylint.

Positional arguments appear to be out of order
Error

Line: 62 Column: 16

              
def factorial(n, m):
    if (n > m):
        return factorial(m, n)
    elif m == 0:
        return 1
    elif n == m:
        return n
    else:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #
# Copyright (C) 2001-2012 Python Software Foundation. All Rights Reserved.
# Modified and extended by Stefan Krah.
#

# Usage: ../../../python bench.py


import time

            

Reported by Pylint.

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

Line: 27 Column: 15

              #
def pi_float():
    """native float"""
    lasts, t, s, n, na, d, da = 0, 3.0, 3, 1, 0, 0, 24
    while s != lasts:
        lasts = s
        n, na = n+na, na+8
        d, da = d+da, da+32
        t = (t * n) / d

            

Reported by Pylint.

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

Line: 27 Column: 12

              #
def pi_float():
    """native float"""
    lasts, t, s, n, na, d, da = 0, 3.0, 3, 1, 0, 0, 24
    while s != lasts:
        lasts = s
        n, na = n+na, na+8
        d, da = d+da, da+32
        t = (t * n) / d

            

Reported by Pylint.

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

Line: 27 Column: 28

              #
def pi_float():
    """native float"""
    lasts, t, s, n, na, d, da = 0, 3.0, 3, 1, 0, 0, 24
    while s != lasts:
        lasts = s
        n, na = n+na, na+8
        d, da = d+da, da+32
        t = (t * n) / d

            

Reported by Pylint.

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

Line: 27 Column: 25

              #
def pi_float():
    """native float"""
    lasts, t, s, n, na, d, da = 0, 3.0, 3, 1, 0, 0, 24
    while s != lasts:
        lasts = s
        n, na = n+na, na+8
        d, da = d+da, da+32
        t = (t * n) / d

            

Reported by Pylint.

Lib/idlelib/idle_test/test_codecontext.py
53 issues
Reimport 'mock' (imported line 5)
Error

Line: 9 Column: 1

              from test.support import requires
from tkinter import NSEW, Tk, Frame, Text, TclError

from unittest import mock
import re
from idlelib import config


usercfg = codecontext.idleConf.userCfg

            

Reported by Pylint.

Unused argument 'section'
Error

Line: 96 Column: 53

                      self.addCleanup(GetHighlight_patcher.stop)

        self.font_override = 'TkFixedFont'
        def mock_idleconf_GetFont(root, configType, section):
            return self.font_override
        GetFont_patcher = unittest.mock.patch.object(
            codecontext.idleConf, 'GetFont', mock_idleconf_GetFont)
        GetFont_patcher.start()
        self.addCleanup(GetFont_patcher.stop)

            

Reported by Pylint.

Unused argument 'configType'
Error

Line: 96 Column: 41

                      self.addCleanup(GetHighlight_patcher.stop)

        self.font_override = 'TkFixedFont'
        def mock_idleconf_GetFont(root, configType, section):
            return self.font_override
        GetFont_patcher = unittest.mock.patch.object(
            codecontext.idleConf, 'GetFont', mock_idleconf_GetFont)
        GetFont_patcher.start()
        self.addCleanup(GetFont_patcher.stop)

            

Reported by Pylint.

Unused argument 'root'
Error

Line: 96 Column: 35

                      self.addCleanup(GetHighlight_patcher.stop)

        self.font_override = 'TkFixedFont'
        def mock_idleconf_GetFont(root, configType, section):
            return self.font_override
        GetFont_patcher = unittest.mock.patch.object(
            codecontext.idleConf, 'GetFont', mock_idleconf_GetFont)
        GetFont_patcher.start()
        self.addCleanup(GetFont_patcher.stop)

            

Reported by Pylint.

standard import "import unittest" should be placed before "from idlelib import codecontext"
Error

Line: 4 Column: 1

              "Test codecontext, coverage 100%"

from idlelib import codecontext
import unittest
import unittest.mock
from test.support import requires
from tkinter import NSEW, Tk, Frame, Text, TclError

from unittest import mock

            

Reported by Pylint.

standard import "import unittest.mock" should be placed before "from idlelib import codecontext"
Error

Line: 5 Column: 1

              
from idlelib import codecontext
import unittest
import unittest.mock
from test.support import requires
from tkinter import NSEW, Tk, Frame, Text, TclError

from unittest import mock
import re

            

Reported by Pylint.

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

Line: 6 Column: 1

              from idlelib import codecontext
import unittest
import unittest.mock
from test.support import requires
from tkinter import NSEW, Tk, Frame, Text, TclError

from unittest import mock
import re
from idlelib import config

            

Reported by Pylint.

standard import "from tkinter import NSEW, Tk, Frame, Text, TclError" should be placed before "from idlelib import codecontext"
Error

Line: 7 Column: 1

              import unittest
import unittest.mock
from test.support import requires
from tkinter import NSEW, Tk, Frame, Text, TclError

from unittest import mock
import re
from idlelib import config


            

Reported by Pylint.

standard import "from unittest import mock" should be placed before "from idlelib import codecontext"
Error

Line: 9 Column: 1

              from test.support import requires
from tkinter import NSEW, Tk, Frame, Text, TclError

from unittest import mock
import re
from idlelib import config


usercfg = codecontext.idleConf.userCfg

            

Reported by Pylint.

standard import "import re" should be placed before "from idlelib import codecontext"
Error

Line: 10 Column: 1

              from tkinter import NSEW, Tk, Frame, Text, TclError

from unittest import mock
import re
from idlelib import config


usercfg = codecontext.idleConf.userCfg
testcfg = {

            

Reported by Pylint.

Lib/test/test_stat.py
52 issues
Chmod setting a permissive mask 0o7 on file (TESTFN).
Security

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

                          self.assertEqual(self.statmod.S_IMODE(st_mode),
                             self.statmod.S_IRWXG)

            os.chmod(TESTFN, 0o007)
            st_mode, modestr = self.get_mode()
            self.assertEqual(modestr, '-------rwx')
            self.assertS_IS("REG", st_mode)
            self.assertEqual(self.statmod.S_IMODE(st_mode),
                             self.statmod.S_IRWXO)

            

Reported by Bandit.

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

Line: 102 Column: 9

                  def assertS_IS(self, name, mode):
        # test format, lstrip is for S_IFIFO
        fmt = getattr(self.statmod, "S_IF" + name.lstrip("F"))
        self.assertEqual(self.statmod.S_IFMT(mode), fmt)
        # test that just one function returns true
        testname = "S_IS" + name
        for funcname in self.format_funcs:
            func = getattr(self.statmod, funcname, None)
            if func is None:

            

Reported by Pylint.

Instance of 'TestFilemode' has no 'assertTrue' member
Error

Line: 112 Column: 17

                                  raise ValueError(funcname)
                continue
            if funcname == testname:
                self.assertTrue(func(mode))
            else:
                self.assertFalse(func(mode))

    def test_mode(self):
        with open(TESTFN, 'w'):

            

Reported by Pylint.

Instance of 'TestFilemode' has no 'assertFalse' member
Error

Line: 114 Column: 17

                          if funcname == testname:
                self.assertTrue(func(mode))
            else:
                self.assertFalse(func(mode))

    def test_mode(self):
        with open(TESTFN, 'w'):
            pass
        if os.name == 'posix':

            

Reported by Pylint.

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

Line: 122 Column: 13

                      if os.name == 'posix':
            os.chmod(TESTFN, 0o700)
            st_mode, modestr = self.get_mode()
            self.assertEqual(modestr, '-rwx------')
            self.assertS_IS("REG", st_mode)
            self.assertEqual(self.statmod.S_IMODE(st_mode),
                             self.statmod.S_IRWXU)

            os.chmod(TESTFN, 0o070)

            

Reported by Pylint.

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

Line: 124 Column: 13

                          st_mode, modestr = self.get_mode()
            self.assertEqual(modestr, '-rwx------')
            self.assertS_IS("REG", st_mode)
            self.assertEqual(self.statmod.S_IMODE(st_mode),
                             self.statmod.S_IRWXU)

            os.chmod(TESTFN, 0o070)
            st_mode, modestr = self.get_mode()
            self.assertEqual(modestr, '----rwx---')

            

Reported by Pylint.

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

Line: 129 Column: 13

              
            os.chmod(TESTFN, 0o070)
            st_mode, modestr = self.get_mode()
            self.assertEqual(modestr, '----rwx---')
            self.assertS_IS("REG", st_mode)
            self.assertEqual(self.statmod.S_IMODE(st_mode),
                             self.statmod.S_IRWXG)

            os.chmod(TESTFN, 0o007)

            

Reported by Pylint.

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

Line: 131 Column: 13

                          st_mode, modestr = self.get_mode()
            self.assertEqual(modestr, '----rwx---')
            self.assertS_IS("REG", st_mode)
            self.assertEqual(self.statmod.S_IMODE(st_mode),
                             self.statmod.S_IRWXG)

            os.chmod(TESTFN, 0o007)
            st_mode, modestr = self.get_mode()
            self.assertEqual(modestr, '-------rwx')

            

Reported by Pylint.

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

Line: 136 Column: 13

              
            os.chmod(TESTFN, 0o007)
            st_mode, modestr = self.get_mode()
            self.assertEqual(modestr, '-------rwx')
            self.assertS_IS("REG", st_mode)
            self.assertEqual(self.statmod.S_IMODE(st_mode),
                             self.statmod.S_IRWXO)

            os.chmod(TESTFN, 0o444)

            

Reported by Pylint.

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

Line: 138 Column: 13

                          st_mode, modestr = self.get_mode()
            self.assertEqual(modestr, '-------rwx')
            self.assertS_IS("REG", st_mode)
            self.assertEqual(self.statmod.S_IMODE(st_mode),
                             self.statmod.S_IRWXO)

            os.chmod(TESTFN, 0o444)
            st_mode, modestr = self.get_mode()
            self.assertS_IS("REG", st_mode)

            

Reported by Pylint.

Lib/http/cookies.py
52 issues
Redefining built-in 'str'
Error

Line: 174 Column: 12

              
_is_legal_key = re.compile('[%s]+' % re.escape(_LegalChars)).fullmatch

def _quote(str):
    r"""Quote a string for use in a cookie header.

    If the string does not need to be double-quoted, then just return the
    string.  Otherwise, surround the string in doublequotes and quote
    (with a \) special characters.

            

Reported by Pylint.

Redefining built-in 'str'
Error

Line: 190 Column: 14

              _OctalPatt = re.compile(r"\\[0-3][0-7][0-7]")
_QuotePatt = re.compile(r"[\\].")

def _unquote(str):
    # If there aren't any doublequotes,
    # then there can't be any special characters.  See RFC 2109.
    if str is None or len(str) < 2:
        return str
    if str[0] != '"' or str[-1] != '"':

            

Reported by Pylint.

Dangerous default value _monthname (builtins.list) as argument
Error

Line: 246 Column: 1

                            'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
              'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']

def _getdate(future=0, weekdayname=_weekdayname, monthname=_monthname):
    from time import gmtime, time
    now = time()
    year, month, day, hh, mm, ss, wd, y, z = gmtime(now + future)
    return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % \
           (weekdayname[wd], day, monthname[month], year, hh, mm, ss)

            

Reported by Pylint.

Dangerous default value _weekdayname (builtins.list) as argument
Error

Line: 246 Column: 1

                            'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
              'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']

def _getdate(future=0, weekdayname=_weekdayname, monthname=_monthname):
    from time import gmtime, time
    now = time()
    year, month, day, hh, mm, ss, wd, y, z = gmtime(now + future)
    return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % \
           (weekdayname[wd], day, monthname[month], year, hh, mm, ss)

            

Reported by Pylint.

Unused variable 'y'
Error

Line: 249 Column: 39

              def _getdate(future=0, weekdayname=_weekdayname, monthname=_monthname):
    from time import gmtime, time
    now = time()
    year, month, day, hh, mm, ss, wd, y, z = gmtime(now + future)
    return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % \
           (weekdayname[wd], day, monthname[month], year, hh, mm, ss)


class Morsel(dict):

            

Reported by Pylint.

Unused variable 'z'
Error

Line: 249 Column: 42

              def _getdate(future=0, weekdayname=_weekdayname, monthname=_monthname):
    from time import gmtime, time
    now = time()
    year, month, day, hh, mm, ss, wd, y, z = gmtime(now + future)
    return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % \
           (weekdayname[wd], day, monthname[month], year, hh, mm, ss)


class Morsel(dict):

            

Reported by Pylint.

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

Line: 289 Column: 5

              
    _flags = {'secure', 'httponly'}

    def __init__(self):
        # Set defaults
        self._key = self._value = self._coded_value = None

        # Set default attributes
        for key in self._reserved:

            

Reported by Pylint.

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

Line: 481 Column: 5

                      strval = str(val)
        return strval, strval

    def __init__(self, input=None):
        if input:
            self.load(input)

    def __set(self, key, real_value, coded_value):
        """Private method for setting a cookie's value"""

            

Reported by Pylint.

Redefining built-in 'input'
Error

Line: 481 Column: 24

                      strval = str(val)
        return strval, strval

    def __init__(self, input=None):
        if input:
            self.load(input)

    def __set(self, key, real_value, coded_value):
        """Private method for setting a cookie's value"""

            

Reported by Pylint.

Unused variable 'key'
Error

Line: 504 Column: 13

                      """Return a string suitable for HTTP."""
        result = []
        items = sorted(self.items())
        for key, value in items:
            result.append(value.output(attrs, header))
        return sep.join(result)

    __str__ = output


            

Reported by Pylint.

Lib/test/test_email/test__encoded_words.py
52 issues
Dangerous default value [] as argument
Error

Line: 9 Column: 5

              
class TestDecodeQ(TestEmailBase):

    def _test(self, source, ex_result, ex_defects=[]):
        result, defects = _ew.decode_q(source)
        self.assertEqual(result, ex_result)
        self.assertDefectsEqual(defects, ex_defects)

    def test_no_encoded(self):

            

Reported by Pylint.

Dangerous default value [] as argument
Error

Line: 27 Column: 5

              
class TestDecodeB(TestEmailBase):

    def _test(self, source, ex_result, ex_defects=[]):
        result, defects = _ew.decode_b(source)
        self.assertEqual(result, ex_result)
        self.assertDefectsEqual(defects, ex_defects)

    def test_simple(self):

            

Reported by Pylint.

Dangerous default value [] as argument
Error

Line: 64 Column: 5

                      with self.assertRaises(KeyError):
            _ew.decode('=?utf-8?X?somevalue?=')

    def _test(self, source, result, charset='us-ascii', lang='', defects=[]):
        res, char, l, d = _ew.decode(source)
        self.assertEqual(res, result)
        self.assertEqual(char, charset)
        self.assertEqual(l, lang)
        self.assertDefectsEqual(d, defects)

            

Reported by Pylint.

XXX Should this be a new Defect instead?
Error

Line: 130 Column: 3

                      self._test('=?foobar?q?foo=ACbar?=',
                   b'foo\xacbar'.decode('ascii', 'surrogateescape'),
                   charset = 'foobar',
                   # XXX Should this be a new Defect instead?
                   defects = [errors.CharsetError])

    def test_q_nonascii(self):
        self._test('=?utf-8?q?=C3=89ric?=',
                   'Éric',

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import unittest
from email import _encoded_words as _ew
from email import errors
from test.test_email import TestEmailBase


class TestDecodeQ(TestEmailBase):

    def _test(self, source, ex_result, ex_defects=[]):

            

Reported by Pylint.

Missing class docstring
Error

Line: 7 Column: 1

              from test.test_email import TestEmailBase


class TestDecodeQ(TestEmailBase):

    def _test(self, source, ex_result, ex_defects=[]):
        result, defects = _ew.decode_q(source)
        self.assertEqual(result, ex_result)
        self.assertDefectsEqual(defects, ex_defects)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 14 Column: 5

                      self.assertEqual(result, ex_result)
        self.assertDefectsEqual(defects, ex_defects)

    def test_no_encoded(self):
        self._test(b'foobar', b'foobar')

    def test_spaces(self):
        self._test(b'foo=20bar=20', b'foo bar ')
        self._test(b'foo_bar_', b'foo bar ')

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 5

                  def test_no_encoded(self):
        self._test(b'foobar', b'foobar')

    def test_spaces(self):
        self._test(b'foo=20bar=20', b'foo bar ')
        self._test(b'foo_bar_', b'foo bar ')

    def test_run_of_encoded(self):
        self._test(b'foo=20=20=21=2Cbar', b'foo  !,bar')

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 21 Column: 5

                      self._test(b'foo=20bar=20', b'foo bar ')
        self._test(b'foo_bar_', b'foo bar ')

    def test_run_of_encoded(self):
        self._test(b'foo=20=20=21=2Cbar', b'foo  !,bar')


class TestDecodeB(TestEmailBase):


            

Reported by Pylint.

Missing class docstring
Error

Line: 25 Column: 1

                      self._test(b'foo=20=20=21=2Cbar', b'foo  !,bar')


class TestDecodeB(TestEmailBase):

    def _test(self, source, ex_result, ex_defects=[]):
        result, defects = _ew.decode_b(source)
        self.assertEqual(result, ex_result)
        self.assertDefectsEqual(defects, ex_defects)

            

Reported by Pylint.

Lib/tkinter/test/test_tkinter/test_images.py
52 issues
Access to a protected member _join of a client class
Error

Line: 161 Column: 20

                      if tkinter.TkVersion >= 8.6 and self.wantobjects:
            return args
        else:
            return tkinter._join(args)

    def check_create_from_file(self, ext):
        testfile = support.findfile('python.' + ext, subdir='imghdrdata')
        image = tkinter.PhotoImage('::img::test', master=self.root,
                                   file=testfile)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import unittest
import tkinter
from test import support
from test.support import os_helper
from tkinter.test.support import AbstractTkTest, AbstractDefaultRootTest, requires_tcl

support.requires('gui')



            

Reported by Pylint.

Missing class docstring
Error

Line: 10 Column: 1

              support.requires('gui')


class MiscTest(AbstractTkTest, unittest.TestCase):

    def test_image_types(self):
        image_types = self.root.image_types()
        self.assertIsInstance(image_types, tuple)
        self.assertIn('photo', image_types)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 12 Column: 5

              
class MiscTest(AbstractTkTest, unittest.TestCase):

    def test_image_types(self):
        image_types = self.root.image_types()
        self.assertIsInstance(image_types, tuple)
        self.assertIn('photo', image_types)
        self.assertIn('bitmap', image_types)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 18 Column: 5

                      self.assertIn('photo', image_types)
        self.assertIn('bitmap', image_types)

    def test_image_names(self):
        image_names = self.root.image_names()
        self.assertIsInstance(image_names, tuple)


class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):

            

Reported by Pylint.

Missing class docstring
Error

Line: 23 Column: 1

                      self.assertIsInstance(image_names, tuple)


class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):

    def test_image_types(self):
        self.assertRaises(RuntimeError, tkinter.image_types)
        root = tkinter.Tk()
        image_types = tkinter.image_types()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 25 Column: 5

              
class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):

    def test_image_types(self):
        self.assertRaises(RuntimeError, tkinter.image_types)
        root = tkinter.Tk()
        image_types = tkinter.image_types()
        self.assertIsInstance(image_types, tuple)
        self.assertIn('photo', image_types)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 36 Column: 5

                      tkinter.NoDefaultRoot()
        self.assertRaises(RuntimeError, tkinter.image_types)

    def test_image_names(self):
        self.assertRaises(RuntimeError, tkinter.image_names)
        root = tkinter.Tk()
        image_names = tkinter.image_names()
        self.assertIsInstance(image_names, tuple)
        root.destroy()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 45 Column: 5

                      tkinter.NoDefaultRoot()
        self.assertRaises(RuntimeError, tkinter.image_names)

    def test_image_create_bitmap(self):
        self.assertRaises(RuntimeError, tkinter.BitmapImage)
        root = tkinter.Tk()
        image = tkinter.BitmapImage()
        self.assertIn(image.name, tkinter.image_names())
        root.destroy()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 54 Column: 5

                      tkinter.NoDefaultRoot()
        self.assertRaises(RuntimeError, tkinter.BitmapImage)

    def test_image_create_photo(self):
        self.assertRaises(RuntimeError, tkinter.PhotoImage)
        root = tkinter.Tk()
        image = tkinter.PhotoImage()
        self.assertIn(image.name, tkinter.image_names())
        root.destroy()

            

Reported by Pylint.

Tools/scripts/reindent.py
52 issues
Using the global statement
Error

Line: 71 Column: 5

              
def main():
    import getopt
    global verbose, recurse, dryrun, makebackup, spec_newline
    try:
        opts, args = getopt.getopt(sys.argv[1:], "drnvh",
            ["dryrun", "recurse", "nobackup", "verbose", "newline=", "help"])
    except getopt.error as msg:
        usage(msg)

            

Reported by Pylint.

Attribute 'after' defined outside __init__
Error

Line: 215 Column: 17

                      # Map count of leading spaces to # we want.
        have2want = {}
        # Program after transformation.
        after = self.after = []
        # Copy over initial empty lines -- there's nothing to do until
        # we see a line with *something* on it.
        i = stats[0][0]
        after.extend(lines[1:i])
        for i in range(len(stats) - 1):

            

Reported by Pylint.

Unused argument 'end'
Error

Line: 285 Column: 49

                      return line

    # Line-eater for tokenize.
    def tokeneater(self, type, token, slinecol, end, line,
                   INDENT=tokenize.INDENT,
                   DEDENT=tokenize.DEDENT,
                   NEWLINE=tokenize.NEWLINE,
                   COMMENT=tokenize.COMMENT,
                   NL=tokenize.NL):

            

Reported by Pylint.

Unused argument 'token'
Error

Line: 285 Column: 32

                      return line

    # Line-eater for tokenize.
    def tokeneater(self, type, token, slinecol, end, line,
                   INDENT=tokenize.INDENT,
                   DEDENT=tokenize.DEDENT,
                   NEWLINE=tokenize.NEWLINE,
                   COMMENT=tokenize.COMMENT,
                   NL=tokenize.NL):

            

Reported by Pylint.

Redefining built-in 'type'
Error

Line: 285 Column: 26

                      return line

    # Line-eater for tokenize.
    def tokeneater(self, type, token, slinecol, end, line,
                   INDENT=tokenize.INDENT,
                   DEDENT=tokenize.DEDENT,
                   NEWLINE=tokenize.NEWLINE,
                   COMMENT=tokenize.COMMENT,
                   NL=tokenize.NL):

            

Reported by Pylint.

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

Line: 51 Column: 1

              import shutil
import sys

verbose = False
recurse = False
dryrun = False
makebackup = True
# A specified newline to be used in the output (set by --newline option)
spec_newline = None

            

Reported by Pylint.

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

Line: 52 Column: 1

              import sys

verbose = False
recurse = False
dryrun = False
makebackup = True
# A specified newline to be used in the output (set by --newline option)
spec_newline = None


            

Reported by Pylint.

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

Line: 53 Column: 1

              
verbose = False
recurse = False
dryrun = False
makebackup = True
# A specified newline to be used in the output (set by --newline option)
spec_newline = None



            

Reported by Pylint.

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

Line: 54 Column: 1

              verbose = False
recurse = False
dryrun = False
makebackup = True
# A specified newline to be used in the output (set by --newline option)
spec_newline = None


def usage(msg=None):

            

Reported by Pylint.

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

Line: 56 Column: 1

              dryrun = False
makebackup = True
# A specified newline to be used in the output (set by --newline option)
spec_newline = None


def usage(msg=None):
    if msg is None:
        msg = __doc__

            

Reported by Pylint.

Tools/pynche/TypeinViewer.py
52 issues
Unable to import 'tkinter'
Error

Line: 15 Column: 1

              you must hit Return or Tab to select the color.
"""

from tkinter import *



class TypeinViewer:
    def __init__(self, switchboard, master=None):

            

Reported by Pylint.

Undefined variable 'BooleanVar'
Error

Line: 24 Column: 23

                      # non-gui ivars
        self.__sb = switchboard
        optiondb = switchboard.optiondb()
        self.__hexp = BooleanVar()
        self.__hexp.set(optiondb.get('HEXTYPE', 0))
        self.__uwtyping = BooleanVar()
        self.__uwtyping.set(optiondb.get('UPWHILETYPE', 0))
        # create the gui
        self.__frame = Frame(master, relief=RAISED, borderwidth=1)

            

Reported by Pylint.

Undefined variable 'BooleanVar'
Error

Line: 26 Column: 27

                      optiondb = switchboard.optiondb()
        self.__hexp = BooleanVar()
        self.__hexp.set(optiondb.get('HEXTYPE', 0))
        self.__uwtyping = BooleanVar()
        self.__uwtyping.set(optiondb.get('UPWHILETYPE', 0))
        # create the gui
        self.__frame = Frame(master, relief=RAISED, borderwidth=1)
        self.__frame.grid(row=3, column=1, sticky='NSEW')
        # Red

            

Reported by Pylint.

Undefined variable 'Frame'
Error

Line: 29 Column: 24

                      self.__uwtyping = BooleanVar()
        self.__uwtyping.set(optiondb.get('UPWHILETYPE', 0))
        # create the gui
        self.__frame = Frame(master, relief=RAISED, borderwidth=1)
        self.__frame.grid(row=3, column=1, sticky='NSEW')
        # Red
        self.__xl = Label(self.__frame, text='Red:')
        self.__xl.grid(row=0, column=0, sticky=E)
        subframe = Frame(self.__frame)

            

Reported by Pylint.

Undefined variable 'RAISED'
Error

Line: 29 Column: 45

                      self.__uwtyping = BooleanVar()
        self.__uwtyping.set(optiondb.get('UPWHILETYPE', 0))
        # create the gui
        self.__frame = Frame(master, relief=RAISED, borderwidth=1)
        self.__frame.grid(row=3, column=1, sticky='NSEW')
        # Red
        self.__xl = Label(self.__frame, text='Red:')
        self.__xl.grid(row=0, column=0, sticky=E)
        subframe = Frame(self.__frame)

            

Reported by Pylint.

Undefined variable 'Label'
Error

Line: 32 Column: 21

                      self.__frame = Frame(master, relief=RAISED, borderwidth=1)
        self.__frame.grid(row=3, column=1, sticky='NSEW')
        # Red
        self.__xl = Label(self.__frame, text='Red:')
        self.__xl.grid(row=0, column=0, sticky=E)
        subframe = Frame(self.__frame)
        subframe.grid(row=0, column=1)
        self.__xox = Label(subframe, text='0x')
        self.__xox.grid(row=0, column=0, sticky=E)

            

Reported by Pylint.

Undefined variable 'E'
Error

Line: 33 Column: 48

                      self.__frame.grid(row=3, column=1, sticky='NSEW')
        # Red
        self.__xl = Label(self.__frame, text='Red:')
        self.__xl.grid(row=0, column=0, sticky=E)
        subframe = Frame(self.__frame)
        subframe.grid(row=0, column=1)
        self.__xox = Label(subframe, text='0x')
        self.__xox.grid(row=0, column=0, sticky=E)
        self.__xox['font'] = 'courier'

            

Reported by Pylint.

Undefined variable 'Frame'
Error

Line: 34 Column: 20

                      # Red
        self.__xl = Label(self.__frame, text='Red:')
        self.__xl.grid(row=0, column=0, sticky=E)
        subframe = Frame(self.__frame)
        subframe.grid(row=0, column=1)
        self.__xox = Label(subframe, text='0x')
        self.__xox.grid(row=0, column=0, sticky=E)
        self.__xox['font'] = 'courier'
        self.__x = Entry(subframe, width=3)

            

Reported by Pylint.

Undefined variable 'Label'
Error

Line: 36 Column: 22

                      self.__xl.grid(row=0, column=0, sticky=E)
        subframe = Frame(self.__frame)
        subframe.grid(row=0, column=1)
        self.__xox = Label(subframe, text='0x')
        self.__xox.grid(row=0, column=0, sticky=E)
        self.__xox['font'] = 'courier'
        self.__x = Entry(subframe, width=3)
        self.__x.grid(row=0, column=1)
        self.__x.bindtags(self.__x.bindtags() + ('Normalize', 'Update'))

            

Reported by Pylint.

Undefined variable 'E'
Error

Line: 37 Column: 49

                      subframe = Frame(self.__frame)
        subframe.grid(row=0, column=1)
        self.__xox = Label(subframe, text='0x')
        self.__xox.grid(row=0, column=0, sticky=E)
        self.__xox['font'] = 'courier'
        self.__x = Entry(subframe, width=3)
        self.__x.grid(row=0, column=1)
        self.__x.bindtags(self.__x.bindtags() + ('Normalize', 'Update'))
        self.__x.bind_class('Normalize', '<Key>', self.__normalize)

            

Reported by Pylint.

Lib/concurrent/futures/_base.py
52 issues
Unnecessary pass statement
Error

Line: 47 Column: 5

              
class Error(Exception):
    """Base class for all future-related exceptions."""
    pass

class CancelledError(Error):
    """The Future was cancelled."""
    pass


            

Reported by Pylint.

Unnecessary pass statement
Error

Line: 51 Column: 5

              
class CancelledError(Error):
    """The Future was cancelled."""
    pass

class TimeoutError(Error):
    """The operation exceeded the given deadline."""
    pass


            

Reported by Pylint.

Redefining built-in 'TimeoutError'
Error

Line: 53 Column: 1

                  """The Future was cancelled."""
    pass

class TimeoutError(Error):
    """The operation exceeded the given deadline."""
    pass

class InvalidStateError(Error):
    """The operation is not allowed in this state."""

            

Reported by Pylint.

Unnecessary pass statement
Error

Line: 55 Column: 5

              
class TimeoutError(Error):
    """The operation exceeded the given deadline."""
    pass

class InvalidStateError(Error):
    """The operation is not allowed in this state."""
    pass


            

Reported by Pylint.

Unnecessary pass statement
Error

Line: 59 Column: 5

              
class InvalidStateError(Error):
    """The operation is not allowed in this state."""
    pass

class _Waiter(object):
    """Provides the event that wait() and as_completed() block on."""
    def __init__(self):
        self.event = threading.Event()

            

Reported by Pylint.

Access to a protected member _state of a client class
Error

Line: 164 Column: 17

                      waiter = _FirstCompletedWaiter()
    else:
        pending_count = sum(
                f._state not in [CANCELLED_AND_NOTIFIED, FINISHED] for f in fs)

        if return_when == FIRST_EXCEPTION:
            waiter = _AllCompletedWaiter(pending_count, stop_on_exception=True)
        elif return_when == ALL_COMPLETED:
            waiter = _AllCompletedWaiter(pending_count, stop_on_exception=False)

            

Reported by Pylint.

Access to a protected member _waiters of a client class
Error

Line: 174 Column: 9

                          raise ValueError("Invalid return condition: %r" % return_when)

    for f in fs:
        f._waiters.append(waiter)

    return waiter


def _yield_finished_futures(fs, waiter, ref_collect):

            

Reported by Pylint.

Access to a protected member _condition of a client class
Error

Line: 194 Column: 14

                      f = fs[-1]
        for futures_set in ref_collect:
            futures_set.remove(f)
        with f._condition:
            f._waiters.remove(waiter)
        del f
        # Careful not to keep a reference to the popped value
        yield fs.pop()


            

Reported by Pylint.

Access to a protected member _waiters of a client class
Error

Line: 195 Column: 13

                      for futures_set in ref_collect:
            futures_set.remove(f)
        with f._condition:
            f._waiters.remove(waiter)
        del f
        # Careful not to keep a reference to the popped value
        yield fs.pop()



            

Reported by Pylint.

Access to a protected member _state of a client class
Error

Line: 227 Column: 20

                  with _AcquireFutures(fs):
        finished = set(
                f for f in fs
                if f._state in [CANCELLED_AND_NOTIFIED, FINISHED])
        pending = fs - finished
        waiter = _create_and_install_waiters(fs, _AS_COMPLETED)
    finished = list(finished)
    try:
        yield from _yield_finished_futures(finished, waiter,

            

Reported by Pylint.

Lib/test/test_multiprocessing_main_handling.py
51 issues
Unused variable 'script_name'
Error

Line: 208 Column: 13

                  def test_directory(self):
        source = self.main_in_children_source
        with os_helper.temp_dir() as script_dir:
            script_name = _make_test_script(script_dir, '__main__',
                                            source=source)
            self._check_script(script_dir)

    def test_directory_compiled(self):
        source = self.main_in_children_source

            

Reported by Pylint.

Unused variable 'pyc_file'
Error

Line: 219 Column: 13

                                                          source=source)
            py_compile.compile(script_name, doraise=True)
            os.remove(script_name)
            pyc_file = import_helper.make_legacy_pyc(script_name)
            self._check_script(script_dir)

    def test_zipfile(self):
        source = self.main_in_children_source
        with os_helper.temp_dir() as script_dir:

            

Reported by Pylint.

Unused variable 'run_name'
Error

Line: 227 Column: 23

                      with os_helper.temp_dir() as script_dir:
            script_name = _make_test_script(script_dir, '__main__',
                                            source=source)
            zip_name, run_name = make_zip_script(script_dir, 'test_zip', script_name)
            self._check_script(zip_name)

    def test_zipfile_compiled(self):
        source = self.main_in_children_source
        with os_helper.temp_dir() as script_dir:

            

Reported by Pylint.

Unused variable 'run_name'
Error

Line: 236 Column: 23

                          script_name = _make_test_script(script_dir, '__main__',
                                            source=source)
            compiled_name = py_compile.compile(script_name, doraise=True)
            zip_name, run_name = make_zip_script(script_dir, 'test_zip', compiled_name)
            self._check_script(zip_name)

    def test_module_in_package(self):
        with os_helper.temp_dir() as script_dir:
            pkg_dir = os.path.join(script_dir, 'test_pkg')

            

Reported by Pylint.

Unused variable 'script_name'
Error

Line: 243 Column: 13

                      with os_helper.temp_dir() as script_dir:
            pkg_dir = os.path.join(script_dir, 'test_pkg')
            make_pkg(pkg_dir)
            script_name = _make_test_script(pkg_dir, 'check_sibling')
            launch_name = _make_launch_script(script_dir, 'launch',
                                              'test_pkg.check_sibling')
            self._check_script(launch_name)

    def test_module_in_package_in_zipfile(self):

            

Reported by Pylint.

Unused variable 'run_name'
Error

Line: 250 Column: 23

              
    def test_module_in_package_in_zipfile(self):
        with os_helper.temp_dir() as script_dir:
            zip_name, run_name = _make_test_zip_pkg(script_dir, 'test_zip', 'test_pkg', 'script')
            launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.script', zip_name)
            self._check_script(launch_name)

    def test_module_in_subpackage_in_zipfile(self):
        with os_helper.temp_dir() as script_dir:

            

Reported by Pylint.

Unused variable 'run_name'
Error

Line: 256 Column: 23

              
    def test_module_in_subpackage_in_zipfile(self):
        with os_helper.temp_dir() as script_dir:
            zip_name, run_name = _make_test_zip_pkg(script_dir, 'test_zip', 'test_pkg', 'script', depth=2)
            launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.test_pkg.script', zip_name)
            self._check_script(launch_name)

    def test_package(self):
        source = self.main_in_children_source

            

Reported by Pylint.

Unused variable 'script_name'
Error

Line: 265 Column: 13

                      with os_helper.temp_dir() as script_dir:
            pkg_dir = os.path.join(script_dir, 'test_pkg')
            make_pkg(pkg_dir)
            script_name = _make_test_script(pkg_dir, '__main__',
                                            source=source)
            launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg')
            self._check_script(launch_name)

    def test_package_compiled(self):

            

Reported by Pylint.

Unused variable 'compiled_name'
Error

Line: 277 Column: 13

                          make_pkg(pkg_dir)
            script_name = _make_test_script(pkg_dir, '__main__',
                                            source=source)
            compiled_name = py_compile.compile(script_name, doraise=True)
            os.remove(script_name)
            pyc_file = import_helper.make_legacy_pyc(script_name)
            launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg')
            self._check_script(launch_name)


            

Reported by Pylint.

Unused variable 'pyc_file'
Error

Line: 279 Column: 13

                                                          source=source)
            compiled_name = py_compile.compile(script_name, doraise=True)
            os.remove(script_name)
            pyc_file = import_helper.make_legacy_pyc(script_name)
            launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg')
            self._check_script(launch_name)

# Test all supported start methods (setupClass skips as appropriate)


            

Reported by Pylint.