The following issues were found

Lib/test/test_queue.py
170 issues
Instance of 'QueueTest' has no 'queue' member
Error

Line: 244 Column: 26

              class QueueTest(BaseQueueTestMixin):

    def setUp(self):
        self.type2test = self.queue.Queue
        super().setUp()

class PyQueueTest(QueueTest, unittest.TestCase):
    queue = py_queue


            

Reported by Pylint.

Instance of 'LifoQueueTest' has no 'queue' member
Error

Line: 259 Column: 26

              class LifoQueueTest(BaseQueueTestMixin):

    def setUp(self):
        self.type2test = self.queue.LifoQueue
        super().setUp()


class PyLifoQueueTest(LifoQueueTest, unittest.TestCase):
    queue = py_queue

            

Reported by Pylint.

Instance of 'PriorityQueueTest' has no 'queue' member
Error

Line: 275 Column: 26

              class PriorityQueueTest(BaseQueueTestMixin):

    def setUp(self):
        self.type2test = self.queue.PriorityQueue
        super().setUp()


class PyPriorityQueueTest(PriorityQueueTest, unittest.TestCase):
    queue = py_queue

            

Reported by Pylint.

Instance of 'FailingQueueTest' has no 'queue' member
Error

Line: 295 Column: 17

              
    def setUp(self):

        Queue = self.queue.Queue

        class FailingQueue(Queue):
            def __init__(self, *args):
                self.fail_next_put = False
                self.fail_next_get = False

            

Reported by Pylint.

Super of 'FailingQueueTest' has no 'setUp' member
Error

Line: 315 Column: 9

              
        self.FailingQueue = FailingQueue

        super().setUp()

    def failing_queue_test(self, q):
        if q.qsize():
            raise RuntimeError("Call this function with an empty queue")
        for i in range(QUEUE_SIZE-1):

            

Reported by Pylint.

Instance of 'FailingQueueTest' has no 'fail' member
Error

Line: 326 Column: 13

                      q.fail_next_put = True
        try:
            q.put("oops", block=0)
            self.fail("The queue didn't fail when it should have")
        except FailingQueueException:
            pass
        q.fail_next_put = True
        try:
            q.put("oops", timeout=0.1)

            

Reported by Pylint.

Instance of 'FailingQueueTest' has no 'fail' member
Error

Line: 332 Column: 13

                      q.fail_next_put = True
        try:
            q.put("oops", timeout=0.1)
            self.fail("The queue didn't fail when it should have")
        except FailingQueueException:
            pass
        q.put("last")
        self.assertTrue(qfull(q), "Queue should be full")
        # Test a failing blocking put

            

Reported by Pylint.

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

Line: 336 Column: 9

                      except FailingQueueException:
            pass
        q.put("last")
        self.assertTrue(qfull(q), "Queue should be full")
        # Test a failing blocking put
        q.fail_next_put = True
        try:
            self.do_blocking_test(q.put, ("full",), q.get, ())
            self.fail("The queue didn't fail when it should have")

            

Reported by Pylint.

Instance of 'FailingQueueTest' has no 'fail' member
Error

Line: 341 Column: 13

                      q.fail_next_put = True
        try:
            self.do_blocking_test(q.put, ("full",), q.get, ())
            self.fail("The queue didn't fail when it should have")
        except FailingQueueException:
            pass
        # Check the Queue isn't damaged.
        # put failed, but get succeeded - re-add
        q.put("last")

            

Reported by Pylint.

Instance of 'FailingQueueTest' has no 'fail' member
Error

Line: 352 Column: 13

                      try:
            self.do_exceptional_blocking_test(q.put, ("full", True, 10), q.get, (),
                                              FailingQueueException)
            self.fail("The queue didn't fail when it should have")
        except FailingQueueException:
            pass
        # Check the Queue isn't damaged.
        # put failed, but get succeeded - re-add
        q.put("last")

            

Reported by Pylint.

Lib/ctypes/test/test_numbers.py
169 issues
Undefined variable 't'
Error

Line: 214 Column: 13

                      from ctypes import c_bool
        from array import array
        a = array(c_bool._type_, [True])
        v = t.from_address(a.buffer_info()[0])
        self.assertEqual(v.value, a[0])
        self.assertEqual(type(v) is t)
        a[0] = False
        self.assertEqual(v.value, a[0])
        self.assertEqual(type(v) is t)

            

Reported by Pylint.

Undefined variable 't'
Error

Line: 216 Column: 37

                      a = array(c_bool._type_, [True])
        v = t.from_address(a.buffer_info()[0])
        self.assertEqual(v.value, a[0])
        self.assertEqual(type(v) is t)
        a[0] = False
        self.assertEqual(v.value, a[0])
        self.assertEqual(type(v) is t)

    def test_init(self):

            

Reported by Pylint.

No value for argument 'second' in method call
Error

Line: 216 Column: 9

                      a = array(c_bool._type_, [True])
        v = t.from_address(a.buffer_info()[0])
        self.assertEqual(v.value, a[0])
        self.assertEqual(type(v) is t)
        a[0] = False
        self.assertEqual(v.value, a[0])
        self.assertEqual(type(v) is t)

    def test_init(self):

            

Reported by Pylint.

Undefined variable 't'
Error

Line: 219 Column: 37

                      self.assertEqual(type(v) is t)
        a[0] = False
        self.assertEqual(v.value, a[0])
        self.assertEqual(type(v) is t)

    def test_init(self):
        # c_int() can be initialized from Python's int, and c_int.
        # Not from c_long or so, which seems strange, abc should
        # probably be changed:

            

Reported by Pylint.

No value for argument 'second' in method call
Error

Line: 219 Column: 9

                      self.assertEqual(type(v) is t)
        a[0] = False
        self.assertEqual(v.value, a[0])
        self.assertEqual(type(v) is t)

    def test_init(self):
        # c_int() can be initialized from Python's int, and c_int.
        # Not from c_long or so, which seems strange, abc should
        # probably be changed:

            

Reported by Pylint.

Unused import pydll from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest
import struct

def valid_ranges(*types):
    # given a sequence of numeric types, collect their _type_
    # attribute, which is a single format character compatible with
    # the struct module, use the struct module to calculate the
    # minimum and maximum value allowed for this format.

            

Reported by Pylint.

Wildcard import ctypes
Error

Line: 1 Column: 1

              from ctypes import *
import unittest
import struct

def valid_ranges(*types):
    # given a sequence of numeric types, collect their _type_
    # attribute, which is a single format character compatible with
    # the struct module, use the struct module to calculate the
    # minimum and maximum value allowed for this format.

            

Reported by Pylint.

Unused import DEFAULT_MODE from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest
import struct

def valid_ranges(*types):
    # given a sequence of numeric types, collect their _type_
    # attribute, which is a single format character compatible with
    # the struct module, use the struct module to calculate the
    # minimum and maximum value allowed for this format.

            

Reported by Pylint.

Unused import create_string_buffer from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest
import struct

def valid_ranges(*types):
    # given a sequence of numeric types, collect their _type_
    # attribute, which is a single format character compatible with
    # the struct module, use the struct module to calculate the
    # minimum and maximum value allowed for this format.

            

Reported by Pylint.

Unused import c_buffer from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import unittest
import struct

def valid_ranges(*types):
    # given a sequence of numeric types, collect their _type_
    # attribute, which is a single format character compatible with
    # the struct module, use the struct module to calculate the
    # minimum and maximum value allowed for this format.

            

Reported by Pylint.

Lib/ctypes/test/test_callbacks.py
169 issues
Instance of 'Check' has no 'first' member
Error

Line: 280 Column: 26

                      func.restype = None
        # the function just calls the callback with the passed structure
        func(s, CALLBACK(functools.partial(callback, check)))
        self.assertEqual(check.first, s.first)
        self.assertEqual(check.second, s.second)
        self.assertEqual(check.third, s.third)
        self.assertEqual(check.first, 0xdeadbeef)
        self.assertEqual(check.second, 0xcafebabe)
        self.assertEqual(check.third, 0x0bad1dea)

            

Reported by Pylint.

Instance of 'Check' has no 'second' member
Error

Line: 281 Column: 26

                      # the function just calls the callback with the passed structure
        func(s, CALLBACK(functools.partial(callback, check)))
        self.assertEqual(check.first, s.first)
        self.assertEqual(check.second, s.second)
        self.assertEqual(check.third, s.third)
        self.assertEqual(check.first, 0xdeadbeef)
        self.assertEqual(check.second, 0xcafebabe)
        self.assertEqual(check.third, 0x0bad1dea)
        # See issue #29565.

            

Reported by Pylint.

Instance of 'Check' has no 'third' member
Error

Line: 282 Column: 26

                      func(s, CALLBACK(functools.partial(callback, check)))
        self.assertEqual(check.first, s.first)
        self.assertEqual(check.second, s.second)
        self.assertEqual(check.third, s.third)
        self.assertEqual(check.first, 0xdeadbeef)
        self.assertEqual(check.second, 0xcafebabe)
        self.assertEqual(check.third, 0x0bad1dea)
        # See issue #29565.
        # Ensure that the original struct is unchanged.

            

Reported by Pylint.

Instance of 'Check' has no 'first' member
Error

Line: 283 Column: 26

                      self.assertEqual(check.first, s.first)
        self.assertEqual(check.second, s.second)
        self.assertEqual(check.third, s.third)
        self.assertEqual(check.first, 0xdeadbeef)
        self.assertEqual(check.second, 0xcafebabe)
        self.assertEqual(check.third, 0x0bad1dea)
        # See issue #29565.
        # Ensure that the original struct is unchanged.
        self.assertEqual(s.first, check.first)

            

Reported by Pylint.

Instance of 'Check' has no 'second' member
Error

Line: 284 Column: 26

                      self.assertEqual(check.second, s.second)
        self.assertEqual(check.third, s.third)
        self.assertEqual(check.first, 0xdeadbeef)
        self.assertEqual(check.second, 0xcafebabe)
        self.assertEqual(check.third, 0x0bad1dea)
        # See issue #29565.
        # Ensure that the original struct is unchanged.
        self.assertEqual(s.first, check.first)
        self.assertEqual(s.second, check.second)

            

Reported by Pylint.

Instance of 'Check' has no 'third' member
Error

Line: 285 Column: 26

                      self.assertEqual(check.third, s.third)
        self.assertEqual(check.first, 0xdeadbeef)
        self.assertEqual(check.second, 0xcafebabe)
        self.assertEqual(check.third, 0x0bad1dea)
        # See issue #29565.
        # Ensure that the original struct is unchanged.
        self.assertEqual(s.first, check.first)
        self.assertEqual(s.second, check.second)
        self.assertEqual(s.third, check.third)

            

Reported by Pylint.

Instance of 'Check' has no 'first' member
Error

Line: 288 Column: 35

                      self.assertEqual(check.third, 0x0bad1dea)
        # See issue #29565.
        # Ensure that the original struct is unchanged.
        self.assertEqual(s.first, check.first)
        self.assertEqual(s.second, check.second)
        self.assertEqual(s.third, check.third)

    def test_callback_too_many_args(self):
        def func(*args):

            

Reported by Pylint.

Instance of 'Check' has no 'second' member
Error

Line: 289 Column: 36

                      # See issue #29565.
        # Ensure that the original struct is unchanged.
        self.assertEqual(s.first, check.first)
        self.assertEqual(s.second, check.second)
        self.assertEqual(s.third, check.third)

    def test_callback_too_many_args(self):
        def func(*args):
            return len(args)

            

Reported by Pylint.

Instance of 'Check' has no 'third' member
Error

Line: 290 Column: 35

                      # Ensure that the original struct is unchanged.
        self.assertEqual(s.first, check.first)
        self.assertEqual(s.second, check.second)
        self.assertEqual(s.third, check.third)

    def test_callback_too_many_args(self):
        def func(*args):
            return len(args)


            

Reported by Pylint.

Unused import alignment from wildcard import
Error

Line: 5 Column: 1

              import unittest
from test import support

from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test

class Callbacks(unittest.TestCase):
    functype = CFUNCTYPE

            

Reported by Pylint.

Lib/turtledemo/penrose.py
169 issues
Undefined variable 'lt'
Error

Line: 27 Column: 5

              
def kite(l):
    fl = f * l
    lt(36)
    fd(l)
    rt(108)
    fd(fl)
    rt(36)
    fd(fl)

            

Reported by Pylint.

Undefined variable 'fd'
Error

Line: 28 Column: 5

              def kite(l):
    fl = f * l
    lt(36)
    fd(l)
    rt(108)
    fd(fl)
    rt(36)
    fd(fl)
    rt(108)

            

Reported by Pylint.

Undefined variable 'rt'
Error

Line: 29 Column: 5

                  fl = f * l
    lt(36)
    fd(l)
    rt(108)
    fd(fl)
    rt(36)
    fd(fl)
    rt(108)
    fd(l)

            

Reported by Pylint.

Undefined variable 'fd'
Error

Line: 30 Column: 5

                  lt(36)
    fd(l)
    rt(108)
    fd(fl)
    rt(36)
    fd(fl)
    rt(108)
    fd(l)
    rt(144)

            

Reported by Pylint.

Undefined variable 'rt'
Error

Line: 31 Column: 5

                  fd(l)
    rt(108)
    fd(fl)
    rt(36)
    fd(fl)
    rt(108)
    fd(l)
    rt(144)


            

Reported by Pylint.

Undefined variable 'fd'
Error

Line: 32 Column: 5

                  rt(108)
    fd(fl)
    rt(36)
    fd(fl)
    rt(108)
    fd(l)
    rt(144)

def dart(l):

            

Reported by Pylint.

Undefined variable 'rt'
Error

Line: 33 Column: 5

                  fd(fl)
    rt(36)
    fd(fl)
    rt(108)
    fd(l)
    rt(144)

def dart(l):
    fl = f * l

            

Reported by Pylint.

Undefined variable 'fd'
Error

Line: 34 Column: 5

                  rt(36)
    fd(fl)
    rt(108)
    fd(l)
    rt(144)

def dart(l):
    fl = f * l
    lt(36)

            

Reported by Pylint.

Undefined variable 'rt'
Error

Line: 35 Column: 5

                  fd(fl)
    rt(108)
    fd(l)
    rt(144)

def dart(l):
    fl = f * l
    lt(36)
    fd(l)

            

Reported by Pylint.

Undefined variable 'lt'
Error

Line: 39 Column: 5

              
def dart(l):
    fl = f * l
    lt(36)
    fd(l)
    rt(144)
    fd(fl)
    lt(36)
    fd(fl)

            

Reported by Pylint.

Lib/difflib.py
168 issues
Attribute 'opcodes' defined outside __init__
Error

Line: 252 Column: 32

                      if a is self.a:
            return
        self.a = a
        self.matching_blocks = self.opcodes = None

    def set_seq2(self, b):
        """Set the second sequence to be compared.

        The first sequence to be compared is not changed.

            

Reported by Pylint.

Attribute 'matching_blocks' defined outside __init__
Error

Line: 252 Column: 9

                      if a is self.a:
            return
        self.a = a
        self.matching_blocks = self.opcodes = None

    def set_seq2(self, b):
        """Set the second sequence to be compared.

        The first sequence to be compared is not changed.

            

Reported by Pylint.

Attribute 'opcodes' defined outside __init__
Error

Line: 278 Column: 32

                      if b is self.b:
            return
        self.b = b
        self.matching_blocks = self.opcodes = None
        self.fullbcount = None
        self.__chain_b()

    # For each element x in b, set b2j[x] to a list of the indices in
    # b where x appears; the indices are in increasing order; note that

            

Reported by Pylint.

Attribute 'matching_blocks' defined outside __init__
Error

Line: 278 Column: 9

                      if b is self.b:
            return
        self.b = b
        self.matching_blocks = self.opcodes = None
        self.fullbcount = None
        self.__chain_b()

    # For each element x in b, set b2j[x] to a list of the indices in
    # b where x appears; the indices are in increasing order; note that

            

Reported by Pylint.

Attribute 'fullbcount' defined outside __init__
Error

Line: 279 Column: 9

                          return
        self.b = b
        self.matching_blocks = self.opcodes = None
        self.fullbcount = None
        self.__chain_b()

    # For each element x in b, set b2j[x] to a list of the indices in
    # b where x appears; the indices are in increasing order; note that
    # the number of times x appears in b is len(b2j[x]) ...

            

Reported by Pylint.

Attribute 'b2j' defined outside __init__
Error

Line: 310 Column: 9

                      # out the junk later is much cheaper than building b2j "right"
        # from the start.
        b = self.b
        self.b2j = b2j = {}

        for i, elt in enumerate(b):
            indices = b2j.setdefault(elt, [])
            indices.append(i)


            

Reported by Pylint.

Attribute 'bjunk' defined outside __init__
Error

Line: 317 Column: 9

                          indices.append(i)

        # Purge junk elements
        self.bjunk = junk = set()
        isjunk = self.isjunk
        if isjunk:
            for elt in b2j.keys():
                if isjunk(elt):
                    junk.add(elt)

            

Reported by Pylint.

Attribute 'bpopular' defined outside __init__
Error

Line: 327 Column: 9

                              del b2j[elt]

        # Purge popular elements that are not junk
        self.bpopular = popular = set()
        n = len(b)
        if self.autojunk and n >= 200:
            ntest = n // 100 + 1
            for elt, idxs in b2j.items():
                if len(idxs) > ntest:

            

Reported by Pylint.

Attribute 'matching_blocks' defined outside __init__
Error

Line: 521 Column: 9

                          non_adjacent.append((i1, j1, k1))

        non_adjacent.append( (la, lb, 0) )
        self.matching_blocks = list(map(Match._make, non_adjacent))
        return self.matching_blocks

    def get_opcodes(self):
        """Return list of 5-tuples describing how to turn a into b.


            

Reported by Pylint.

Attribute 'opcodes' defined outside __init__
Error

Line: 556 Column: 9

                      if self.opcodes is not None:
            return self.opcodes
        i = j = 0
        self.opcodes = answer = []
        for ai, bj, size in self.get_matching_blocks():
            # invariant:  we've pumped out correct diffs to change
            # a[:i] into b[:j], and the next matching block is
            # a[ai:ai+size] == b[bj:bj+size].  So we need to pump
            # out a diff to change a[i:ai] into b[j:bj], pump out

            

Reported by Pylint.

Lib/idlelib/autocomplete_w.py
168 issues
Unused import Image from wildcard import
Error

Line: 6 Column: 1

              """
import platform

from tkinter import *
from tkinter.ttk import Scrollbar

from idlelib.autocomplete import FILES, ATTRS
from idlelib.multicall import MC_SHIFT


            

Reported by Pylint.

Unused import types from wildcard import
Error

Line: 6 Column: 1

              """
import platform

from tkinter import *
from tkinter.ttk import Scrollbar

from idlelib.autocomplete import FILES, ATTRS
from idlelib.multicall import MC_SHIFT


            

Reported by Pylint.

Unused import re from wildcard import
Error

Line: 6 Column: 1

              """
import platform

from tkinter import *
from tkinter.ttk import Scrollbar

from idlelib.autocomplete import FILES, ATTRS
from idlelib.multicall import MC_SHIFT


            

Reported by Pylint.

Unused import TclVersion from wildcard import
Error

Line: 6 Column: 1

              """
import platform

from tkinter import *
from tkinter.ttk import Scrollbar

from idlelib.autocomplete import FILES, ATTRS
from idlelib.multicall import MC_SHIFT


            

Reported by Pylint.

Unused import READABLE from wildcard import
Error

Line: 6 Column: 1

              """
import platform

from tkinter import *
from tkinter.ttk import Scrollbar

from idlelib.autocomplete import FILES, ATTRS
from idlelib.multicall import MC_SHIFT


            

Reported by Pylint.

Unused import WRITABLE from wildcard import
Error

Line: 6 Column: 1

              """
import platform

from tkinter import *
from tkinter.ttk import Scrollbar

from idlelib.autocomplete import FILES, ATTRS
from idlelib.multicall import MC_SHIFT


            

Reported by Pylint.

Unused import EXCEPTION from wildcard import
Error

Line: 6 Column: 1

              """
import platform

from tkinter import *
from tkinter.ttk import Scrollbar

from idlelib.autocomplete import FILES, ATTRS
from idlelib.multicall import MC_SHIFT


            

Reported by Pylint.

Unused import Event from wildcard import
Error

Line: 6 Column: 1

              """
import platform

from tkinter import *
from tkinter.ttk import Scrollbar

from idlelib.autocomplete import FILES, ATTRS
from idlelib.multicall import MC_SHIFT


            

Reported by Pylint.

Unused import NoDefaultRoot from wildcard import
Error

Line: 6 Column: 1

              """
import platform

from tkinter import *
from tkinter.ttk import Scrollbar

from idlelib.autocomplete import FILES, ATTRS
from idlelib.multicall import MC_SHIFT


            

Reported by Pylint.

Unused import Variable from wildcard import
Error

Line: 6 Column: 1

              """
import platform

from tkinter import *
from tkinter.ttk import Scrollbar

from idlelib.autocomplete import FILES, ATTRS
from idlelib.multicall import MC_SHIFT


            

Reported by Pylint.

Lib/test/test_plistlib.py
167 issues
Module 'plistlib' has no 'FMT_XML' member
Error

Line: 22 Column: 14

              
from plistlib import UID

ALL_FORMATS=(plistlib.FMT_XML, plistlib.FMT_BINARY)

# The testdata is generated using Mac/Tools/plistlib_generate_testdata.py
# (which using PyObjC to control the Cocoa classes for generating plists)
TESTDATA={
    plistlib.FMT_XML: binascii.a2b_base64(b'''

            

Reported by Pylint.

Module 'plistlib' has no 'FMT_BINARY' member
Error

Line: 22 Column: 32

              
from plistlib import UID

ALL_FORMATS=(plistlib.FMT_XML, plistlib.FMT_BINARY)

# The testdata is generated using Mac/Tools/plistlib_generate_testdata.py
# (which using PyObjC to control the Cocoa classes for generating plists)
TESTDATA={
    plistlib.FMT_XML: binascii.a2b_base64(b'''

            

Reported by Pylint.

Module 'plistlib' has no 'FMT_XML' member
Error

Line: 27 Column: 5

              # The testdata is generated using Mac/Tools/plistlib_generate_testdata.py
# (which using PyObjC to control the Cocoa classes for generating plists)
TESTDATA={
    plistlib.FMT_XML: binascii.a2b_base64(b'''
        PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NU
        WVBFIHBsaXN0IFBVQkxJQyAiLS8vQXBwbGUvL0RURCBQTElTVCAxLjAvL0VO
        IiAiaHR0cDovL3d3dy5hcHBsZS5jb20vRFREcy9Qcm9wZXJ0eUxpc3QtMS4w
        LmR0ZCI+CjxwbGlzdCB2ZXJzaW9uPSIxLjAiPgo8ZGljdD4KCTxrZXk+YUJp
        Z0ludDwva2V5PgoJPGludGVnZXI+OTIyMzM3MjAzNjg1NDc3NTc2NDwvaW50

            

Reported by Pylint.

Module 'plistlib' has no 'FMT_BINARY' member
Error

Line: 79 Column: 5

                      dmRITWdiMllnWW1sdVlYSjVJR2QxYm1zK0FBRUNBdz09Cgk8L2RhdGE+Cgk8
        a2V5PsOFYmVucmFhPC9rZXk+Cgk8c3RyaW5nPlRoYXQgd2FzIGEgdW5pY29k
        ZSBrZXkuPC9zdHJpbmc+CjwvZGljdD4KPC9wbGlzdD4K'''),
    plistlib.FMT_BINARY: binascii.a2b_base64(b'''
        YnBsaXN0MDDfEBABAgMEBQYHCAkKCwwNDg8QERITFCgpLzAxMjM0NTc2OFdh
        QmlnSW50WGFCaWdJbnQyVWFEYXRlVWFEaWN0VmFGbG9hdFVhTGlzdF8QD2FO
        ZWdhdGl2ZUJpZ0ludFxhTmVnYXRpdmVJbnRXYVN0cmluZ1thbkVtcHR5RGlj
        dFthbkVtcHR5TGlzdFVhbkludFpuZXN0ZWREYXRhWHNvbWVEYXRhXHNvbWVN
        b3JlRGF0YWcAxQBiAGUAbgByAGEAYRN/////////1BQAAAAAAAAAAIAAAAAA

            

Reported by Pylint.

Module 'plistlib' has no 'FMT_BINARY' member
Error

Line: 525 Column: 66

              
    def test_uid(self):
        data = UID(1)
        self.assertEqual(plistlib.loads(plistlib.dumps(data, fmt=plistlib.FMT_BINARY)), data)
        dict_data = {
            'uid0': UID(0),
            'uid2': UID(2),
            'uid8': UID(2 ** 8),
            'uid16': UID(2 ** 16),

            

Reported by Pylint.

Module 'plistlib' has no 'FMT_BINARY' member
Error

Line: 534 Column: 71

                          'uid32': UID(2 ** 32),
            'uid63': UID(2 ** 63)
        }
        self.assertEqual(plistlib.loads(plistlib.dumps(dict_data, fmt=plistlib.FMT_BINARY)), dict_data)

    def test_uid_data(self):
        uid = UID(1)
        self.assertEqual(uid.data, 1)


            

Reported by Pylint.

Module 'plistlib' has no 'FMT_BINARY' member
Error

Line: 680 Column: 27

                                  'second': [1, 2],
                    'third': [3, 4],
                })
                if fmt != plistlib.FMT_BINARY:
                    self.assertIsNot(pl2['first'], pl2['second'])

    def test_list_members(self):
        pl = {
            'first': [1, 2],

            

Reported by Pylint.

Module 'plistlib' has no 'FMT_XML' member
Error

Line: 725 Column: 55

                          testString = "string containing %s" % c
            if i >= 32 or c in "\r\n\t":
                # \r, \n and \t are the only legal control chars in XML
                data = plistlib.dumps(testString, fmt=plistlib.FMT_XML)
                if c != "\r":
                    self.assertEqual(plistlib.loads(data), testString)
            else:
                with self.assertRaises(ValueError):
                    plistlib.dumps(testString, fmt=plistlib.FMT_XML)

            

Reported by Pylint.

Module 'plistlib' has no 'FMT_XML' member
Error

Line: 730 Column: 52

                                  self.assertEqual(plistlib.loads(data), testString)
            else:
                with self.assertRaises(ValueError):
                    plistlib.dumps(testString, fmt=plistlib.FMT_XML)
            plistlib.dumps(testString, fmt=plistlib.FMT_BINARY)

    def test_non_bmp_characters(self):
        pl = {'python': '\U0001f40d'}
        for fmt in ALL_FORMATS:

            

Reported by Pylint.

Module 'plistlib' has no 'FMT_BINARY' member
Error

Line: 731 Column: 44

                          else:
                with self.assertRaises(ValueError):
                    plistlib.dumps(testString, fmt=plistlib.FMT_XML)
            plistlib.dumps(testString, fmt=plistlib.FMT_BINARY)

    def test_non_bmp_characters(self):
        pl = {'python': '\U0001f40d'}
        for fmt in ALL_FORMATS:
            with self.subTest(fmt=fmt):

            

Reported by Pylint.

Lib/test/test_selectors.py
167 issues
Instance of 'BaseSelectorTestCase' has no 'SELECTOR' member
Error

Line: 61 Column: 13

                      return rd, wr

    def test_register(self):
        s = self.SELECTOR()
        self.addCleanup(s.close)

        rd, wr = self.make_socketpair()

        key = s.register(rd, selectors.EVENT_READ, "data")

            

Reported by Pylint.

Instance of 'BaseSelectorTestCase' has no 'SELECTOR' member
Error

Line: 87 Column: 13

                                        selectors.EVENT_READ)

    def test_unregister(self):
        s = self.SELECTOR()
        self.addCleanup(s.close)

        rd, wr = self.make_socketpair()

        s.register(rd, selectors.EVENT_READ)

            

Reported by Pylint.

Instance of 'BaseSelectorTestCase' has no 'SELECTOR' member
Error

Line: 102 Column: 13

                      self.assertRaises(KeyError, s.unregister, rd)

    def test_unregister_after_fd_close(self):
        s = self.SELECTOR()
        self.addCleanup(s.close)
        rd, wr = self.make_socketpair()
        r, w = rd.fileno(), wr.fileno()
        s.register(r, selectors.EVENT_READ)
        s.register(w, selectors.EVENT_WRITE)

            

Reported by Pylint.

Instance of 'BaseSelectorTestCase' has no 'SELECTOR' member
Error

Line: 115 Column: 13

              
    @unittest.skipUnless(os.name == 'posix', "requires posix")
    def test_unregister_after_fd_close_and_reuse(self):
        s = self.SELECTOR()
        self.addCleanup(s.close)
        rd, wr = self.make_socketpair()
        r, w = rd.fileno(), wr.fileno()
        s.register(r, selectors.EVENT_READ)
        s.register(w, selectors.EVENT_WRITE)

            

Reported by Pylint.

Instance of 'BaseSelectorTestCase' has no 'SELECTOR' member
Error

Line: 132 Column: 13

                      s.unregister(w)

    def test_unregister_after_socket_close(self):
        s = self.SELECTOR()
        self.addCleanup(s.close)
        rd, wr = self.make_socketpair()
        s.register(rd, selectors.EVENT_READ)
        s.register(wr, selectors.EVENT_WRITE)
        rd.close()

            

Reported by Pylint.

Instance of 'BaseSelectorTestCase' has no 'SELECTOR' member
Error

Line: 143 Column: 13

                      s.unregister(wr)

    def test_modify(self):
        s = self.SELECTOR()
        self.addCleanup(s.close)

        rd, wr = self.make_socketpair()

        key = s.register(rd, selectors.EVENT_READ)

            

Reported by Pylint.

Instance of 'BaseSelectorTestCase' has no 'SELECTOR' member
Error

Line: 183 Column: 12

                  def test_modify_unregister(self):
        # Make sure the fd is unregister()ed in case of error on
        # modify(): http://bugs.python.org/issue30014
        if self.SELECTOR.__name__ == 'EpollSelector':
            patch = unittest.mock.patch(
                'selectors.EpollSelector._selector_cls')
        elif self.SELECTOR.__name__ == 'PollSelector':
            patch = unittest.mock.patch(
                'selectors.PollSelector._selector_cls')

            

Reported by Pylint.

Instance of 'BaseSelectorTestCase' has no 'SELECTOR' member
Error

Line: 186 Column: 14

                      if self.SELECTOR.__name__ == 'EpollSelector':
            patch = unittest.mock.patch(
                'selectors.EpollSelector._selector_cls')
        elif self.SELECTOR.__name__ == 'PollSelector':
            patch = unittest.mock.patch(
                'selectors.PollSelector._selector_cls')
        elif self.SELECTOR.__name__ == 'DevpollSelector':
            patch = unittest.mock.patch(
                'selectors.DevpollSelector._selector_cls')

            

Reported by Pylint.

Instance of 'BaseSelectorTestCase' has no 'SELECTOR' member
Error

Line: 189 Column: 14

                      elif self.SELECTOR.__name__ == 'PollSelector':
            patch = unittest.mock.patch(
                'selectors.PollSelector._selector_cls')
        elif self.SELECTOR.__name__ == 'DevpollSelector':
            patch = unittest.mock.patch(
                'selectors.DevpollSelector._selector_cls')
        else:
            raise self.skipTest("")


            

Reported by Pylint.

Instance of 'BaseSelectorTestCase' has no 'SELECTOR' member
Error

Line: 198 Column: 17

                      with patch as m:
            m.return_value.modify = unittest.mock.Mock(
                side_effect=ZeroDivisionError)
            s = self.SELECTOR()
            self.addCleanup(s.close)
            rd, wr = self.make_socketpair()
            s.register(rd, selectors.EVENT_READ)
            self.assertEqual(len(s._map), 1)
            with self.assertRaises(ZeroDivisionError):

            

Reported by Pylint.

Lib/xmlrpc/client.py
165 issues
FastUnmarshaller is not callable
Error

Line: 915 Column: 18

                      else:
            mkdatetime = _datetime
            mkbytes = _binary
        target = FastUnmarshaller(True, False, mkbytes, mkdatetime, Fault)
        parser = FastParser(target)
    else:
        target = Unmarshaller(use_datetime=use_datetime, use_builtin_types=use_builtin_types)
        if FastParser:
            parser = FastParser(target)

            

Reported by Pylint.

FastParser is not callable
Error

Line: 916 Column: 18

                          mkdatetime = _datetime
            mkbytes = _binary
        target = FastUnmarshaller(True, False, mkbytes, mkdatetime, Fault)
        parser = FastParser(target)
    else:
        target = Unmarshaller(use_datetime=use_datetime, use_builtin_types=use_builtin_types)
        if FastParser:
            parser = FastParser(target)
        else:

            

Reported by Pylint.

FastParser is not callable
Error

Line: 920 Column: 22

                  else:
        target = Unmarshaller(use_datetime=use_datetime, use_builtin_types=use_builtin_types)
        if FastParser:
            parser = FastParser(target)
        else:
            parser = ExpatParser(target)
    return parser, target

##

            

Reported by Pylint.

FastMarshaller is not callable
Error

Line: 971 Column: 13

                      encoding = "utf-8"

    if FastMarshaller:
        m = FastMarshaller(encoding)
    else:
        m = Marshaller(encoding, allow_none)

    data = m.dumps(params)


            

Reported by Pylint.

Unnecessary pass statement
Error

Line: 222 Column: 5

              
class ResponseError(Error):
    """Indicates a broken response package."""
    pass

##
# Indicates an XML-RPC fault response package.  This exception is
# raised by the unmarshalling layer, if the XML-RPC response contains
# a fault string.  This exception can also be used as a class, to

            

Reported by Pylint.

Unused argument 'extra'
Error

Line: 235 Column: 1

              
class Fault(Error):
    """Indicates an XML-RPC fault package."""
    def __init__(self, faultCode, faultString, **extra):
        Error.__init__(self)
        self.faultCode = faultCode
        self.faultString = faultString
    def __repr__(self):
        return "<%s %s: %r>" % (self.__class__.__name__,

            

Reported by Pylint.

XXX encoding?!
Error

Line: 406 Column: 3

                  # @return Buffer contents, as an 8-bit string.

    def __str__(self):
        return str(self.data, "latin-1")  # XXX encoding?!

    def __eq__(self, other):
        if isinstance(other, Binary):
            other = other.data
        return self.data == other

            

Reported by Pylint.

FIXME: the xml-rpc specification allows us to leave out
Error

Line: 500 Column: 3

                          write("</fault>\n")
        else:
            # parameter block
            # FIXME: the xml-rpc specification allows us to leave out
            # the entire <params> block if there are no parameters.
            # however, changing this may break older code (including
            # old versions of xmlrpclib.py), so this is better left as
            # is for now.  See @XMLRPC3 for more information. /F
            write("<params>\n")

            

Reported by Pylint.

Redefining name 'v' from outer scope (line 1515)
Error

Line: 506 Column: 17

                          # old versions of xmlrpclib.py), so this is better left as
            # is for now.  See @XMLRPC3 for more information. /F
            write("<params>\n")
            for v in values:
                write("<param>\n")
                dump(v, write)
                write("</param>\n")
            write("</params>\n")
        result = "".join(out)

            

Reported by Pylint.

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

Line: 520 Column: 17

                      except KeyError:
            # check if this object can be marshalled as a structure
            if not hasattr(value, '__dict__'):
                raise TypeError("cannot marshal %s objects" % type(value))
            # check if this class is a sub-class of a basic type,
            # because we don't know how to marshal these types
            # (e.g. a string sub-class)
            for type_ in type(value).__mro__:
                if type_ in self.dispatch.keys():

            

Reported by Pylint.

Lib/test/test_hmac.py
165 issues
Access to a protected member _init_old of a client class
Error

Line: 96 Column: 9

                      )

        h = hmac.HMAC.__new__(hmac.HMAC)
        h._init_old(key, data, digestmod=hashname)
        self.assert_hmac_internals(
            h, digest, hashname, digest_size, block_size
        )

        if c_hmac_new is not None:

            

Reported by Pylint.

Access to a protected member _init_hmac of a client class
Error

Line: 120 Column: 13

                          )

            h = hmac.HMAC.__new__(hmac.HMAC)
            h._init_hmac(key, data, digestmod=hashname)
            self.assert_hmac_internals(
                h, digest, hashname, digest_size, block_size
            )

    @hashlib_helper.requires_hashdigest('md5', openssl=True)

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 388 Column: 16

                      # Standard constructor call.
        try:
            hmac.HMAC(b"key", digestmod='sha256')
        except Exception:
            self.fail("Standard constructor call raised exception.")

    @hashlib_helper.requires_hashdigest('sha256')
    def test_with_str_key(self):
        # Pass a key of type str, which is an error, because it expects a key

            

Reported by Pylint.

Unused variable 'h'
Error

Line: 396 Column: 13

                      # Pass a key of type str, which is an error, because it expects a key
        # of type bytes
        with self.assertRaises(TypeError):
            h = hmac.HMAC("key", digestmod='sha256')

    @hashlib_helper.requires_hashdigest('sha256')
    def test_dot_new_with_str_key(self):
        # Pass a key of type str, which is an error, because it expects a key
        # of type bytes

            

Reported by Pylint.

Unused variable 'h'
Error

Line: 403 Column: 13

                      # Pass a key of type str, which is an error, because it expects a key
        # of type bytes
        with self.assertRaises(TypeError):
            h = hmac.new("key", digestmod='sha256')

    @hashlib_helper.requires_hashdigest('sha256')
    def test_withtext(self):
        # Constructor call with text.
        try:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 410 Column: 16

                      # Constructor call with text.
        try:
            h = hmac.HMAC(b"key", b"hash this!", digestmod='sha256')
        except Exception:
            self.fail("Constructor call with text argument raised exception.")
        self.assertEqual(h.hexdigest(), self.expected)

    @hashlib_helper.requires_hashdigest('sha256')
    def test_with_bytearray(self):

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 419 Column: 16

                      try:
            h = hmac.HMAC(bytearray(b"key"), bytearray(b"hash this!"),
                          digestmod="sha256")
        except Exception:
            self.fail("Constructor call with bytearray arguments raised exception.")
        self.assertEqual(h.hexdigest(), self.expected)

    @hashlib_helper.requires_hashdigest('sha256')
    def test_with_memoryview_msg(self):

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 427 Column: 16

                  def test_with_memoryview_msg(self):
        try:
            h = hmac.HMAC(b"key", memoryview(b"hash this!"), digestmod="sha256")
        except Exception:
            self.fail("Constructor call with memoryview msg raised exception.")
        self.assertEqual(h.hexdigest(), self.expected)

    @hashlib_helper.requires_hashdigest('sha256')
    def test_withmodule(self):

            

Reported by Pylint.

Unused variable 'h'
Error

Line: 435 Column: 13

                  def test_withmodule(self):
        # Constructor call with text and digest module.
        try:
            h = hmac.HMAC(b"key", b"", hashlib.sha256)
        except Exception:
            self.fail("Constructor call with hashlib.sha256 raised exception.")

    @unittest.skipUnless(C_HMAC is not None, 'need _hashlib')
    def test_internal_types(self):

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 436 Column: 16

                      # Constructor call with text and digest module.
        try:
            h = hmac.HMAC(b"key", b"", hashlib.sha256)
        except Exception:
            self.fail("Constructor call with hashlib.sha256 raised exception.")

    @unittest.skipUnless(C_HMAC is not None, 'need _hashlib')
    def test_internal_types(self):
        # internal types like _hashlib.C_HMAC are not constructable

            

Reported by Pylint.