The following issues were found
Lib/test/dtracedata/gc.py
9 issues
Line: 4
Column: 5
import gc
def start():
gc.collect(0)
gc.collect(1)
gc.collect(2)
l = []
l.append(l)
del l
Reported by Pylint.
Line: 5
Column: 5
def start():
gc.collect(0)
gc.collect(1)
gc.collect(2)
l = []
l.append(l)
del l
gc.collect(2)
Reported by Pylint.
Line: 6
Column: 5
def start():
gc.collect(0)
gc.collect(1)
gc.collect(2)
l = []
l.append(l)
del l
gc.collect(2)
Reported by Pylint.
Line: 10
Column: 5
l = []
l.append(l)
del l
gc.collect(2)
gc.collect()
start()
Reported by Pylint.
Line: 12
Column: 1
del l
gc.collect(2)
gc.collect()
start()
Reported by Pylint.
Line: 1
Column: 1
import gc
def start():
gc.collect(0)
gc.collect(1)
gc.collect(2)
l = []
l.append(l)
del l
Reported by Pylint.
Line: 1
Column: 1
import gc
def start():
gc.collect(0)
gc.collect(1)
gc.collect(2)
l = []
l.append(l)
del l
Reported by Pylint.
Line: 3
Column: 1
import gc
def start():
gc.collect(0)
gc.collect(1)
gc.collect(2)
l = []
l.append(l)
del l
Reported by Pylint.
Line: 7
Column: 5
gc.collect(0)
gc.collect(1)
gc.collect(2)
l = []
l.append(l)
del l
gc.collect(2)
gc.collect()
Reported by Pylint.
Lib/test/test_global.py
9 issues
Line: 13
Column: 9
def setUp(self):
self._warnings_manager = check_warnings()
self._warnings_manager.__enter__()
warnings.filterwarnings("error", module="<test string>")
def tearDown(self):
self._warnings_manager.__exit__(None, None, None)
Reported by Pylint.
Line: 17
Column: 9
warnings.filterwarnings("error", module="<test string>")
def tearDown(self):
self._warnings_manager.__exit__(None, None, None)
def test1(self):
prog_text_1 = """\
def wrong1():
Reported by Pylint.
Line: 9
Column: 1
import warnings
class GlobalTests(unittest.TestCase):
def setUp(self):
self._warnings_manager = check_warnings()
self._warnings_manager.__enter__()
warnings.filterwarnings("error", module="<test string>")
Reported by Pylint.
Line: 20
Column: 5
self._warnings_manager.__exit__(None, None, None)
def test1(self):
prog_text_1 = """\
def wrong1():
a = 1
b = 2
global a
Reported by Pylint.
Line: 30
Column: 5
"""
check_syntax_error(self, prog_text_1, lineno=4, offset=5)
def test2(self):
prog_text_2 = """\
def wrong2():
print(x)
global x
"""
Reported by Pylint.
Line: 38
Column: 5
"""
check_syntax_error(self, prog_text_2, lineno=3, offset=5)
def test3(self):
prog_text_3 = """\
def wrong3():
print(x)
x = 2
global x
Reported by Pylint.
Line: 47
Column: 5
"""
check_syntax_error(self, prog_text_3, lineno=4, offset=5)
def test4(self):
prog_text_4 = """\
global x
x = 2
"""
# this should work
Reported by Pylint.
Line: 47
Column: 5
"""
check_syntax_error(self, prog_text_3, lineno=4, offset=5)
def test4(self):
prog_text_4 = """\
global x
x = 2
"""
# this should work
Reported by Pylint.
Line: 56
Column: 1
compile(prog_text_4, "<test string>", "exec")
def test_main():
with warnings.catch_warnings():
warnings.filterwarnings("error", module="<test string>")
run_unittest(GlobalTests)
if __name__ == "__main__":
Reported by Pylint.
Lib/encodings/latin_1.py
9 issues
Line: 21
Column: 22
decode = codecs.latin_1_decode
class IncrementalEncoder(codecs.IncrementalEncoder):
def encode(self, input, final=False):
return codecs.latin_1_encode(input,self.errors)[0]
class IncrementalDecoder(codecs.IncrementalDecoder):
def decode(self, input, final=False):
return codecs.latin_1_decode(input,self.errors)[0]
Reported by Pylint.
Line: 25
Column: 22
return codecs.latin_1_encode(input,self.errors)[0]
class IncrementalDecoder(codecs.IncrementalDecoder):
def decode(self, input, final=False):
return codecs.latin_1_decode(input,self.errors)[0]
class StreamWriter(Codec,codecs.StreamWriter):
pass
Reported by Pylint.
Line: 13
Column: 1
### Codec APIs
class Codec(codecs.Codec):
# Note: Binding these as C functions will result in the class not
# converting them to methods. This is intended.
encode = codecs.latin_1_encode
decode = codecs.latin_1_decode
Reported by Pylint.
Line: 20
Column: 1
encode = codecs.latin_1_encode
decode = codecs.latin_1_decode
class IncrementalEncoder(codecs.IncrementalEncoder):
def encode(self, input, final=False):
return codecs.latin_1_encode(input,self.errors)[0]
class IncrementalDecoder(codecs.IncrementalDecoder):
def decode(self, input, final=False):
Reported by Pylint.
Line: 24
Column: 1
def encode(self, input, final=False):
return codecs.latin_1_encode(input,self.errors)[0]
class IncrementalDecoder(codecs.IncrementalDecoder):
def decode(self, input, final=False):
return codecs.latin_1_decode(input,self.errors)[0]
class StreamWriter(Codec,codecs.StreamWriter):
pass
Reported by Pylint.
Line: 28
Column: 1
def decode(self, input, final=False):
return codecs.latin_1_decode(input,self.errors)[0]
class StreamWriter(Codec,codecs.StreamWriter):
pass
class StreamReader(Codec,codecs.StreamReader):
pass
Reported by Pylint.
Line: 31
Column: 1
class StreamWriter(Codec,codecs.StreamWriter):
pass
class StreamReader(Codec,codecs.StreamReader):
pass
class StreamConverter(StreamWriter,StreamReader):
encode = codecs.latin_1_decode
Reported by Pylint.
Line: 34
Column: 1
class StreamReader(Codec,codecs.StreamReader):
pass
class StreamConverter(StreamWriter,StreamReader):
encode = codecs.latin_1_decode
decode = codecs.latin_1_encode
### encodings module API
Reported by Pylint.
Line: 41
Column: 1
### encodings module API
def getregentry():
return codecs.CodecInfo(
name='iso8859-1',
encode=Codec.encode,
decode=Codec.decode,
incrementalencoder=IncrementalEncoder,
Reported by Pylint.
Lib/abc.py
9 issues
Line: 43
Column: 24
__isabstractmethod__ = True
def __init__(self, callable):
callable.__isabstractmethod__ = True
super().__init__(callable)
class abstractstaticmethod(staticmethod):
Reported by Pylint.
Line: 63
Column: 24
__isabstractmethod__ = True
def __init__(self, callable):
callable.__isabstractmethod__ = True
super().__init__(callable)
class abstractproperty(property):
Reported by Pylint.
Line: 28
Column: 1
return funcobj
class abstractclassmethod(classmethod):
"""A decorator indicating abstract classmethods.
Deprecated, use 'classmethod' with 'abstractmethod' instead:
class C(ABC):
Reported by Pylint.
Line: 28
Column: 1
return funcobj
class abstractclassmethod(classmethod):
"""A decorator indicating abstract classmethods.
Deprecated, use 'classmethod' with 'abstractmethod' instead:
class C(ABC):
Reported by Pylint.
Line: 48
Column: 1
super().__init__(callable)
class abstractstaticmethod(staticmethod):
"""A decorator indicating abstract staticmethods.
Deprecated, use 'staticmethod' with 'abstractmethod' instead:
class C(ABC):
Reported by Pylint.
Line: 48
Column: 1
super().__init__(callable)
class abstractstaticmethod(staticmethod):
"""A decorator indicating abstract staticmethods.
Deprecated, use 'staticmethod' with 'abstractmethod' instead:
class C(ABC):
Reported by Pylint.
Line: 68
Column: 1
super().__init__(callable)
class abstractproperty(property):
"""A decorator indicating abstract properties.
Deprecated, use 'property' with 'abstractmethod' instead:
class C(ABC):
Reported by Pylint.
Line: 105
Column: 9
implementations defined by the registering ABC be callable (not
even via super()).
"""
def __new__(mcls, name, bases, namespace, **kwargs):
cls = super().__new__(mcls, name, bases, namespace, **kwargs)
_abc_init(cls)
return cls
def register(cls, subclass):
Reported by Pylint.
Line: 184
Column: 1
return cls
class ABC(metaclass=ABCMeta):
"""Helper class that provides a standard way to create an ABC using
inheritance.
"""
__slots__ = ()
Reported by Pylint.
Lib/idlelib/idle_test/test_filelist.py
9 issues
Line: 19
Column: 13
@classmethod
def tearDownClass(cls):
cls.root.update_idletasks()
for id in cls.root.tk.call('after', 'info'):
cls.root.after_cancel(id)
cls.root.destroy()
del cls.root
def test_new_empty(self):
Reported by Pylint.
Line: 29
Column: 9
self.assertEqual(flist.root, self.root)
e = flist.new()
self.assertEqual(type(e), flist.EditorWindow)
e._close()
if __name__ == '__main__':
unittest.main(verbosity=2)
Reported by Pylint.
Line: 4
Column: 1
"Test filelist, coverage 19%."
from idlelib import filelist
import unittest
from test.support import requires
from tkinter import Tk
class FileListTest(unittest.TestCase):
Reported by Pylint.
Line: 5
Column: 1
from idlelib import filelist
import unittest
from test.support import requires
from tkinter import Tk
class FileListTest(unittest.TestCase):
@classmethod
Reported by Pylint.
Line: 6
Column: 1
from idlelib import filelist
import unittest
from test.support import requires
from tkinter import Tk
class FileListTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
Reported by Pylint.
Line: 8
Column: 1
from test.support import requires
from tkinter import Tk
class FileListTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
requires('gui')
cls.root = Tk()
Reported by Pylint.
Line: 19
Column: 13
@classmethod
def tearDownClass(cls):
cls.root.update_idletasks()
for id in cls.root.tk.call('after', 'info'):
cls.root.after_cancel(id)
cls.root.destroy()
del cls.root
def test_new_empty(self):
Reported by Pylint.
Line: 24
Column: 5
cls.root.destroy()
del cls.root
def test_new_empty(self):
flist = filelist.FileList(self.root)
self.assertEqual(flist.root, self.root)
e = flist.new()
self.assertEqual(type(e), flist.EditorWindow)
e._close()
Reported by Pylint.
Line: 27
Column: 9
def test_new_empty(self):
flist = filelist.FileList(self.root)
self.assertEqual(flist.root, self.root)
e = flist.new()
self.assertEqual(type(e), flist.EditorWindow)
e._close()
if __name__ == '__main__':
Reported by Pylint.
Lib/chunk.py
9 issues
Line: 51
Column: 1
default is 1, i.e. aligned.
"""
class Chunk:
def __init__(self, file, align=True, bigendian=True, inclheader=False):
import struct
self.closed = False
self.align = align # whether to align to word (2-byte) boundaries
if bigendian:
Reported by Pylint.
Line: 51
Column: 1
default is 1, i.e. aligned.
"""
class Chunk:
def __init__(self, file, align=True, bigendian=True, inclheader=False):
import struct
self.closed = False
self.align = align # whether to align to word (2-byte) boundaries
if bigendian:
Reported by Pylint.
Line: 53
Column: 9
class Chunk:
def __init__(self, file, align=True, bigendian=True, inclheader=False):
import struct
self.closed = False
self.align = align # whether to align to word (2-byte) boundaries
if bigendian:
strflag = '>'
else:
Reported by Pylint.
Line: 86
Column: 5
"""Return the size of the current chunk."""
return self.chunksize
def close(self):
if not self.closed:
try:
self.skip()
finally:
self.closed = True
Reported by Pylint.
Line: 93
Column: 5
finally:
self.closed = True
def isatty(self):
if self.closed:
raise ValueError("I/O operation on closed file")
return False
def seek(self, pos, whence=0):
Reported by Pylint.
Line: 117
Column: 5
self.file.seek(self.offset + pos, 0)
self.size_read = pos
def tell(self):
if self.closed:
raise ValueError("I/O operation on closed file")
return self.size_read
def read(self, size=-1):
Reported by Pylint.
Line: 156
Column: 17
raise ValueError("I/O operation on closed file")
if self.seekable:
try:
n = self.chunksize - self.size_read
# maybe fix alignment
if self.align and (self.chunksize & 1):
n = n + 1
self.file.seek(n, 1)
self.size_read = self.size_read + n
Reported by Pylint.
Line: 159
Column: 21
n = self.chunksize - self.size_read
# maybe fix alignment
if self.align and (self.chunksize & 1):
n = n + 1
self.file.seek(n, 1)
self.size_read = self.size_read + n
return
except OSError:
pass
Reported by Pylint.
Line: 166
Column: 13
except OSError:
pass
while self.size_read < self.chunksize:
n = min(8192, self.chunksize - self.size_read)
dummy = self.read(n)
if not dummy:
raise EOFError
Reported by Pylint.
Lib/lib2to3/fixes/fix_throw.py
9 issues
Line: 11
Column: 1
# Author: Collin Winter
# Local imports
from .. import pytree
from ..pgen2 import token
from .. import fixer_base
from ..fixer_util import Name, Call, ArgList, Attr, is_tuple
class FixThrow(fixer_base.BaseFix):
Reported by Pylint.
Line: 12
Column: 1
# Local imports
from .. import pytree
from ..pgen2 import token
from .. import fixer_base
from ..fixer_util import Name, Call, ArgList, Attr, is_tuple
class FixThrow(fixer_base.BaseFix):
BM_compatible = True
Reported by Pylint.
Line: 13
Column: 1
# Local imports
from .. import pytree
from ..pgen2 import token
from .. import fixer_base
from ..fixer_util import Name, Call, ArgList, Attr, is_tuple
class FixThrow(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
Reported by Pylint.
Line: 14
Column: 1
from .. import pytree
from ..pgen2 import token
from .. import fixer_base
from ..fixer_util import Name, Call, ArgList, Attr, is_tuple
class FixThrow(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
power< any trailer< '.' 'throw' >
Reported by Pylint.
Line: 16
Column: 1
from .. import fixer_base
from ..fixer_util import Name, Call, ArgList, Attr, is_tuple
class FixThrow(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
power< any trailer< '.' 'throw' >
trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' >
>
Reported by Pylint.
Line: 16
Column: 1
from .. import fixer_base
from ..fixer_util import Name, Call, ArgList, Attr, is_tuple
class FixThrow(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
power< any trailer< '.' 'throw' >
trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' >
>
Reported by Pylint.
Line: 26
Column: 5
power< any trailer< '.' 'throw' > trailer< '(' exc=any ')' > >
"""
def transform(self, node, results):
syms = self.syms
exc = results["exc"].clone()
if exc.type is token.STRING:
self.cannot_convert(node, "Python 3 does not support string exceptions")
Reported by Pylint.
Line: 49
Column: 13
throw_args = results["args"]
if "tb" in results:
tb = results["tb"].clone()
tb.prefix = ""
e = Call(exc, args)
with_tb = Attr(e, Name('with_traceback')) + [ArgList([tb])]
throw_args.replace(pytree.Node(syms.power, with_tb))
Reported by Pylint.
Line: 52
Column: 13
tb = results["tb"].clone()
tb.prefix = ""
e = Call(exc, args)
with_tb = Attr(e, Name('with_traceback')) + [ArgList([tb])]
throw_args.replace(pytree.Node(syms.power, with_tb))
else:
throw_args.replace(Call(exc, args))
Reported by Pylint.
Lib/idlelib/idle_test/test_help.py
9 issues
Line: 3
Column: 1
"Test help, coverage 87%."
from idlelib import help
import unittest
from test.support import requires
requires('gui')
from os.path import abspath, dirname, join
from tkinter import Tk
Reported by Pylint.
Line: 4
Column: 1
"Test help, coverage 87%."
from idlelib import help
import unittest
from test.support import requires
requires('gui')
from os.path import abspath, dirname, join
from tkinter import Tk
Reported by Pylint.
Line: 5
Column: 1
from idlelib import help
import unittest
from test.support import requires
requires('gui')
from os.path import abspath, dirname, join
from tkinter import Tk
Reported by Pylint.
Line: 7
Column: 1
import unittest
from test.support import requires
requires('gui')
from os.path import abspath, dirname, join
from tkinter import Tk
class HelpFrameTest(unittest.TestCase):
Reported by Pylint.
Line: 7
Column: 1
import unittest
from test.support import requires
requires('gui')
from os.path import abspath, dirname, join
from tkinter import Tk
class HelpFrameTest(unittest.TestCase):
Reported by Pylint.
Line: 8
Column: 1
from test.support import requires
requires('gui')
from os.path import abspath, dirname, join
from tkinter import Tk
class HelpFrameTest(unittest.TestCase):
@classmethod
Reported by Pylint.
Line: 8
Column: 1
from test.support import requires
requires('gui')
from os.path import abspath, dirname, join
from tkinter import Tk
class HelpFrameTest(unittest.TestCase):
@classmethod
Reported by Pylint.
Line: 11
Column: 1
from tkinter import Tk
class HelpFrameTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
"By itself, this tests that file parsed without exception."
cls.root = root = Tk()
Reported by Pylint.
Line: 28
Column: 5
cls.root.destroy()
del cls.root
def test_line1(self):
text = self.frame.text
self.assertEqual(text.get('1.0', '1.end'), ' IDLE ')
if __name__ == '__main__':
Reported by Pylint.
Lib/idlelib/dynoption.py
9 issues
Line: 14
Column: 3
unlike OptionMenu, our kwargs can include highlightthickness
"""
def __init__(self, master, variable, value, *values, **kwargs):
# TODO copy value instead of whole dict
kwargsCopy=copy.copy(kwargs)
if 'highlightthickness' in list(kwargs.keys()):
del(kwargs['highlightthickness'])
OptionMenu.__init__(self, master, variable, value, *values, **kwargs)
self.config(highlightthickness=kwargsCopy.get('highlightthickness'))
Reported by Pylint.
Line: 9
Column: 1
from tkinter import OptionMenu, _setit, StringVar, Button
class DynOptionMenu(OptionMenu):
"""
unlike OptionMenu, our kwargs can include highlightthickness
"""
def __init__(self, master, variable, value, *values, **kwargs):
# TODO copy value instead of whole dict
Reported by Pylint.
Line: 15
Column: 9
"""
def __init__(self, master, variable, value, *values, **kwargs):
# TODO copy value instead of whole dict
kwargsCopy=copy.copy(kwargs)
if 'highlightthickness' in list(kwargs.keys()):
del(kwargs['highlightthickness'])
OptionMenu.__init__(self, master, variable, value, *values, **kwargs)
self.config(highlightthickness=kwargsCopy.get('highlightthickness'))
#self.menu=self['menu']
Reported by Pylint.
Line: 17
Column: 1
# TODO copy value instead of whole dict
kwargsCopy=copy.copy(kwargs)
if 'highlightthickness' in list(kwargs.keys()):
del(kwargs['highlightthickness'])
OptionMenu.__init__(self, master, variable, value, *values, **kwargs)
self.config(highlightthickness=kwargsCopy.get('highlightthickness'))
#self.menu=self['menu']
self.variable=variable
self.command=kwargs.get('command')
Reported by Pylint.
Line: 24
Column: 5
self.variable=variable
self.command=kwargs.get('command')
def SetMenu(self,valueList,value=None):
"""
clear and reload the menu with a new set of options.
valueList - list of new options
value - initial value to set the optionmenu's menubutton to
"""
Reported by Pylint.
Line: 24
Column: 5
self.variable=variable
self.command=kwargs.get('command')
def SetMenu(self,valueList,value=None):
"""
clear and reload the menu with a new set of options.
valueList - list of new options
value - initial value to set the optionmenu's menubutton to
"""
Reported by Pylint.
Line: 38
Column: 5
self.variable.set(value)
def _dyn_option_menu(parent): # htest #
from tkinter import Toplevel # + StringVar, Button
top = Toplevel(parent)
top.title("Tets dynamic option menu")
x, y = map(int, parent.geometry().split('+')[1:])
top.geometry("200x100+%d+%d" % (x + 250, y + 175))
Reported by Pylint.
Line: 42
Column: 5
top = Toplevel(parent)
top.title("Tets dynamic option menu")
x, y = map(int, parent.geometry().split('+')[1:])
top.geometry("200x100+%d+%d" % (x + 250, y + 175))
top.focus_set()
var = StringVar(top)
var.set("Old option set") #Set the default value
Reported by Pylint.
Line: 42
Column: 8
top = Toplevel(parent)
top.title("Tets dynamic option menu")
x, y = map(int, parent.geometry().split('+')[1:])
top.geometry("200x100+%d+%d" % (x + 250, y + 175))
top.focus_set()
var = StringVar(top)
var.set("Old option set") #Set the default value
Reported by Pylint.
Lib/lib2to3/fixes/fix_input.py
9 issues
Line: 5
Column: 1
# Author: Andre Roberge
# Local imports
from .. import fixer_base
from ..fixer_util import Call, Name
from .. import patcomp
context = patcomp.compile_pattern("power< 'eval' trailer< '(' any ')' > >")
Reported by Pylint.
Line: 6
Column: 1
# Local imports
from .. import fixer_base
from ..fixer_util import Call, Name
from .. import patcomp
context = patcomp.compile_pattern("power< 'eval' trailer< '(' any ')' > >")
Reported by Pylint.
Line: 7
Column: 1
# Local imports
from .. import fixer_base
from ..fixer_util import Call, Name
from .. import patcomp
context = patcomp.compile_pattern("power< 'eval' trailer< '(' any ')' > >")
Reported by Pylint.
Line: 19
Column: 31
power< 'input' args=trailer< '(' [any] ')' > >
"""
def transform(self, node, results):
# If we're already wrapped in an eval() call, we're done.
if context.match(node.parent.parent):
return
new = node.clone()
Reported by Pylint.
Line: 13
Column: 1
context = patcomp.compile_pattern("power< 'eval' trailer< '(' any ')' > >")
class FixInput(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
power< 'input' args=trailer< '(' [any] ')' > >
"""
Reported by Pylint.
Line: 13
Column: 1
context = patcomp.compile_pattern("power< 'eval' trailer< '(' any ')' > >")
class FixInput(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
power< 'input' args=trailer< '(' [any] ')' > >
"""
Reported by Pylint.
Line: 19
Column: 5
power< 'input' args=trailer< '(' [any] ')' > >
"""
def transform(self, node, results):
# If we're already wrapped in an eval() call, we're done.
if context.match(node.parent.parent):
return
new = node.clone()
Reported by Pylint.
Line: 19
Column: 5
power< 'input' args=trailer< '(' [any] ')' > >
"""
def transform(self, node, results):
# If we're already wrapped in an eval() call, we're done.
if context.match(node.parent.parent):
return
new = node.clone()
Reported by Pylint.
Line: 19
Column: 5
power< 'input' args=trailer< '(' [any] ')' > >
"""
def transform(self, node, results):
# If we're already wrapped in an eval() call, we're done.
if context.match(node.parent.parent):
return
new = node.clone()
Reported by Pylint.