The following issues were found

Lib/sre_constants.py
64 issues
Instance of '_NamedIntConstant' has no 'name' member
Error

Line: 63 Column: 16

                      return self

    def __repr__(self):
        return self.name

MAXREPEAT = _NamedIntConstant(MAXREPEAT, 'MAXREPEAT')

def _makecodes(names):
    names = names.strip().split()

            

Reported by Pylint.

Undefined variable 'LITERAL_IGNORE'
Error

Line: 150 Column: 14

              
# replacement operations for "ignore case" mode
OP_IGNORE = {
    LITERAL: LITERAL_IGNORE,
    NOT_LITERAL: NOT_LITERAL_IGNORE,
}

OP_LOCALE_IGNORE = {
    LITERAL: LITERAL_LOC_IGNORE,

            

Reported by Pylint.

Undefined variable 'LITERAL'
Error

Line: 150 Column: 5

              
# replacement operations for "ignore case" mode
OP_IGNORE = {
    LITERAL: LITERAL_IGNORE,
    NOT_LITERAL: NOT_LITERAL_IGNORE,
}

OP_LOCALE_IGNORE = {
    LITERAL: LITERAL_LOC_IGNORE,

            

Reported by Pylint.

Undefined variable 'NOT_LITERAL_IGNORE'
Error

Line: 151 Column: 18

              # replacement operations for "ignore case" mode
OP_IGNORE = {
    LITERAL: LITERAL_IGNORE,
    NOT_LITERAL: NOT_LITERAL_IGNORE,
}

OP_LOCALE_IGNORE = {
    LITERAL: LITERAL_LOC_IGNORE,
    NOT_LITERAL: NOT_LITERAL_LOC_IGNORE,

            

Reported by Pylint.

Undefined variable 'NOT_LITERAL'
Error

Line: 151 Column: 5

              # replacement operations for "ignore case" mode
OP_IGNORE = {
    LITERAL: LITERAL_IGNORE,
    NOT_LITERAL: NOT_LITERAL_IGNORE,
}

OP_LOCALE_IGNORE = {
    LITERAL: LITERAL_LOC_IGNORE,
    NOT_LITERAL: NOT_LITERAL_LOC_IGNORE,

            

Reported by Pylint.

Undefined variable 'LITERAL'
Error

Line: 155 Column: 5

              }

OP_LOCALE_IGNORE = {
    LITERAL: LITERAL_LOC_IGNORE,
    NOT_LITERAL: NOT_LITERAL_LOC_IGNORE,
}

OP_UNICODE_IGNORE = {
    LITERAL: LITERAL_UNI_IGNORE,

            

Reported by Pylint.

Undefined variable 'LITERAL_LOC_IGNORE'
Error

Line: 155 Column: 14

              }

OP_LOCALE_IGNORE = {
    LITERAL: LITERAL_LOC_IGNORE,
    NOT_LITERAL: NOT_LITERAL_LOC_IGNORE,
}

OP_UNICODE_IGNORE = {
    LITERAL: LITERAL_UNI_IGNORE,

            

Reported by Pylint.

Undefined variable 'NOT_LITERAL_LOC_IGNORE'
Error

Line: 156 Column: 18

              
OP_LOCALE_IGNORE = {
    LITERAL: LITERAL_LOC_IGNORE,
    NOT_LITERAL: NOT_LITERAL_LOC_IGNORE,
}

OP_UNICODE_IGNORE = {
    LITERAL: LITERAL_UNI_IGNORE,
    NOT_LITERAL: NOT_LITERAL_UNI_IGNORE,

            

Reported by Pylint.

Undefined variable 'NOT_LITERAL'
Error

Line: 156 Column: 5

              
OP_LOCALE_IGNORE = {
    LITERAL: LITERAL_LOC_IGNORE,
    NOT_LITERAL: NOT_LITERAL_LOC_IGNORE,
}

OP_UNICODE_IGNORE = {
    LITERAL: LITERAL_UNI_IGNORE,
    NOT_LITERAL: NOT_LITERAL_UNI_IGNORE,

            

Reported by Pylint.

Undefined variable 'LITERAL'
Error

Line: 160 Column: 5

              }

OP_UNICODE_IGNORE = {
    LITERAL: LITERAL_UNI_IGNORE,
    NOT_LITERAL: NOT_LITERAL_UNI_IGNORE,
}

AT_MULTILINE = {
    AT_BEGINNING: AT_BEGINNING_LINE,

            

Reported by Pylint.

Lib/turtledemo/yinyang.py
64 issues
Undefined variable 'width'
Error

Line: 17 Column: 5

              from turtle import *

def yin(radius, color1, color2):
    width(3)
    color("black", color1)
    begin_fill()
    circle(radius/2., 180)
    circle(radius, 180)
    left(180)

            

Reported by Pylint.

Undefined variable 'color'
Error

Line: 18 Column: 5

              
def yin(radius, color1, color2):
    width(3)
    color("black", color1)
    begin_fill()
    circle(radius/2., 180)
    circle(radius, 180)
    left(180)
    circle(-radius/2., 180)

            

Reported by Pylint.

Undefined variable 'begin_fill'
Error

Line: 19 Column: 5

              def yin(radius, color1, color2):
    width(3)
    color("black", color1)
    begin_fill()
    circle(radius/2., 180)
    circle(radius, 180)
    left(180)
    circle(-radius/2., 180)
    end_fill()

            

Reported by Pylint.

Undefined variable 'circle'
Error

Line: 20 Column: 5

                  width(3)
    color("black", color1)
    begin_fill()
    circle(radius/2., 180)
    circle(radius, 180)
    left(180)
    circle(-radius/2., 180)
    end_fill()
    left(90)

            

Reported by Pylint.

Undefined variable 'circle'
Error

Line: 21 Column: 5

                  color("black", color1)
    begin_fill()
    circle(radius/2., 180)
    circle(radius, 180)
    left(180)
    circle(-radius/2., 180)
    end_fill()
    left(90)
    up()

            

Reported by Pylint.

Undefined variable 'left'
Error

Line: 22 Column: 5

                  begin_fill()
    circle(radius/2., 180)
    circle(radius, 180)
    left(180)
    circle(-radius/2., 180)
    end_fill()
    left(90)
    up()
    forward(radius*0.35)

            

Reported by Pylint.

Undefined variable 'circle'
Error

Line: 23 Column: 5

                  circle(radius/2., 180)
    circle(radius, 180)
    left(180)
    circle(-radius/2., 180)
    end_fill()
    left(90)
    up()
    forward(radius*0.35)
    right(90)

            

Reported by Pylint.

Undefined variable 'end_fill'
Error

Line: 24 Column: 5

                  circle(radius, 180)
    left(180)
    circle(-radius/2., 180)
    end_fill()
    left(90)
    up()
    forward(radius*0.35)
    right(90)
    down()

            

Reported by Pylint.

Undefined variable 'left'
Error

Line: 25 Column: 5

                  left(180)
    circle(-radius/2., 180)
    end_fill()
    left(90)
    up()
    forward(radius*0.35)
    right(90)
    down()
    color(color1, color2)

            

Reported by Pylint.

Undefined variable 'up'
Error

Line: 26 Column: 5

                  circle(-radius/2., 180)
    end_fill()
    left(90)
    up()
    forward(radius*0.35)
    right(90)
    down()
    color(color1, color2)
    begin_fill()

            

Reported by Pylint.

Lib/csv.py
64 issues
Consider explicitly re-raising using the 'from' keyword
Error

Line: 52 Column: 13

                          _Dialect(self)
        except TypeError as e:
            # We do this for compatibility with py2.3
            raise Error(str(e))

class excel(Dialect):
    """Describe the usual properties of Excel-generated CSV files."""
    delimiter = ','
    quotechar = '"'

            

Reported by Pylint.

Keyword argument before variable positional arguments list in the definition of __init__ function
Error

Line: 81 Column: 5

              

class DictReader:
    def __init__(self, f, fieldnames=None, restkey=None, restval=None,
                 dialect="excel", *args, **kwds):
        self._fieldnames = fieldnames   # list of keys for the dict
        self.restkey = restkey          # key to catch long rows
        self.restval = restval          # default value for short rows
        self.reader = reader(f, dialect, *args, **kwds)

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 110 Column: 13

                  def __next__(self):
        if self.line_num == 0:
            # Used only for its side effect.
            self.fieldnames
        row = next(self.reader)
        self.line_num = self.reader.line_num

        # unlike the basic reader, we prefer not to return blanks,
        # because we will typically wind up with a dict full of None

            

Reported by Pylint.

Keyword argument before variable positional arguments list in the definition of __init__ function
Error

Line: 131 Column: 5

              

class DictWriter:
    def __init__(self, f, fieldnames, restval="", extrasaction="raise",
                 dialect="excel", *args, **kwds):
        self.fieldnames = fieldnames    # list of keys for the dict
        self.restval = restval          # for writing short dicts
        if extrasaction.lower() not in ("raise", "ignore"):
            raise ValueError("extrasaction (%s) must be 'raise' or 'ignore'"

            

Reported by Pylint.

Redefining built-in 'complex'
Error

Line: 163 Column: 5

              try:
    complex
except NameError:
    complex = float

class Sniffer:
    '''
    "Sniffs" the format of a CSV file (i.e. delimiter, quotechar)
    Returns a Dialect object.

            

Reported by Pylint.

Redefining built-in 'ascii'
Error

Line: 301 Column: 9

              
        data = list(filter(None, data.split('\n')))

        ascii = [chr(c) for c in range(127)] # 7-bit ASCII

        # build frequency tables
        chunkLength = min(10, len(data))
        iteration = 0
        charFrequency = {}

            

Reported by Pylint.

standard import "from io import StringIO" should be placed before "from _csv import Error, __version__, writer, reader, register_dialect, unregister_dialect, get_dialect, list_dialects, field_size_limit, QUOTE_MINIMAL, QUOTE_ALL, QUOTE_NONNUMERIC, QUOTE_NONE, __doc__"
Error

Line: 14 Column: 1

                               __doc__
from _csv import Dialect as _Dialect

from io import StringIO

__all__ = ["QUOTE_MINIMAL", "QUOTE_ALL", "QUOTE_NONNUMERIC", "QUOTE_NONE",
           "Error", "Dialect", "__doc__", "excel", "excel_tab",
           "field_size_limit", "reader", "writer",
           "register_dialect", "get_dialect", "list_dialects", "Sniffer",

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 23 Column: 1

                         "unregister_dialect", "__version__", "DictReader", "DictWriter",
           "unix_dialect"]

class Dialect:
    """Describe a CSV dialect.

    This must be subclassed (see csv.excel).  Valid attributes are:
    delimiter, quotechar, escapechar, doublequote, skipinitialspace,
    lineterminator, quoting.

            

Reported by Pylint.

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

Line: 50 Column: 9

                  def _validate(self):
        try:
            _Dialect(self)
        except TypeError as e:
            # We do this for compatibility with py2.3
            raise Error(str(e))

class excel(Dialect):
    """Describe the usual properties of Excel-generated CSV files."""

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 54 Column: 1

                          # We do this for compatibility with py2.3
            raise Error(str(e))

class excel(Dialect):
    """Describe the usual properties of Excel-generated CSV files."""
    delimiter = ','
    quotechar = '"'
    doublequote = True
    skipinitialspace = False

            

Reported by Pylint.

Lib/test/test_importlib/import_/test_relative_imports.py
63 issues
Attempted relative import beyond top-level package
Error

Line: 2 Column: 1

              """Test relative imports (PEP 328)."""
from .. import util
import unittest
import warnings


class RelativeImports:

    """PEP 328 introduced relative imports. This allows for imports to occur

            

Reported by Pylint.

Instance of 'RelativeImports' has no '__import__' member
Error

Line: 81 Column: 13

                      create = 'pkg.__init__', 'pkg.mod2'
        globals_ = {'__package__': 'pkg'}, {'__name__': 'pkg.mod1'}
        def callback(global_):
            self.__import__('pkg')  # For __import__().
            module = self.__import__('', global_, fromlist=['mod2'], level=1)
            self.assertEqual(module.__name__, 'pkg')
            self.assertTrue(hasattr(module, 'mod2'))
            self.assertEqual(module.mod2.attr, 'pkg.mod2')
        self.relative_import_test(create, globals_, callback)

            

Reported by Pylint.

Instance of 'RelativeImports' has no '__import__' member
Error

Line: 82 Column: 22

                      globals_ = {'__package__': 'pkg'}, {'__name__': 'pkg.mod1'}
        def callback(global_):
            self.__import__('pkg')  # For __import__().
            module = self.__import__('', global_, fromlist=['mod2'], level=1)
            self.assertEqual(module.__name__, 'pkg')
            self.assertTrue(hasattr(module, 'mod2'))
            self.assertEqual(module.mod2.attr, 'pkg.mod2')
        self.relative_import_test(create, globals_, callback)


            

Reported by Pylint.

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

Line: 83 Column: 13

                      def callback(global_):
            self.__import__('pkg')  # For __import__().
            module = self.__import__('', global_, fromlist=['mod2'], level=1)
            self.assertEqual(module.__name__, 'pkg')
            self.assertTrue(hasattr(module, 'mod2'))
            self.assertEqual(module.mod2.attr, 'pkg.mod2')
        self.relative_import_test(create, globals_, callback)

    def test_attr_from_module(self):

            

Reported by Pylint.

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

Line: 84 Column: 13

                          self.__import__('pkg')  # For __import__().
            module = self.__import__('', global_, fromlist=['mod2'], level=1)
            self.assertEqual(module.__name__, 'pkg')
            self.assertTrue(hasattr(module, 'mod2'))
            self.assertEqual(module.mod2.attr, 'pkg.mod2')
        self.relative_import_test(create, globals_, callback)

    def test_attr_from_module(self):
        # [attr from module]

            

Reported by Pylint.

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

Line: 85 Column: 13

                          module = self.__import__('', global_, fromlist=['mod2'], level=1)
            self.assertEqual(module.__name__, 'pkg')
            self.assertTrue(hasattr(module, 'mod2'))
            self.assertEqual(module.mod2.attr, 'pkg.mod2')
        self.relative_import_test(create, globals_, callback)

    def test_attr_from_module(self):
        # [attr from module]
        create = 'pkg.__init__', 'pkg.mod2'

            

Reported by Pylint.

Instance of 'RelativeImports' has no '__import__' member
Error

Line: 93 Column: 13

                      create = 'pkg.__init__', 'pkg.mod2'
        globals_ = {'__package__': 'pkg'}, {'__name__': 'pkg.mod1'}
        def callback(global_):
            self.__import__('pkg')  # For __import__().
            module = self.__import__('mod2', global_, fromlist=['attr'],
                                            level=1)
            self.assertEqual(module.__name__, 'pkg.mod2')
            self.assertEqual(module.attr, 'pkg.mod2')
        self.relative_import_test(create, globals_, callback)

            

Reported by Pylint.

Instance of 'RelativeImports' has no '__import__' member
Error

Line: 94 Column: 22

                      globals_ = {'__package__': 'pkg'}, {'__name__': 'pkg.mod1'}
        def callback(global_):
            self.__import__('pkg')  # For __import__().
            module = self.__import__('mod2', global_, fromlist=['attr'],
                                            level=1)
            self.assertEqual(module.__name__, 'pkg.mod2')
            self.assertEqual(module.attr, 'pkg.mod2')
        self.relative_import_test(create, globals_, callback)


            

Reported by Pylint.

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

Line: 96 Column: 13

                          self.__import__('pkg')  # For __import__().
            module = self.__import__('mod2', global_, fromlist=['attr'],
                                            level=1)
            self.assertEqual(module.__name__, 'pkg.mod2')
            self.assertEqual(module.attr, 'pkg.mod2')
        self.relative_import_test(create, globals_, callback)

    def test_package_to_module(self):
        # [package to module]

            

Reported by Pylint.

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

Line: 97 Column: 13

                          module = self.__import__('mod2', global_, fromlist=['attr'],
                                            level=1)
            self.assertEqual(module.__name__, 'pkg.mod2')
            self.assertEqual(module.attr, 'pkg.mod2')
        self.relative_import_test(create, globals_, callback)

    def test_package_to_module(self):
        # [package to module]
        create = 'pkg.__init__', 'pkg.module'

            

Reported by Pylint.

Tools/i18n/pygettext.py
63 issues
Global variable 'escape' undefined at the module level
Error

Line: 209 Column: 5

              
            

Reported by Pylint.

Global variable 'escapes' undefined at the module level
Error

Line: 209 Column: 5

              
            

Reported by Pylint.

Unused argument 'encoding'
Error

Line: 229 Column: 21

              
            

Reported by Pylint.

Use of eval
Error

Line: 242 Column: 12

              
            

Reported by Pylint.

Use of possibly insecure function - consider using safer ast.literal_eval.
Security blacklist

Line: 242
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b307-eval

Error reading the source code

Reported by Bandit.

Redefining built-in 'set'
Error

Line: 262 Column: 22

              
            

Reported by Pylint.

Redefining built-in 'str'
Error

Line: 262 Column: 17

              
            

Reported by Pylint.

Redefining built-in 'list'
Error

Line: 275 Column: 13

              
            

Reported by Pylint.

Unused argument 'lineno'
Error

Line: 400 Column: 43

              
            

Reported by Pylint.

Unused argument 'lineno'
Error

Line: 429 Column: 42

              
            

Reported by Pylint.

Lib/curses/ascii.py
63 issues
Redefining built-in 'ascii'
Error

Line: 71 Column: 1

              def isctrl(c): return 0 <= _ctoi(c) < 32
def ismeta(c): return _ctoi(c) > 127

def ascii(c):
    if type(c) == type(""):
        return chr(_ctoi(c) & 0x7f)
    else:
        return _ctoi(c) & 0x7f


            

Reported by Pylint.

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

Line: 48 Column: 1

              "SP"
]

def _ctoi(c):
    if type(c) == type(""):
        return ord(c)
    else:
        return c


            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 49 Column: 5

              ]

def _ctoi(c):
    if type(c) == type(""):
        return ord(c)
    else:
        return c

def isalnum(c): return isalpha(c) or isdigit(c)

            

Reported by Pylint.

Using type() instead of isinstance() for a typecheck.
Error

Line: 49 Column: 8

              ]

def _ctoi(c):
    if type(c) == type(""):
        return ord(c)
    else:
        return c

def isalnum(c): return isalpha(c) or isdigit(c)

            

Reported by Pylint.

More than one statement on a single line
Error

Line: 54 Column: 17

                  else:
        return c

def isalnum(c): return isalpha(c) or isdigit(c)
def isalpha(c): return isupper(c) or islower(c)
def isascii(c): return 0 <= _ctoi(c) <= 127          # ?
def isblank(c): return _ctoi(c) in (9, 32)
def iscntrl(c): return 0 <= _ctoi(c) <= 31 or _ctoi(c) == 127
def isdigit(c): return 48 <= _ctoi(c) <= 57

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 54 Column: 1

                  else:
        return c

def isalnum(c): return isalpha(c) or isdigit(c)
def isalpha(c): return isupper(c) or islower(c)
def isascii(c): return 0 <= _ctoi(c) <= 127          # ?
def isblank(c): return _ctoi(c) in (9, 32)
def iscntrl(c): return 0 <= _ctoi(c) <= 31 or _ctoi(c) == 127
def isdigit(c): return 48 <= _ctoi(c) <= 57

            

Reported by Pylint.

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

Line: 54 Column: 1

                  else:
        return c

def isalnum(c): return isalpha(c) or isdigit(c)
def isalpha(c): return isupper(c) or islower(c)
def isascii(c): return 0 <= _ctoi(c) <= 127          # ?
def isblank(c): return _ctoi(c) in (9, 32)
def iscntrl(c): return 0 <= _ctoi(c) <= 31 or _ctoi(c) == 127
def isdigit(c): return 48 <= _ctoi(c) <= 57

            

Reported by Pylint.

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

Line: 55 Column: 1

                      return c

def isalnum(c): return isalpha(c) or isdigit(c)
def isalpha(c): return isupper(c) or islower(c)
def isascii(c): return 0 <= _ctoi(c) <= 127          # ?
def isblank(c): return _ctoi(c) in (9, 32)
def iscntrl(c): return 0 <= _ctoi(c) <= 31 or _ctoi(c) == 127
def isdigit(c): return 48 <= _ctoi(c) <= 57
def isgraph(c): return 33 <= _ctoi(c) <= 126

            

Reported by Pylint.

More than one statement on a single line
Error

Line: 55 Column: 17

                      return c

def isalnum(c): return isalpha(c) or isdigit(c)
def isalpha(c): return isupper(c) or islower(c)
def isascii(c): return 0 <= _ctoi(c) <= 127          # ?
def isblank(c): return _ctoi(c) in (9, 32)
def iscntrl(c): return 0 <= _ctoi(c) <= 31 or _ctoi(c) == 127
def isdigit(c): return 48 <= _ctoi(c) <= 57
def isgraph(c): return 33 <= _ctoi(c) <= 126

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 55 Column: 1

                      return c

def isalnum(c): return isalpha(c) or isdigit(c)
def isalpha(c): return isupper(c) or islower(c)
def isascii(c): return 0 <= _ctoi(c) <= 127          # ?
def isblank(c): return _ctoi(c) in (9, 32)
def iscntrl(c): return 0 <= _ctoi(c) <= 31 or _ctoi(c) == 127
def isdigit(c): return 48 <= _ctoi(c) <= 57
def isgraph(c): return 33 <= _ctoi(c) <= 126

            

Reported by Pylint.

Lib/idlelib/iomenu.py
63 issues
Starting a process with a shell, possible injection detected, security issue.
Security injection

Line: 330
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b605_start_process_with_a_shell.html

                          printPlatform = False
        if printPlatform:  #we can try to print for this platform
            command = command % shlex.quote(filename)
            pipe = os.popen(command, "r")
            # things can get ugly on NT if there is no printer available.
            output = pipe.read().strip()
            status = pipe.close()
            if status:
                output = "Printing failed (exit status 0x%x)\n" % \

            

Reported by Bandit.

Unused import idlelib
Error

Line: 12 Column: 1

              from tkinter import messagebox
from tkinter.simpledialog import askstring

import idlelib
from idlelib.config import idleConf

encoding = 'utf-8'
if sys.platform == 'win32':
    errors = 'surrogatepass'

            

Reported by Pylint.

Unused argument 'event'
Error

Line: 80 Column: 20

                          if self.filename_change_hook:
                self.filename_change_hook()

    def open(self, event=None, editFile=None):
        flist = self.editwin.flist
        # Save in case parent window is closed (ie, during askopenfile()).
        if flist:
            if not editFile:
                filename = self.askopenfile()

            

Reported by Pylint.

Unused argument 'event'
Error

Line: 220 Column: 23

                      self.text.focus_set()
        return "break"

    def save_as(self, event):
        filename = self.asksavefile()
        if filename:
            if self.writefile(filename):
                self.set_filename(filename)
                self.set_saved(1)

            

Reported by Pylint.

Unused argument 'event'
Error

Line: 234 Column: 27

                      self.updaterecentfileslist(filename)
        return "break"

    def save_a_copy(self, event):
        filename = self.asksavefile()
        if filename:
            self.writefile(filename)
        self.text.focus_set()
        self.updaterecentfileslist(filename)

            

Reported by Pylint.

Unused argument 'event'
Error

Line: 297 Column: 28

                      # declared encoding
        return chars.encode('utf-8-sig')

    def print_window(self, event):
        confirm = messagebox.askokcancel(
                  title="Print",
                  message="Print to Default Printer",
                  default=messagebox.OK,
                  parent=self.text)

            

Reported by Pylint.

Redefining built-in 'dir'
Error

Line: 359 Column: 9

                  defaultextension = '.py' if sys.platform == 'darwin' else ''

    def askopenfile(self):
        dir, base = self.defaultfilename("open")
        if not self.opendialog:
            self.opendialog = filedialog.Open(parent=self.text,
                                                filetypes=self.filetypes)
        filename = self.opendialog.show(initialdir=dir, initialfile=base)
        return filename

            

Reported by Pylint.

Unused argument 'mode'
Error

Line: 366 Column: 31

                      filename = self.opendialog.show(initialdir=dir, initialfile=base)
        return filename

    def defaultfilename(self, mode="open"):
        if self.filename:
            return os.path.split(self.filename)
        elif self.dirname:
            return self.dirname, ""
        else:

            

Reported by Pylint.

Redefining built-in 'dir'
Error

Line: 379 Column: 9

                          return pwd, ""

    def asksavefile(self):
        dir, base = self.defaultfilename("save")
        if not self.savedialog:
            self.savedialog = filedialog.SaveAs(
                    parent=self.text,
                    filetypes=self.filetypes,
                    defaultextension=self.defaultextension)

            

Reported by Pylint.

Unused argument 'event'
Error

Line: 412 Column: 24

                      def get_saved(self): return 0
        def set_saved(self, flag): pass
        def reset_undo(self): pass
        def open(self, event):
            self.text.event_generate("<<open-window-from-file>>")
        def print(self, event):
            self.text.event_generate("<<print-window>>")
        def save(self, event):
            self.text.event_generate("<<save-window>>")

            

Reported by Pylint.

Lib/turtledemo/minimal_hanoi.py
63 issues
Undefined variable 'onkey'
Error

Line: 51 Column: 5

                      hanoi(n-1, with_, from_, to_)

def play():
    onkey(None,"space")
    clear()
    try:
        hanoi(6, t1, t2, t3)
        write("press STOP button to exit",
              align="center", font=("Courier", 16, "bold"))

            

Reported by Pylint.

Undefined variable 'clear'
Error

Line: 52 Column: 5

              
def play():
    onkey(None,"space")
    clear()
    try:
        hanoi(6, t1, t2, t3)
        write("press STOP button to exit",
              align="center", font=("Courier", 16, "bold"))
    except Terminator:

            

Reported by Pylint.

Undefined variable 'write'
Error

Line: 55 Column: 9

                  clear()
    try:
        hanoi(6, t1, t2, t3)
        write("press STOP button to exit",
              align="center", font=("Courier", 16, "bold"))
    except Terminator:
        pass  # turtledemo user pressed STOP

def main():

            

Reported by Pylint.

Undefined variable 'ht'
Error

Line: 62 Column: 5

              
def main():
    global t1, t2, t3
    ht(); penup(); goto(0, -225)   # writer turtle
    t1 = Tower(-250)
    t2 = Tower(0)
    t3 = Tower(250)
    # make tower of 6 discs
    for i in range(6,0,-1):

            

Reported by Pylint.

Undefined variable 'goto'
Error

Line: 62 Column: 20

              
def main():
    global t1, t2, t3
    ht(); penup(); goto(0, -225)   # writer turtle
    t1 = Tower(-250)
    t2 = Tower(0)
    t3 = Tower(250)
    # make tower of 6 discs
    for i in range(6,0,-1):

            

Reported by Pylint.

Undefined variable 'penup'
Error

Line: 62 Column: 11

              
def main():
    global t1, t2, t3
    ht(); penup(); goto(0, -225)   # writer turtle
    t1 = Tower(-250)
    t2 = Tower(0)
    t3 = Tower(250)
    # make tower of 6 discs
    for i in range(6,0,-1):

            

Reported by Pylint.

Undefined variable 'write'
Error

Line: 70 Column: 5

                  for i in range(6,0,-1):
        t1.push(Disc(i))
    # prepare spartanic user interface ;-)
    write("press spacebar to start game",
          align="center", font=("Courier", 16, "bold"))
    onkey(play, "space")
    listen()
    return "EVENTLOOP"


            

Reported by Pylint.

Undefined variable 'onkey'
Error

Line: 72 Column: 5

                  # prepare spartanic user interface ;-)
    write("press spacebar to start game",
          align="center", font=("Courier", 16, "bold"))
    onkey(play, "space")
    listen()
    return "EVENTLOOP"

if __name__=="__main__":
    msg = main()

            

Reported by Pylint.

Undefined variable 'listen'
Error

Line: 73 Column: 5

                  write("press spacebar to start game",
          align="center", font=("Courier", 16, "bold"))
    onkey(play, "space")
    listen()
    return "EVENTLOOP"

if __name__=="__main__":
    msg = main()
    print(msg)

            

Reported by Pylint.

Undefined variable 'mainloop'
Error

Line: 79 Column: 5

              if __name__=="__main__":
    msg = main()
    print(msg)
    mainloop()

            

Reported by Pylint.

Lib/_markupbase.py
63 issues
Instance of 'ParserBase' has no 'rawdata' member
Error

Line: 47 Column: 19

                  def updatepos(self, i, j):
        if i >= j:
            return j
        rawdata = self.rawdata
        nlines = rawdata.count("\n", i, j)
        if nlines:
            self.lineno = self.lineno + nlines
            pos = rawdata.rindex("\n", i, j) # Should not fail
            self.offset = j-(pos+1)

            

Reported by Pylint.

Instance of 'ParserBase' has no 'rawdata' member
Error

Line: 71 Column: 19

                      # name in the following list: ENTITY, DOCTYPE, ELEMENT,
        # ATTLIST, NOTATION, SHORTREF, USEMAP,
        # LINKTYPE, LINK, IDLINK, USELINK, SYSTEM
        rawdata = self.rawdata
        j = i + 2
        assert rawdata[i:j] == "<!", "unexpected call to parse_declaration"
        if rawdata[j:j+1] == ">":
            # the empty comment <!>
            return j + 1

            

Reported by Pylint.

Instance of 'ParserBase' has no 'handle_decl' member
Error

Line: 104 Column: 21

                              # end of declaration syntax
                data = rawdata[i+2:j]
                if decltype == "doctype":
                    self.handle_decl(data)
                else:
                    # According to the HTML5 specs sections "8.2.4.44 Bogus
                    # comment state" and "8.2.4.45 Markup declaration open
                    # state", a comment token should be emitted.
                    # Calling unknown_decl provides more flexibility though.

            

Reported by Pylint.

Instance of 'ParserBase' has no 'rawdata' member
Error

Line: 142 Column: 18

                  # Internal -- parse a marked section
    # Override this to handle MS-word extension syntax <![if word]>content<![endif]>
    def parse_marked_section(self, i, report=1):
        rawdata= self.rawdata
        assert rawdata[i:i+3] == '<![', "unexpected call to parse_marked_section()"
        sectName, j = self._scan_name( i+3, i )
        if j < 0:
            return j
        if sectName in {"temp", "cdata", "ignore", "include", "rcdata"}:

            

Reported by Pylint.

Instance of 'ParserBase' has no 'rawdata' member
Error

Line: 166 Column: 19

              
    # Internal -- parse comment, return length or -1 if not terminated
    def parse_comment(self, i, report=1):
        rawdata = self.rawdata
        if rawdata[i:i+4] != '<!--':
            raise AssertionError('unexpected call to parse_comment()')
        match = _commentclose.search(rawdata, i+4)
        if not match:
            return -1

            

Reported by Pylint.

Instance of 'ParserBase' has no 'handle_comment' member
Error

Line: 174 Column: 13

                          return -1
        if report:
            j = match.start(0)
            self.handle_comment(rawdata[i+4: j])
        return match.end(0)

    # Internal -- scan past the internal subset in a <!DOCTYPE declaration,
    # returning the index just past any whitespace following the trailing ']'.
    def _parse_doctype_subset(self, i, declstartpos):

            

Reported by Pylint.

Instance of 'ParserBase' has no 'rawdata' member
Error

Line: 180 Column: 19

                  # Internal -- scan past the internal subset in a <!DOCTYPE declaration,
    # returning the index just past any whitespace following the trailing ']'.
    def _parse_doctype_subset(self, i, declstartpos):
        rawdata = self.rawdata
        n = len(rawdata)
        j = i
        while j < n:
            c = rawdata[j]
            if c == "<":

            

Reported by Pylint.

Instance of 'ParserBase' has no 'rawdata' member
Error

Line: 254 Column: 19

                      if j == -1:
            return -1
        # style content model; just skip until '>'
        rawdata = self.rawdata
        if '>' in rawdata[j:]:
            return rawdata.find(">", j) + 1
        return -1

    # Internal -- scan past <!ATTLIST declarations

            

Reported by Pylint.

Instance of 'ParserBase' has no 'rawdata' member
Error

Line: 261 Column: 19

              
    # Internal -- scan past <!ATTLIST declarations
    def _parse_doctype_attlist(self, i, declstartpos):
        rawdata = self.rawdata
        name, j = self._scan_name(i, declstartpos)
        c = rawdata[j:j+1]
        if c == "":
            return -1
        if c == ">":

            

Reported by Pylint.

Instance of 'ParserBase' has no 'rawdata' member
Error

Line: 321 Column: 19

                      name, j = self._scan_name(i, declstartpos)
        if j < 0:
            return j
        rawdata = self.rawdata
        while 1:
            c = rawdata[j:j+1]
            if not c:
                # end of buffer; incomplete
                return -1

            

Reported by Pylint.

Lib/idlelib/idle_test/test_format.py
63 issues
Reimport 'Text' (imported line 7)
Error

Line: 55 Column: 9

              
    @classmethod
    def setUpClass(cls):
        from idlelib.idle_test.mock_tk import Text
        cls.text = Text()

    def runcase(self, inserttext, stopline, expected):
        # Check that find_paragraph returns the expected paragraph when
        # the mark index is set to beginning, middle, end of each line

            

Reported by Pylint.

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

Line: 55 Column: 9

              
    @classmethod
    def setUpClass(cls):
        from idlelib.idle_test.mock_tk import Text
        cls.text = Text()

    def runcase(self, inserttext, stopline, expected):
        # Check that find_paragraph returns the expected paragraph when
        # the mark index is set to beginning, middle, end of each line

            

Reported by Pylint.

Access to a protected member _make_blanks of a client class
Error

Line: 389 Column: 20

                      self.usetabs = False
        self.context_use_ps1 = True

    _make_blanks = EditorWindow._make_blanks
    get_selection_indices = EditorWindow.get_selection_indices


class FormatRegionTest(unittest.TestCase):


            

Reported by Pylint.

Access to a protected member _asktabwidth of a client class
Error

Line: 572 Column: 15

              
    @mock.patch.object(ft, "askinteger")
    def test_ask_tabwidth(self, askinteger):
        ask = self.formatter._asktabwidth
        askinteger.return_value = 10
        self.assertEqual(ask(), 10)


class IndentsTest(unittest.TestCase):

            

Reported by Pylint.

standard import "import unittest" should be placed before "from idlelib import format as ft"
Error

Line: 4 Column: 1

              "Test format, coverage 99%."

from idlelib import format as ft
import unittest
from unittest import mock
from test.support import requires
from tkinter import Tk, Text
from idlelib.editor import EditorWindow
from idlelib.idle_test.mock_idle import Editor as MockEditor

            

Reported by Pylint.

standard import "from unittest import mock" should be placed before "from idlelib import format as ft"
Error

Line: 5 Column: 1

              
from idlelib import format as ft
import unittest
from unittest import mock
from test.support import requires
from tkinter import Tk, Text
from idlelib.editor import EditorWindow
from idlelib.idle_test.mock_idle import Editor as MockEditor


            

Reported by Pylint.

standard import "from test.support import requires" should be placed before "from idlelib import format as ft"
Error

Line: 6 Column: 1

              from idlelib import format as ft
import unittest
from unittest import mock
from test.support import requires
from tkinter import Tk, Text
from idlelib.editor import EditorWindow
from idlelib.idle_test.mock_idle import Editor as MockEditor



            

Reported by Pylint.

standard import "from tkinter import Tk, Text" should be placed before "from idlelib import format as ft"
Error

Line: 7 Column: 1

              import unittest
from unittest import mock
from test.support import requires
from tkinter import Tk, Text
from idlelib.editor import EditorWindow
from idlelib.idle_test.mock_idle import Editor as MockEditor


class Is_Get_Test(unittest.TestCase):

            

Reported by Pylint.

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

Line: 12 Column: 1

              from idlelib.idle_test.mock_idle import Editor as MockEditor


class Is_Get_Test(unittest.TestCase):
    """Test the is_ and get_ functions"""
    test_comment = '# This is a comment'
    test_nocomment = 'This is not a comment'
    trailingws_comment = '# This is a comment   '
    leadingws_comment = '    # This is a comment'

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 20 Column: 5

                  leadingws_comment = '    # This is a comment'
    leadingws_nocomment = '    This is not a comment'

    def test_is_all_white(self):
        self.assertTrue(ft.is_all_white(''))
        self.assertTrue(ft.is_all_white('\t\n\r\f\v'))
        self.assertFalse(ft.is_all_white(self.test_comment))

    def test_get_indent(self):

            

Reported by Pylint.