The following issues were found

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

Line: 1 Column: 1

              from . import util as test_util

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

import os.path
import sys
from test import support

            

Reported by Pylint.

Instance of 'ImportModuleTests' has no 'init' member
Error

Line: 25 Column: 26

                      # Test importing a top-level module.
        with test_util.mock_spec('top_level') as mock:
            with test_util.import_state(meta_path=[mock]):
                module = self.init.import_module('top_level')
                self.assertEqual(module.__name__, 'top_level')

    def test_absolute_package_import(self):
        # Test importing a module from a package with an absolute name.
        pkg_name = 'pkg'

            

Reported by Pylint.

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

Line: 26 Column: 17

                      with test_util.mock_spec('top_level') as mock:
            with test_util.import_state(meta_path=[mock]):
                module = self.init.import_module('top_level')
                self.assertEqual(module.__name__, 'top_level')

    def test_absolute_package_import(self):
        # Test importing a module from a package with an absolute name.
        pkg_name = 'pkg'
        pkg_long_name = '{0}.__init__'.format(pkg_name)

            

Reported by Pylint.

Instance of 'ImportModuleTests' has no 'init' member
Error

Line: 35 Column: 26

                      name = '{0}.mod'.format(pkg_name)
        with test_util.mock_spec(pkg_long_name, name) as mock:
            with test_util.import_state(meta_path=[mock]):
                module = self.init.import_module(name)
                self.assertEqual(module.__name__, name)

    def test_shallow_relative_package_import(self):
        # Test importing a module from a package through a relative import.
        pkg_name = 'pkg'

            

Reported by Pylint.

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

Line: 36 Column: 17

                      with test_util.mock_spec(pkg_long_name, name) as mock:
            with test_util.import_state(meta_path=[mock]):
                module = self.init.import_module(name)
                self.assertEqual(module.__name__, name)

    def test_shallow_relative_package_import(self):
        # Test importing a module from a package through a relative import.
        pkg_name = 'pkg'
        pkg_long_name = '{0}.__init__'.format(pkg_name)

            

Reported by Pylint.

Instance of 'ImportModuleTests' has no 'init' member
Error

Line: 47 Column: 17

                      relative_name = '.{0}'.format(module_name)
        with test_util.mock_spec(pkg_long_name, absolute_name) as mock:
            with test_util.import_state(meta_path=[mock]):
                self.init.import_module(pkg_name)
                module = self.init.import_module(relative_name, pkg_name)
                self.assertEqual(module.__name__, absolute_name)

    def test_deep_relative_package_import(self):
        modules = ['a.__init__', 'a.b.__init__', 'a.c']

            

Reported by Pylint.

Instance of 'ImportModuleTests' has no 'init' member
Error

Line: 48 Column: 26

                      with test_util.mock_spec(pkg_long_name, absolute_name) as mock:
            with test_util.import_state(meta_path=[mock]):
                self.init.import_module(pkg_name)
                module = self.init.import_module(relative_name, pkg_name)
                self.assertEqual(module.__name__, absolute_name)

    def test_deep_relative_package_import(self):
        modules = ['a.__init__', 'a.b.__init__', 'a.c']
        with test_util.mock_spec(*modules) as mock:

            

Reported by Pylint.

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

Line: 49 Column: 17

                          with test_util.import_state(meta_path=[mock]):
                self.init.import_module(pkg_name)
                module = self.init.import_module(relative_name, pkg_name)
                self.assertEqual(module.__name__, absolute_name)

    def test_deep_relative_package_import(self):
        modules = ['a.__init__', 'a.b.__init__', 'a.c']
        with test_util.mock_spec(*modules) as mock:
            with test_util.import_state(meta_path=[mock]):

            

Reported by Pylint.

Instance of 'ImportModuleTests' has no 'init' member
Error

Line: 55 Column: 17

                      modules = ['a.__init__', 'a.b.__init__', 'a.c']
        with test_util.mock_spec(*modules) as mock:
            with test_util.import_state(meta_path=[mock]):
                self.init.import_module('a')
                self.init.import_module('a.b')
                module = self.init.import_module('..c', 'a.b')
                self.assertEqual(module.__name__, 'a.c')

    def test_absolute_import_with_package(self):

            

Reported by Pylint.

Instance of 'ImportModuleTests' has no 'init' member
Error

Line: 56 Column: 17

                      with test_util.mock_spec(*modules) as mock:
            with test_util.import_state(meta_path=[mock]):
                self.init.import_module('a')
                self.init.import_module('a.b')
                module = self.init.import_module('..c', 'a.b')
                self.assertEqual(module.__name__, 'a.c')

    def test_absolute_import_with_package(self):
        # Test importing a module from a package with an absolute name with

            

Reported by Pylint.

Lib/argparse.py
188 issues
Instance of '_ActionsContainer' has no '_get_formatter' member
Error

Line: 1433 Column: 17

                      # raise an error if the metavar does not match the type
        if hasattr(self, "_get_formatter"):
            try:
                self._get_formatter()._format_args(action, None)
            except TypeError:
                raise ValueError("length of metavar tuple does not match nargs")

        return self._add_action(action)


            

Reported by Pylint.

Access to a protected member _indent of a client class
Error

Line: 212 Column: 17

                      def format_help(self):
            # format the indented section
            if self.parent is not None:
                self.formatter._indent()
            join = self.formatter._join_parts
            item_help = join([func(*args) for func, args in self.items])
            if self.parent is not None:
                self.formatter._dedent()


            

Reported by Pylint.

Access to a protected member _join_parts of a client class
Error

Line: 213 Column: 20

                          # format the indented section
            if self.parent is not None:
                self.formatter._indent()
            join = self.formatter._join_parts
            item_help = join([func(*args) for func, args in self.items])
            if self.parent is not None:
                self.formatter._dedent()

            # return nothing if the section was empty

            

Reported by Pylint.

Access to a protected member _dedent of a client class
Error

Line: 216 Column: 17

                          join = self.formatter._join_parts
            item_help = join([func(*args) for func, args in self.items])
            if self.parent is not None:
                self.formatter._dedent()

            # return nothing if the section was empty
            if not item_help:
                return ''


            

Reported by Pylint.

Access to a protected member _current_indent of a client class
Error

Line: 224 Column: 34

              
            # add the heading if the section was non-empty
            if self.heading is not SUPPRESS and self.heading is not None:
                current_indent = self.formatter._current_indent
                heading = '%*s%s:\n' % (current_indent, '', self.heading)
            else:
                heading = ''

            # join the section-initial newline, the heading and the help

            

Reported by Pylint.

Redefining built-in 'help'
Error

Line: 283 Column: 9

                  # Help-formatting methods
    # =======================
    def format_help(self):
        help = self._root_section.format_help()
        if help:
            help = self._long_break_matcher.sub('\n\n', help)
            help = help.strip('\n') + '\n'
        return help


            

Reported by Pylint.

Redefining built-in 'format'
Error

Line: 320 Column: 13

                                  positionals.append(action)

            # build full usage string
            format = self._format_actions_usage
            action_usage = format(optionals + positionals, groups)
            usage = ' '.join([s for s in [prog, action_usage] if s])

            # wrap the usage parts if it's too long
            text_width = self._width - self._current_indent

            

Reported by Pylint.

Access to a protected member _group_actions of a client class
Error

Line: 396 Column: 39

                      inserts = {}
        for group in groups:
            try:
                start = actions.index(group._group_actions[0])
            except ValueError:
                continue
            else:
                end = start + len(group._group_actions)
                if actions[start:end] == group._group_actions:

            

Reported by Pylint.

Access to a protected member _group_actions of a client class
Error

Line: 400 Column: 35

                          except ValueError:
                continue
            else:
                end = start + len(group._group_actions)
                if actions[start:end] == group._group_actions:
                    for action in group._group_actions:
                        group_actions.add(action)
                    if not group.required:
                        if start in inserts:

            

Reported by Pylint.

Access to a protected member _group_actions of a client class
Error

Line: 401 Column: 42

                              continue
            else:
                end = start + len(group._group_actions)
                if actions[start:end] == group._group_actions:
                    for action in group._group_actions:
                        group_actions.add(action)
                    if not group.required:
                        if start in inserts:
                            inserts[start] += ' ['

            

Reported by Pylint.

Lib/tkinter/test/test_ttk/test_widgets.py
186 issues
Instance of 'StandardTtkOptionsTests' has no 'create' member
Error

Line: 20 Column: 18

              class StandardTtkOptionsTests(StandardOptionsTests):

    def test_configure_class(self):
        widget = self.create()
        self.assertEqual(widget['class'], '')
        errmsg='attempt to change read-only option'
        if get_tk_patchlevel() < (8, 6, 0, 'beta', 3):
            errmsg='Attempt to change read-only option'
        self.checkInvalidParam(widget, 'class', 'Foo', errmsg=errmsg)

            

Reported by Pylint.

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

Line: 21 Column: 9

              
    def test_configure_class(self):
        widget = self.create()
        self.assertEqual(widget['class'], '')
        errmsg='attempt to change read-only option'
        if get_tk_patchlevel() < (8, 6, 0, 'beta', 3):
            errmsg='Attempt to change read-only option'
        self.checkInvalidParam(widget, 'class', 'Foo', errmsg=errmsg)
        widget2 = self.create(class_='Foo')

            

Reported by Pylint.

Instance of 'StandardTtkOptionsTests' has no 'checkInvalidParam' member
Error

Line: 25 Column: 9

                      errmsg='attempt to change read-only option'
        if get_tk_patchlevel() < (8, 6, 0, 'beta', 3):
            errmsg='Attempt to change read-only option'
        self.checkInvalidParam(widget, 'class', 'Foo', errmsg=errmsg)
        widget2 = self.create(class_='Foo')
        self.assertEqual(widget2['class'], 'Foo')

    def test_configure_padding(self):
        widget = self.create()

            

Reported by Pylint.

Instance of 'StandardTtkOptionsTests' has no 'create' member
Error

Line: 26 Column: 19

                      if get_tk_patchlevel() < (8, 6, 0, 'beta', 3):
            errmsg='Attempt to change read-only option'
        self.checkInvalidParam(widget, 'class', 'Foo', errmsg=errmsg)
        widget2 = self.create(class_='Foo')
        self.assertEqual(widget2['class'], 'Foo')

    def test_configure_padding(self):
        widget = self.create()
        self.checkParam(widget, 'padding', 0, expected=('0',))

            

Reported by Pylint.

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

Line: 27 Column: 9

                          errmsg='Attempt to change read-only option'
        self.checkInvalidParam(widget, 'class', 'Foo', errmsg=errmsg)
        widget2 = self.create(class_='Foo')
        self.assertEqual(widget2['class'], 'Foo')

    def test_configure_padding(self):
        widget = self.create()
        self.checkParam(widget, 'padding', 0, expected=('0',))
        self.checkParam(widget, 'padding', 5, expected=('5',))

            

Reported by Pylint.

Instance of 'StandardTtkOptionsTests' has no 'create' member
Error

Line: 30 Column: 18

                      self.assertEqual(widget2['class'], 'Foo')

    def test_configure_padding(self):
        widget = self.create()
        self.checkParam(widget, 'padding', 0, expected=('0',))
        self.checkParam(widget, 'padding', 5, expected=('5',))
        self.checkParam(widget, 'padding', (5, 6), expected=('5', '6'))
        self.checkParam(widget, 'padding', (5, 6, 7),
                        expected=('5', '6', '7'))

            

Reported by Pylint.

Instance of 'StandardTtkOptionsTests' has no 'checkParam' member
Error

Line: 31 Column: 9

              
    def test_configure_padding(self):
        widget = self.create()
        self.checkParam(widget, 'padding', 0, expected=('0',))
        self.checkParam(widget, 'padding', 5, expected=('5',))
        self.checkParam(widget, 'padding', (5, 6), expected=('5', '6'))
        self.checkParam(widget, 'padding', (5, 6, 7),
                        expected=('5', '6', '7'))
        self.checkParam(widget, 'padding', (5, 6, 7, 8),

            

Reported by Pylint.

Instance of 'StandardTtkOptionsTests' has no 'checkParam' member
Error

Line: 32 Column: 9

                  def test_configure_padding(self):
        widget = self.create()
        self.checkParam(widget, 'padding', 0, expected=('0',))
        self.checkParam(widget, 'padding', 5, expected=('5',))
        self.checkParam(widget, 'padding', (5, 6), expected=('5', '6'))
        self.checkParam(widget, 'padding', (5, 6, 7),
                        expected=('5', '6', '7'))
        self.checkParam(widget, 'padding', (5, 6, 7, 8),
                        expected=('5', '6', '7', '8'))

            

Reported by Pylint.

Instance of 'StandardTtkOptionsTests' has no 'checkParam' member
Error

Line: 33 Column: 9

                      widget = self.create()
        self.checkParam(widget, 'padding', 0, expected=('0',))
        self.checkParam(widget, 'padding', 5, expected=('5',))
        self.checkParam(widget, 'padding', (5, 6), expected=('5', '6'))
        self.checkParam(widget, 'padding', (5, 6, 7),
                        expected=('5', '6', '7'))
        self.checkParam(widget, 'padding', (5, 6, 7, 8),
                        expected=('5', '6', '7', '8'))
        self.checkParam(widget, 'padding', ('5p', '6p', '7p', '8p'))

            

Reported by Pylint.

Instance of 'StandardTtkOptionsTests' has no 'checkParam' member
Error

Line: 34 Column: 9

                      self.checkParam(widget, 'padding', 0, expected=('0',))
        self.checkParam(widget, 'padding', 5, expected=('5',))
        self.checkParam(widget, 'padding', (5, 6), expected=('5', '6'))
        self.checkParam(widget, 'padding', (5, 6, 7),
                        expected=('5', '6', '7'))
        self.checkParam(widget, 'padding', (5, 6, 7, 8),
                        expected=('5', '6', '7', '8'))
        self.checkParam(widget, 'padding', ('5p', '6p', '7p', '8p'))
        self.checkParam(widget, 'padding', (), expected='')

            

Reported by Pylint.

Lib/test/test_yield_from.py
186 issues
function already defined line 886
Error

Line: 911 Column: 9

                      # Check with throw
        class MyErr(Exception):
            pass
        def one():
            try:
                yield 0
            except MyErr:
                pass
            yield from two()

            

Reported by Pylint.

function already defined line 890
Error

Line: 921 Column: 9

                              yield 3
            except MyErr:
                pass
        def two():
            try:
                yield 1
            except MyErr:
                pass
            try:

            

Reported by Pylint.

Method should have "self" as first argument
Error

Line: 950 Column: 13

                              return self
            def __next__(self):
                return 42
            def close(self_):
                self.assertTrue(g1.gi_running)
                self.assertRaises(ValueError, next, g1)
        def one():
            yield from MyIt()
        g1 = one()

            

Reported by Pylint.

function already defined line 886
Error

Line: 953 Column: 9

                          def close(self_):
                self.assertTrue(g1.gi_running)
                self.assertRaises(ValueError, next, g1)
        def one():
            yield from MyIt()
        g1 = one()
        next(g1)
        g1.close()


            

Reported by Pylint.

Unreachable code
Error

Line: 122 Column: 17

                              trace.append("Starting g2")
                yield "g2 spam"
                raise ValueError("hovercraft is full of eels")
                yield "g2 more spam"
            finally:
                trace.append("Finishing g2")
        try:
            for x in g1():
                trace.append("Yielded %s" % (x,))

            

Reported by Pylint.

Unreachable code
Error

Line: 203 Column: 13

                          x = yield "g2 spam"
            trace.append("g2 received %s" % (x,))
            raise ValueError("hovercraft is full of eels")
            x = yield "g2 more spam"
            trace.append("g2 received %s" % (x,))
            trace.append("Finishing g2")
        def run():
            g = g1()
            y = next(g)

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 247 Column: 13

                          finally:
                trace.append("Finishing g2")
        g = g1()
        for i in range(2):
            x = next(g)
            trace.append("Yielded %s" % (x,))
        g.close()
        self.assertEqual(trace,[
            "Starting g1",

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 283 Column: 17

                              raise ValueError("nybbles have exploded with delight")
        try:
            g = g1()
            for i in range(2):
                x = next(g)
                trace.append("Yielded %s" % (x,))
            g.close()
        except ValueError as e:
            self.assertEqual(e.args[0], "nybbles have exploded with delight")

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 323 Column: 17

                              trace.append("Finishing g2")
        try:
            g = g1()
            for i in range(2):
                x = next(g)
                trace.append("Yielded %s" % (x,))
            e = ValueError("tomato ejected")
            g.throw(e)
        except ValueError as e:

            

Reported by Pylint.

Unused variable 'x'
Error

Line: 451 Column: 13

                      def g():
            yield from range(3)
        gi = g()
        for x in range(3):
            y = gi.send(None)
            trace.append("Yielded: %s" % (y,))
        self.assertEqual(trace,[
            "Yielded: 0",
            "Yielded: 1",

            

Reported by Pylint.

Lib/msilib/__init__.py
184 issues
Unable to import '_msi'
Error

Line: 3 Column: 1

              # Copyright (C) 2005 Martin v. Löwis
# Licensed to PSF under a Contributor Agreement.
from _msi import *
import fnmatch
import os
import re
import string
import sys


            

Reported by Pylint.

Undefined variable 'MSICOLINFO_NAMES'
Error

Line: 101 Column: 29

              
def add_data(db, table, values):
    v = db.OpenView("SELECT * FROM `%s`" % table)
    count = v.GetColumnInfo(MSICOLINFO_NAMES).GetFieldCount()
    r = CreateRecord(count)
    for value in values:
        assert len(value) == count, value
        for i in range(count):
            field = value[i]

            

Reported by Pylint.

Undefined variable 'CreateRecord'
Error

Line: 102 Column: 9

              def add_data(db, table, values):
    v = db.OpenView("SELECT * FROM `%s`" % table)
    count = v.GetColumnInfo(MSICOLINFO_NAMES).GetFieldCount()
    r = CreateRecord(count)
    for value in values:
        assert len(value) == count, value
        for i in range(count):
            field = value[i]
            if isinstance(field, int):

            

Reported by Pylint.

Undefined variable 'MSIMODIFY_INSERT'
Error

Line: 118 Column: 22

                          else:
                raise TypeError("Unsupported type %s" % field.__class__.__name__)
        try:
            v.Modify(MSIMODIFY_INSERT, r)
        except Exception:
            raise MSIError("Could not insert "+repr(values)+" into "+table)

        r.ClearData()
    v.Close()

            

Reported by Pylint.

Undefined variable 'MSIError'
Error

Line: 120 Column: 19

                      try:
            v.Modify(MSIMODIFY_INSERT, r)
        except Exception:
            raise MSIError("Could not insert "+repr(values)+" into "+table)

        r.ClearData()
    v.Close()



            

Reported by Pylint.

Undefined variable 'CreateRecord'
Error

Line: 128 Column: 9

              
def add_stream(db, name, path):
    v = db.OpenView("INSERT INTO _Streams (Name, Data) VALUES ('%s', ?)" % name)
    r = CreateRecord(1)
    r.SetStream(1, path)
    v.Execute(r)
    v.Close()

def init_database(name, schema,

            

Reported by Pylint.

Undefined variable 'MSIDBOPEN_CREATE'
Error

Line: 142 Column: 29

                      pass
    ProductCode = ProductCode.upper()
    # Create the database
    db = OpenDatabase(name, MSIDBOPEN_CREATE)
    # Create the tables
    for t in schema.tables:
        t.create(db)
    # Fill the validation table
    add_data(db, "_Validation", schema._Validation_records)

            

Reported by Pylint.

Undefined variable 'OpenDatabase'
Error

Line: 142 Column: 10

                      pass
    ProductCode = ProductCode.upper()
    # Create the database
    db = OpenDatabase(name, MSIDBOPEN_CREATE)
    # Create the tables
    for t in schema.tables:
        t.create(db)
    # Fill the validation table
    add_data(db, "_Validation", schema._Validation_records)

            

Reported by Pylint.

Undefined variable 'PID_TITLE'
Error

Line: 150 Column: 20

                  add_data(db, "_Validation", schema._Validation_records)
    # Initialize the summary information, allowing atmost 20 properties
    si = db.GetSummaryInformation(20)
    si.SetProperty(PID_TITLE, "Installation Database")
    si.SetProperty(PID_SUBJECT, ProductName)
    si.SetProperty(PID_AUTHOR, Manufacturer)
    if AMD64:
        si.SetProperty(PID_TEMPLATE, "x64;1033")
    else:

            

Reported by Pylint.

Undefined variable 'PID_SUBJECT'
Error

Line: 151 Column: 20

                  # Initialize the summary information, allowing atmost 20 properties
    si = db.GetSummaryInformation(20)
    si.SetProperty(PID_TITLE, "Installation Database")
    si.SetProperty(PID_SUBJECT, ProductName)
    si.SetProperty(PID_AUTHOR, Manufacturer)
    if AMD64:
        si.SetProperty(PID_TEMPLATE, "x64;1033")
    else:
        si.SetProperty(PID_TEMPLATE, "Intel;1033")

            

Reported by Pylint.

Lib/test/test_class.py
183 issues
Value 'Empty()' doesn't support membership test
Error

Line: 279 Column: 18

                      class Empty: pass

        try:
            1 in Empty()
            self.fail('failed, should have raised TypeError')
        except TypeError:
            pass

        callLst[:] = []

            

Reported by Pylint.

Value 'testme' doesn't support membership test
Error

Line: 285 Column: 14

                          pass

        callLst[:] = []
        1 in testme
        self.assertCallStack([('__contains__', (testme, 1))])

        callLst[:] = []
        testme[1]
        self.assertCallStack([('__getitem__', (testme, 1))])

            

Reported by Pylint.

Value 'testme' is unsubscriptable
Error

Line: 289 Column: 9

                      self.assertCallStack([('__contains__', (testme, 1))])

        callLst[:] = []
        testme[1]
        self.assertCallStack([('__getitem__', (testme, 1))])

        callLst[:] = []
        testme[1] = 1
        self.assertCallStack([('__setitem__', (testme, 1, 1))])

            

Reported by Pylint.

'testme' does not support item assignment
Error

Line: 293 Column: 9

                      self.assertCallStack([('__getitem__', (testme, 1))])

        callLst[:] = []
        testme[1] = 1
        self.assertCallStack([('__setitem__', (testme, 1, 1))])

        callLst[:] = []
        del testme[1]
        self.assertCallStack([('__delitem__', (testme, 1))])

            

Reported by Pylint.

'testme' does not support item deletion
Error

Line: 297 Column: 13

                      self.assertCallStack([('__setitem__', (testme, 1, 1))])

        callLst[:] = []
        del testme[1]
        self.assertCallStack([('__delitem__', (testme, 1))])

        callLst[:] = []
        testme[:42]
        self.assertCallStack([('__getitem__', (testme, slice(None, 42)))])

            

Reported by Pylint.

Value 'testme' is unsubscriptable
Error

Line: 301 Column: 9

                      self.assertCallStack([('__delitem__', (testme, 1))])

        callLst[:] = []
        testme[:42]
        self.assertCallStack([('__getitem__', (testme, slice(None, 42)))])

        callLst[:] = []
        testme[:42] = "The Answer"
        self.assertCallStack([('__setitem__', (testme, slice(None, 42),

            

Reported by Pylint.

'testme' does not support item assignment
Error

Line: 305 Column: 9

                      self.assertCallStack([('__getitem__', (testme, slice(None, 42)))])

        callLst[:] = []
        testme[:42] = "The Answer"
        self.assertCallStack([('__setitem__', (testme, slice(None, 42),
                                               "The Answer"))])

        callLst[:] = []
        del testme[:42]

            

Reported by Pylint.

'testme' does not support item deletion
Error

Line: 310 Column: 13

                                                             "The Answer"))])

        callLst[:] = []
        del testme[:42]
        self.assertCallStack([('__delitem__', (testme, slice(None, 42)))])

        callLst[:] = []
        testme[2:1024:10]
        self.assertCallStack([('__getitem__', (testme, slice(2, 1024, 10)))])

            

Reported by Pylint.

Value 'testme' is unsubscriptable
Error

Line: 314 Column: 9

                      self.assertCallStack([('__delitem__', (testme, slice(None, 42)))])

        callLst[:] = []
        testme[2:1024:10]
        self.assertCallStack([('__getitem__', (testme, slice(2, 1024, 10)))])

        callLst[:] = []
        testme[2:1024:10] = "A lot"
        self.assertCallStack([('__setitem__', (testme, slice(2, 1024, 10),

            

Reported by Pylint.

'testme' does not support item assignment
Error

Line: 318 Column: 9

                      self.assertCallStack([('__getitem__', (testme, slice(2, 1024, 10)))])

        callLst[:] = []
        testme[2:1024:10] = "A lot"
        self.assertCallStack([('__setitem__', (testme, slice(2, 1024, 10),
                                                                    "A lot"))])
        callLst[:] = []
        del testme[2:1024:10]
        self.assertCallStack([('__delitem__', (testme, slice(2, 1024, 10)))])

            

Reported by Pylint.

Lib/ctypes/test/test_keeprefs.py
183 issues
Unused import RTLD_LOCAL from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class SimpleTestCase(unittest.TestCase):
    def test_cint(self):
        x = c_int()
        self.assertEqual(x._objects, None)
        x.value = 42
        self.assertEqual(x._objects, None)

            

Reported by Pylint.

Unused import LibraryLoader from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class SimpleTestCase(unittest.TestCase):
    def test_cint(self):
        x = c_int()
        self.assertEqual(x._objects, None)
        x.value = 42
        self.assertEqual(x._objects, None)

            

Reported by Pylint.

Unused import cdll from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class SimpleTestCase(unittest.TestCase):
    def test_cint(self):
        x = c_int()
        self.assertEqual(x._objects, None)
        x.value = 42
        self.assertEqual(x._objects, None)

            

Reported by Pylint.

Unused import pydll from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class SimpleTestCase(unittest.TestCase):
    def test_cint(self):
        x = c_int()
        self.assertEqual(x._objects, None)
        x.value = 42
        self.assertEqual(x._objects, None)

            

Reported by Pylint.

Unused import pythonapi from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class SimpleTestCase(unittest.TestCase):
    def test_cint(self):
        x = c_int()
        self.assertEqual(x._objects, None)
        x.value = 42
        self.assertEqual(x._objects, None)

            

Reported by Pylint.

Unused import windll from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class SimpleTestCase(unittest.TestCase):
    def test_cint(self):
        x = c_int()
        self.assertEqual(x._objects, None)
        x.value = 42
        self.assertEqual(x._objects, None)

            

Reported by Pylint.

Unused import oledll from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class SimpleTestCase(unittest.TestCase):
    def test_cint(self):
        x = c_int()
        self.assertEqual(x._objects, None)
        x.value = 42
        self.assertEqual(x._objects, None)

            

Reported by Pylint.

Unused import GetLastError from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class SimpleTestCase(unittest.TestCase):
    def test_cint(self):
        x = c_int()
        self.assertEqual(x._objects, None)
        x.value = 42
        self.assertEqual(x._objects, None)

            

Reported by Pylint.

Unused import WinError from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class SimpleTestCase(unittest.TestCase):
    def test_cint(self):
        x = c_int()
        self.assertEqual(x._objects, None)
        x.value = 42
        self.assertEqual(x._objects, None)

            

Reported by Pylint.

Unused import c_size_t from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest

class SimpleTestCase(unittest.TestCase):
    def test_cint(self):
        x = c_int()
        self.assertEqual(x._objects, None)
        x.value = 42
        self.assertEqual(x._objects, None)

            

Reported by Pylint.

Lib/fractions.py
182 issues
Instance of 'Fraction' has no '_numerator' member; maybe 'numerator'?
Error

Line: 200 Column: 17

                      Return a tuple of two integers, whose ratio is equal to the
        Fraction and with a positive denominator.
        """
        return (self._numerator, self._denominator)

    def limit_denominator(self, max_denominator=1000000):
        """Closest Fraction to self with denominator at most max_denominator.

        >>> Fraction('3.141592653589793').limit_denominator(10)

            

Reported by Pylint.

Instance of 'Fraction' has no '_denominator' member; maybe 'denominator'?
Error

Line: 200 Column: 34

                      Return a tuple of two integers, whose ratio is equal to the
        Fraction and with a positive denominator.
        """
        return (self._numerator, self._denominator)

    def limit_denominator(self, max_denominator=1000000):
        """Closest Fraction to self with denominator at most max_denominator.

        >>> Fraction('3.141592653589793').limit_denominator(10)

            

Reported by Pylint.

Instance of 'Fraction' has no '_denominator' member; maybe 'denominator'?
Error

Line: 236 Column: 12

              
        if max_denominator < 1:
            raise ValueError("max_denominator should be at least 1")
        if self._denominator <= max_denominator:
            return Fraction(self)

        p0, q0, p1, q1 = 0, 1, 1, 0
        n, d = self._numerator, self._denominator
        while True:

            

Reported by Pylint.

Instance of 'Fraction' has no '_denominator' member; maybe 'denominator'?
Error

Line: 240 Column: 33

                          return Fraction(self)

        p0, q0, p1, q1 = 0, 1, 1, 0
        n, d = self._numerator, self._denominator
        while True:
            a = n//d
            q2 = q0+a*q1
            if q2 > max_denominator:
                break

            

Reported by Pylint.

Instance of 'Fraction' has no '_numerator' member; maybe 'numerator'?
Error

Line: 240 Column: 16

                          return Fraction(self)

        p0, q0, p1, q1 = 0, 1, 1, 0
        n, d = self._numerator, self._denominator
        while True:
            a = n//d
            q2 = q0+a*q1
            if q2 > max_denominator:
                break

            

Reported by Pylint.

Method should have "self" as first argument
Error

Line: 258 Column: 5

                          return bound1

    @property
    def numerator(a):
        return a._numerator

    @property
    def denominator(a):
        return a._denominator

            

Reported by Pylint.

Instance of 'Fraction' has no '_numerator' member; maybe 'numerator'?
Error

Line: 259 Column: 16

              
    @property
    def numerator(a):
        return a._numerator

    @property
    def denominator(a):
        return a._denominator


            

Reported by Pylint.

Method should have "self" as first argument
Error

Line: 262 Column: 5

                      return a._numerator

    @property
    def denominator(a):
        return a._denominator

    def __repr__(self):
        """repr(self)"""
        return '%s(%s, %s)' % (self.__class__.__name__,

            

Reported by Pylint.

Instance of 'Fraction' has no '_denominator' member; maybe 'denominator'?
Error

Line: 263 Column: 16

              
    @property
    def denominator(a):
        return a._denominator

    def __repr__(self):
        """repr(self)"""
        return '%s(%s, %s)' % (self.__class__.__name__,
                               self._numerator, self._denominator)

            

Reported by Pylint.

Instance of 'Fraction' has no '_numerator' member; maybe 'numerator'?
Error

Line: 268 Column: 32

                  def __repr__(self):
        """repr(self)"""
        return '%s(%s, %s)' % (self.__class__.__name__,
                               self._numerator, self._denominator)

    def __str__(self):
        """str(self)"""
        if self._denominator == 1:
            return str(self._numerator)

            

Reported by Pylint.

Lib/ctypes/test/test_functions.py
182 issues
class already defined line 39
Error

Line: 48 Column: 13

              
        from _ctypes import _Pointer
        try:
            class X(object, _Pointer):
                pass
        except TypeError:
            pass

        from _ctypes import _SimpleCData

            

Reported by Pylint.

class already defined line 39
Error

Line: 55 Column: 13

              
        from _ctypes import _SimpleCData
        try:
            class X(object, _SimpleCData):
                _type_ = "i"
        except TypeError:
            pass

        try:

            

Reported by Pylint.

class already defined line 39
Error

Line: 61 Column: 13

                          pass

        try:
            class X(object, Structure):
                _fields_ = []
        except TypeError:
            pass



            

Reported by Pylint.

method already defined line 212
Error

Line: 309 Column: 5

              
        self.assertEqual(13577625587, f(1000000000000, cb))

    def test_errors(self):
        self.assertRaises(AttributeError, getattr, dll, "_xxx_yyy")
        self.assertRaises(ValueError, c_int.in_dll, dll, "_xxx_yyy")

    def test_byval(self):


            

Reported by Pylint.

Unused import Union from wildcard import
Error

Line: 8 Column: 1

              Later...
"""

from ctypes import *
from ctypes.test import need_symbol
import sys, unittest

try:
    WINFUNCTYPE

            

Reported by Pylint.

Unused import c_uint64 from wildcard import
Error

Line: 8 Column: 1

              Later...
"""

from ctypes import *
from ctypes.test import need_symbol
import sys, unittest

try:
    WINFUNCTYPE

            

Reported by Pylint.

Unused import sizeof from wildcard import
Error

Line: 8 Column: 1

              Later...
"""

from ctypes import *
from ctypes.test import need_symbol
import sys, unittest

try:
    WINFUNCTYPE

            

Reported by Pylint.

Unused import c_uint16 from wildcard import
Error

Line: 8 Column: 1

              Later...
"""

from ctypes import *
from ctypes.test import need_symbol
import sys, unittest

try:
    WINFUNCTYPE

            

Reported by Pylint.

Unused import FormatError from wildcard import
Error

Line: 8 Column: 1

              Later...
"""

from ctypes import *
from ctypes.test import need_symbol
import sys, unittest

try:
    WINFUNCTYPE

            

Reported by Pylint.

Unused import c_int32 from wildcard import
Error

Line: 8 Column: 1

              Later...
"""

from ctypes import *
from ctypes.test import need_symbol
import sys, unittest

try:
    WINFUNCTYPE

            

Reported by Pylint.

Lib/test/test_cmd_line.py
181 issues
Argument 'builtins.bytes' does not match format type 'a'
Error

Line: 199 Column: 34

                          # The output is followed by the encoding name, an alias to ASCII.
            # Examples: "US-ASCII" or "646" (ISO 646, on Solaris).
        else:
            raise AssertionError("Unknown exit code: %s, output=%a" % (p.returncode, stdout))
        if not stdout.startswith(pattern):
            raise AssertionError("%a doesn't start with %a" % (stdout, pattern))

    @unittest.skipIf(sys.platform == 'win32',
                     'Windows has a native unicode API')

            

Reported by Pylint.

Argument 'builtins.bytes' does not match format type 'a'
Error

Line: 201 Column: 34

                      else:
            raise AssertionError("Unknown exit code: %s, output=%a" % (p.returncode, stdout))
        if not stdout.startswith(pattern):
            raise AssertionError("%a doesn't start with %a" % (stdout, pattern))

    @unittest.skipIf(sys.platform == 'win32',
                     'Windows has a native unicode API')
    def test_invalid_utf8_arg(self):
        # bpo-35883: Py_DecodeLocale() must escape b'\xfd\xbf\xbf\xbb\xba\xba'

            

Reported by Pylint.

Argument 'builtins.bytes' does not match format type 'a'
Error

Line: 201 Column: 34

                      else:
            raise AssertionError("Unknown exit code: %s, output=%a" % (p.returncode, stdout))
        if not stdout.startswith(pattern):
            raise AssertionError("%a doesn't start with %a" % (stdout, pattern))

    @unittest.skipIf(sys.platform == 'win32',
                     'Windows has a native unicode API')
    def test_invalid_utf8_arg(self):
        # bpo-35883: Py_DecodeLocale() must escape b'\xfd\xbf\xbf\xbb\xba\xba'

            

Reported by Pylint.

XXX (ncoghlan): Move to script_helper and make consistent with run_python
Error

Line: 23 Column: 3

              Py_DEBUG = hasattr(sys, "gettotalrefcount")


# XXX (ncoghlan): Move to script_helper and make consistent with run_python
def _kill_python_and_exit_code(p):
    data = kill_python(p)
    returncode = p.wait()
    return data, returncode


            

Reported by Pylint.

Unused variable 'rc'
Error

Line: 35 Column: 9

                      assert_python_failure('< .')

    def verify_valid_flag(self, cmd_line):
        rc, out, err = assert_python_ok(*cmd_line)
        self.assertTrue(out == b'' or out.endswith(b'\n'))
        self.assertNotIn(b'Traceback', out)
        self.assertNotIn(b'Traceback', err)

    def test_optimize(self):

            

Reported by Pylint.

Unused variable 'rc'
Error

Line: 48 Column: 9

                      self.verify_valid_flag('-S')

    def test_usage(self):
        rc, out, err = assert_python_ok('-h')
        lines = out.splitlines()
        self.assertIn(b'usage', lines[0])
        # The first line contains the program name,
        # but the rest should be ASCII-only
        b''.join(lines[1:]).decode('ascii')

            

Reported by Pylint.

Unused variable 'err'
Error

Line: 48 Column: 18

                      self.verify_valid_flag('-S')

    def test_usage(self):
        rc, out, err = assert_python_ok('-h')
        lines = out.splitlines()
        self.assertIn(b'usage', lines[0])
        # The first line contains the program name,
        # but the rest should be ASCII-only
        b''.join(lines[1:]).decode('ascii')

            

Reported by Pylint.

Unused variable 'rc'
Error

Line: 58 Column: 13

                  def test_version(self):
        version = ('Python %d.%d' % sys.version_info[:2]).encode("ascii")
        for switch in '-V', '--version', '-VV':
            rc, out, err = assert_python_ok(switch)
            self.assertFalse(err.startswith(version))
            self.assertTrue(out.startswith(version))

    def test_verbose(self):
        # -v causes imports to write to stderr.  If the write to

            

Reported by Pylint.

Unused variable 'rc'
Error

Line: 66 Column: 9

                      # -v causes imports to write to stderr.  If the write to
        # stderr itself causes an import to happen (for the output
        # codec), a recursion loop can occur.
        rc, out, err = assert_python_ok('-v')
        self.assertNotIn(b'stack overflow', err)
        rc, out, err = assert_python_ok('-vv')
        self.assertNotIn(b'stack overflow', err)

    @unittest.skipIf(interpreter_requires_environment(),

            

Reported by Pylint.

Unused variable 'out'
Error

Line: 66 Column: 13

                      # -v causes imports to write to stderr.  If the write to
        # stderr itself causes an import to happen (for the output
        # codec), a recursion loop can occur.
        rc, out, err = assert_python_ok('-v')
        self.assertNotIn(b'stack overflow', err)
        rc, out, err = assert_python_ok('-vv')
        self.assertNotIn(b'stack overflow', err)

    @unittest.skipIf(interpreter_requires_environment(),

            

Reported by Pylint.