The following issues were found
Lib/test/test_pkg.py
66 issues
Line: 97
Column: 9
def test_1(self):
hier = [("t1", None), ("t1 __init__.py", "")]
self.mkhier(hier)
import t1
def test_2(self):
hier = [
("t2", None),
("t2 __init__.py", "'doc for t2'"),
Reported by Pylint.
Line: 110
Column: 9
]
self.mkhier(hier)
import t2.sub
import t2.sub.subsub
self.assertEqual(t2.__name__, "t2")
self.assertEqual(t2.sub.__name__, "t2.sub")
self.assertEqual(t2.sub.subsub.__name__, "t2.sub.subsub")
Reported by Pylint.
Line: 111
Column: 9
self.mkhier(hier)
import t2.sub
import t2.sub.subsub
self.assertEqual(t2.__name__, "t2")
self.assertEqual(t2.sub.__name__, "t2.sub")
self.assertEqual(t2.sub.subsub.__name__, "t2.sub.subsub")
# This exec crap is needed because Py3k forbids 'import *' outside
Reported by Pylint.
Line: 125
Column: 9
"""
self.run_code(s)
from t2 import sub
from t2.sub import subsub
from t2.sub.subsub import spam
self.assertEqual(sub.__name__, "t2.sub")
self.assertEqual(subsub.__name__, "t2.sub.subsub")
self.assertEqual(sub.subsub.__name__, "t2.sub.subsub")
Reported by Pylint.
Line: 126
Column: 9
self.run_code(s)
from t2 import sub
from t2.sub import subsub
from t2.sub.subsub import spam
self.assertEqual(sub.__name__, "t2.sub")
self.assertEqual(subsub.__name__, "t2.sub.subsub")
self.assertEqual(sub.subsub.__name__, "t2.sub.subsub")
for name in ['spam', 'sub', 'subsub', 't2']:
Reported by Pylint.
Line: 127
Column: 9
from t2 import sub
from t2.sub import subsub
from t2.sub.subsub import spam
self.assertEqual(sub.__name__, "t2.sub")
self.assertEqual(subsub.__name__, "t2.sub.subsub")
self.assertEqual(sub.subsub.__name__, "t2.sub.subsub")
for name in ['spam', 'sub', 'subsub', 't2']:
self.assertTrue(locals()["name"], "Failed to import %s" % name)
Reported by Pylint.
Line: 134
Column: 9
for name in ['spam', 'sub', 'subsub', 't2']:
self.assertTrue(locals()["name"], "Failed to import %s" % name)
import t2.sub
import t2.sub.subsub
self.assertEqual(t2.__name__, "t2")
self.assertEqual(t2.sub.__name__, "t2.sub")
self.assertEqual(t2.sub.subsub.__name__, "t2.sub.subsub")
Reported by Pylint.
Line: 135
Column: 9
self.assertTrue(locals()["name"], "Failed to import %s" % name)
import t2.sub
import t2.sub.subsub
self.assertEqual(t2.__name__, "t2")
self.assertEqual(t2.sub.__name__, "t2.sub")
self.assertEqual(t2.sub.subsub.__name__, "t2.sub.subsub")
s = """
Reported by Pylint.
Line: 157
Column: 9
]
self.mkhier(hier)
import t3.sub.subsub
self.assertEqual(t3.__name__, "t3")
self.assertEqual(t3.sub.__name__, "t3.sub")
self.assertEqual(t3.sub.subsub.__name__, "t3.sub.subsub")
def test_4(self):
Reported by Pylint.
Line: 193
Column: 9
]
self.mkhier(hier)
import t5
s = """
from t5 import *
self.assertEqual(dir(), ['foo', 'self', 'string', 't5'])
"""
self.run_code(s)
Reported by Pylint.
Lib/test/test_sched.py
66 issues
Line: 45
Column: 15
def test_enter(self):
l = []
fun = lambda x: l.append(x)
scheduler = sched.scheduler(time.time, time.sleep)
for x in [0.5, 0.4, 0.3, 0.2, 0.1]:
z = scheduler.enter(x, 1, fun, (x,))
scheduler.run()
self.assertEqual(l, [0.1, 0.2, 0.3, 0.4, 0.5])
Reported by Pylint.
Line: 48
Column: 13
fun = lambda x: l.append(x)
scheduler = sched.scheduler(time.time, time.sleep)
for x in [0.5, 0.4, 0.3, 0.2, 0.1]:
z = scheduler.enter(x, 1, fun, (x,))
scheduler.run()
self.assertEqual(l, [0.1, 0.2, 0.3, 0.4, 0.5])
def test_enterabs(self):
l = []
Reported by Pylint.
Line: 54
Column: 15
def test_enterabs(self):
l = []
fun = lambda x: l.append(x)
scheduler = sched.scheduler(time.time, time.sleep)
for x in [0.05, 0.04, 0.03, 0.02, 0.01]:
z = scheduler.enterabs(x, 1, fun, (x,))
scheduler.run()
self.assertEqual(l, [0.01, 0.02, 0.03, 0.04, 0.05])
Reported by Pylint.
Line: 57
Column: 13
fun = lambda x: l.append(x)
scheduler = sched.scheduler(time.time, time.sleep)
for x in [0.05, 0.04, 0.03, 0.02, 0.01]:
z = scheduler.enterabs(x, 1, fun, (x,))
scheduler.run()
self.assertEqual(l, [0.01, 0.02, 0.03, 0.04, 0.05])
def test_enter_concurrent(self):
q = queue.Queue()
Reported by Pylint.
Line: 74
Column: 13
self.assertEqual(q.get(timeout=TIMEOUT), 1)
self.assertTrue(q.empty())
for x in [4, 5, 2]:
z = scheduler.enter(x - 1, 1, fun, (x,))
timer.advance(2)
self.assertEqual(q.get(timeout=TIMEOUT), 2)
self.assertEqual(q.get(timeout=TIMEOUT), 3)
self.assertTrue(q.empty())
timer.advance(1)
Reported by Pylint.
Line: 92
Column: 15
def test_priority(self):
l = []
fun = lambda x: l.append(x)
scheduler = sched.scheduler(time.time, time.sleep)
for priority in [1, 2, 3, 4, 5]:
z = scheduler.enterabs(0.01, priority, fun, (priority,))
scheduler.run()
self.assertEqual(l, [1, 2, 3, 4, 5])
Reported by Pylint.
Line: 95
Column: 13
fun = lambda x: l.append(x)
scheduler = sched.scheduler(time.time, time.sleep)
for priority in [1, 2, 3, 4, 5]:
z = scheduler.enterabs(0.01, priority, fun, (priority,))
scheduler.run()
self.assertEqual(l, [1, 2, 3, 4, 5])
def test_cancel(self):
l = []
Reported by Pylint.
Line: 101
Column: 15
def test_cancel(self):
l = []
fun = lambda x: l.append(x)
scheduler = sched.scheduler(time.time, time.sleep)
now = time.time()
event1 = scheduler.enterabs(now + 0.01, 1, fun, (0.01,))
event2 = scheduler.enterabs(now + 0.02, 1, fun, (0.02,))
event3 = scheduler.enterabs(now + 0.03, 1, fun, (0.03,))
Reported by Pylint.
Line: 105
Column: 9
scheduler = sched.scheduler(time.time, time.sleep)
now = time.time()
event1 = scheduler.enterabs(now + 0.01, 1, fun, (0.01,))
event2 = scheduler.enterabs(now + 0.02, 1, fun, (0.02,))
event3 = scheduler.enterabs(now + 0.03, 1, fun, (0.03,))
event4 = scheduler.enterabs(now + 0.04, 1, fun, (0.04,))
event5 = scheduler.enterabs(now + 0.05, 1, fun, (0.05,))
scheduler.cancel(event1)
scheduler.cancel(event5)
Reported by Pylint.
Line: 106
Column: 9
now = time.time()
event1 = scheduler.enterabs(now + 0.01, 1, fun, (0.01,))
event2 = scheduler.enterabs(now + 0.02, 1, fun, (0.02,))
event3 = scheduler.enterabs(now + 0.03, 1, fun, (0.03,))
event4 = scheduler.enterabs(now + 0.04, 1, fun, (0.04,))
event5 = scheduler.enterabs(now + 0.05, 1, fun, (0.05,))
scheduler.cancel(event1)
scheduler.cancel(event5)
scheduler.run()
Reported by Pylint.
Lib/test/test_unicodedata.py
66 issues
Line: 25
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b303-md5
@requires_resource('cpu')
def test_method_checksum(self):
h = hashlib.sha1()
for i in range(sys.maxunicode + 1):
char = chr(i)
data = [
# Predicates (single char)
"01"[char.isalnum()],
Reported by Bandit.
Line: 79
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b303-md5
@requires_resource('cpu')
def test_function_checksum(self):
data = []
h = hashlib.sha1()
for i in range(sys.maxunicode + 1):
char = chr(i)
data = [
# Properties
Reported by Bandit.
Line: 280
Column: 9
self.assertEqual(self.db.lookup("GOTHIC LETTER FAIHU"), '\U00010346')
def test_ucd_510(self):
import unicodedata
# In UCD 5.1.0, a mirrored property changed wrt. UCD 3.2.0
self.assertTrue(unicodedata.mirrored("\u0f3a"))
self.assertTrue(not unicodedata.ucd_3_2_0.mirrored("\u0f3a"))
# Also, we now have two ways of representing
# the upper-case mapping: as delta, or as absolute value
Reported by Pylint.
Line: 280
Column: 9
self.assertEqual(self.db.lookup("GOTHIC LETTER FAIHU"), '\U00010346')
def test_ucd_510(self):
import unicodedata
# In UCD 5.1.0, a mirrored property changed wrt. UCD 3.2.0
self.assertTrue(unicodedata.mirrored("\u0f3a"))
self.assertTrue(not unicodedata.ucd_3_2_0.mirrored("\u0f3a"))
# Also, we now have two ways of representing
# the upper-case mapping: as delta, or as absolute value
Reported by Pylint.
Line: 351
Column: 17
part = None
part1_data = {}
def NFC(str):
return unicodedata.normalize("NFC", str)
def NFKC(str):
return unicodedata.normalize("NFKC", str)
Reported by Pylint.
Line: 354
Column: 18
def NFC(str):
return unicodedata.normalize("NFC", str)
def NFKC(str):
return unicodedata.normalize("NFKC", str)
def NFD(str):
return unicodedata.normalize("NFD", str)
Reported by Pylint.
Line: 357
Column: 17
def NFKC(str):
return unicodedata.normalize("NFKC", str)
def NFD(str):
return unicodedata.normalize("NFD", str)
def NFKD(str):
return unicodedata.normalize("NFKD", str)
Reported by Pylint.
Line: 360
Column: 18
def NFD(str):
return unicodedata.normalize("NFD", str)
def NFKD(str):
return unicodedata.normalize("NFKD", str)
for line in testdata:
if '#' in line:
line = line.split('#')[0]
Reported by Pylint.
Line: 18
Column: 1
cpython_only, check_disallow_instantiation)
class UnicodeMethodsTest(unittest.TestCase):
# update this, if the database changes
expectedchecksum = 'fbdf8106a3c7c242086b0a9efa03ad4d30d5b85d'
@requires_resource('cpu')
Reported by Pylint.
Line: 24
Column: 5
expectedchecksum = 'fbdf8106a3c7c242086b0a9efa03ad4d30d5b85d'
@requires_resource('cpu')
def test_method_checksum(self):
h = hashlib.sha1()
for i in range(sys.maxunicode + 1):
char = chr(i)
data = [
# Predicates (single char)
Reported by Pylint.
Tools/pynche/ListViewer.py
65 issues
Line: 18
Column: 1
given name, without selecting the color.
"""
from tkinter import *
import ColorDB
ADDTOVIEW = 'Color %List Window...'
class ListViewer:
Reported by Pylint.
Line: 19
Column: 1
"""
from tkinter import *
import ColorDB
ADDTOVIEW = 'Color %List Window...'
class ListViewer:
def __init__(self, switchboard, master=None):
Reported by Pylint.
Line: 30
Column: 30
self.__lastbox = None
self.__dontcenter = 0
# GUI
root = self.__root = Toplevel(master, class_='Pynche')
root.protocol('WM_DELETE_WINDOW', self.withdraw)
root.title('Pynche Color List')
root.iconname('Pynche Color List')
root.bind('<Alt-q>', self.__quit)
root.bind('<Alt-Q>', self.__quit)
Reported by Pylint.
Line: 41
Column: 32
#
# create the canvas which holds everything, and its scrollbar
#
frame = self.__frame = Frame(root)
frame.pack()
canvas = self.__canvas = Canvas(frame, width=160, height=300,
borderwidth=2, relief=SUNKEN)
self.__scrollbar = Scrollbar(frame)
self.__scrollbar.pack(fill=Y, side=RIGHT)
Reported by Pylint.
Line: 43
Column: 34
#
frame = self.__frame = Frame(root)
frame.pack()
canvas = self.__canvas = Canvas(frame, width=160, height=300,
borderwidth=2, relief=SUNKEN)
self.__scrollbar = Scrollbar(frame)
self.__scrollbar.pack(fill=Y, side=RIGHT)
canvas.pack(fill=BOTH, expand=1)
canvas.configure(yscrollcommand=(self.__scrollbar, 'set'))
Reported by Pylint.
Line: 44
Column: 63
frame = self.__frame = Frame(root)
frame.pack()
canvas = self.__canvas = Canvas(frame, width=160, height=300,
borderwidth=2, relief=SUNKEN)
self.__scrollbar = Scrollbar(frame)
self.__scrollbar.pack(fill=Y, side=RIGHT)
canvas.pack(fill=BOTH, expand=1)
canvas.configure(yscrollcommand=(self.__scrollbar, 'set'))
self.__scrollbar.configure(command=(canvas, 'yview'))
Reported by Pylint.
Line: 45
Column: 28
frame.pack()
canvas = self.__canvas = Canvas(frame, width=160, height=300,
borderwidth=2, relief=SUNKEN)
self.__scrollbar = Scrollbar(frame)
self.__scrollbar.pack(fill=Y, side=RIGHT)
canvas.pack(fill=BOTH, expand=1)
canvas.configure(yscrollcommand=(self.__scrollbar, 'set'))
self.__scrollbar.configure(command=(canvas, 'yview'))
self.__populate()
Reported by Pylint.
Line: 46
Column: 44
canvas = self.__canvas = Canvas(frame, width=160, height=300,
borderwidth=2, relief=SUNKEN)
self.__scrollbar = Scrollbar(frame)
self.__scrollbar.pack(fill=Y, side=RIGHT)
canvas.pack(fill=BOTH, expand=1)
canvas.configure(yscrollcommand=(self.__scrollbar, 'set'))
self.__scrollbar.configure(command=(canvas, 'yview'))
self.__populate()
#
Reported by Pylint.
Line: 46
Column: 36
canvas = self.__canvas = Canvas(frame, width=160, height=300,
borderwidth=2, relief=SUNKEN)
self.__scrollbar = Scrollbar(frame)
self.__scrollbar.pack(fill=Y, side=RIGHT)
canvas.pack(fill=BOTH, expand=1)
canvas.configure(yscrollcommand=(self.__scrollbar, 'set'))
self.__scrollbar.configure(command=(canvas, 'yview'))
self.__populate()
#
Reported by Pylint.
Line: 47
Column: 26
borderwidth=2, relief=SUNKEN)
self.__scrollbar = Scrollbar(frame)
self.__scrollbar.pack(fill=Y, side=RIGHT)
canvas.pack(fill=BOTH, expand=1)
canvas.configure(yscrollcommand=(self.__scrollbar, 'set'))
self.__scrollbar.configure(command=(canvas, 'yview'))
self.__populate()
#
# Update on click
Reported by Pylint.
Lib/distutils/command/build_py.py
65 issues
Line: 165
Column: 28
del path[-1]
else:
tail.insert(0, pdir)
return os.path.join(*tail)
else:
# Oops, got all the way through 'path' without finding a
# match in package_dir. If package_dir defines a directory
# for the root (nameless) package, then fallback on it;
# otherwise, we might as well have not consulted
Reported by Pylint.
Line: 179
Column: 28
tail.insert(0, pdir)
if tail:
return os.path.join(*tail)
else:
return ''
def check_package(self, package, package_dir):
# Empty dir name means current directory, which we can probably
Reported by Pylint.
Line: 381
Column: 12
from distutils.util import byte_compile
prefix = self.build_lib
if prefix[-1] != os.sep:
prefix = prefix + os.sep
# XXX this code is essentially the same as the 'byte_compile()
# method of the "install_lib" command, except for the determination
# of the 'prefix' string. Hmmm.
Reported by Pylint.
Line: 11
Column: 1
import glob
from distutils.core import Command
from distutils.errors import *
from distutils.util import convert_path, Mixin2to3
from distutils import log
class build_py (Command):
Reported by Pylint.
Line: 11
Column: 1
import glob
from distutils.core import Command
from distutils.errors import *
from distutils.util import convert_path, Mixin2to3
from distutils import log
class build_py (Command):
Reported by Pylint.
Line: 11
Column: 1
import glob
from distutils.core import Command
from distutils.errors import *
from distutils.util import convert_path, Mixin2to3
from distutils import log
class build_py (Command):
Reported by Pylint.
Line: 11
Column: 1
import glob
from distutils.core import Command
from distutils.errors import *
from distutils.util import convert_path, Mixin2to3
from distutils import log
class build_py (Command):
Reported by Pylint.
Line: 11
Column: 1
import glob
from distutils.core import Command
from distutils.errors import *
from distutils.util import convert_path, Mixin2to3
from distutils import log
class build_py (Command):
Reported by Pylint.
Line: 11
Column: 1
import glob
from distutils.core import Command
from distutils.errors import *
from distutils.util import convert_path, Mixin2to3
from distutils import log
class build_py (Command):
Reported by Pylint.
Line: 11
Column: 1
import glob
from distutils.core import Command
from distutils.errors import *
from distutils.util import convert_path, Mixin2to3
from distutils import log
class build_py (Command):
Reported by Pylint.
Lib/idlelib/undo.py
65 issues
Line: 40
Column: 26
self.bind("<<redo>>", self.redo_event)
self.bind("<<dump-undo-state>>", self.dump_event)
def dump_event(self, event):
from pprint import pprint
pprint(self.undolist[:self.pointer])
print("pointer:", self.pointer, end=' ')
print("saved:", self.saved, end=' ')
print("can_merge:", self.can_merge, end=' ')
Reported by Pylint.
Line: 59
Column: 13
def set_saved(self, flag):
if flag:
self.saved = self.pointer
else:
self.saved = -1
self.can_merge = False
self.check_saved()
Reported by Pylint.
Line: 61
Column: 13
if flag:
self.saved = self.pointer
else:
self.saved = -1
self.can_merge = False
self.check_saved()
def get_saved(self):
return self.saved == self.pointer
Reported by Pylint.
Line: 62
Column: 9
self.saved = self.pointer
else:
self.saved = -1
self.can_merge = False
self.check_saved()
def get_saved(self):
return self.saved == self.pointer
Reported by Pylint.
Line: 101
Column: 13
def undo_block_start(self):
if self.undoblock == 0:
self.undoblock = CommandSequence()
self.undoblock.bump_depth()
def undo_block_stop(self):
if self.undoblock.bump_depth(-1) == 0:
cmd = self.undoblock
Reported by Pylint.
Line: 107
Column: 13
def undo_block_stop(self):
if self.undoblock.bump_depth(-1) == 0:
cmd = self.undoblock
self.undoblock = 0
if len(cmd) > 0:
if len(cmd) == 1:
# no need to wrap a single cmd
cmd = cmd.getcmd(0)
# this blk of cmds, or single cmd, has already
Reported by Pylint.
Line: 128
Column: 13
return
self.undolist[self.pointer:] = [cmd]
if self.saved > self.pointer:
self.saved = -1
self.pointer = self.pointer + 1
if len(self.undolist) > self.max_undo:
##print "truncating undo list"
del self.undolist[0]
self.pointer = self.pointer - 1
Reported by Pylint.
Line: 129
Column: 9
self.undolist[self.pointer:] = [cmd]
if self.saved > self.pointer:
self.saved = -1
self.pointer = self.pointer + 1
if len(self.undolist) > self.max_undo:
##print "truncating undo list"
del self.undolist[0]
self.pointer = self.pointer - 1
if self.saved >= 0:
Reported by Pylint.
Line: 133
Column: 13
if len(self.undolist) > self.max_undo:
##print "truncating undo list"
del self.undolist[0]
self.pointer = self.pointer - 1
if self.saved >= 0:
self.saved = self.saved - 1
self.can_merge = True
self.check_saved()
Reported by Pylint.
Line: 135
Column: 17
del self.undolist[0]
self.pointer = self.pointer - 1
if self.saved >= 0:
self.saved = self.saved - 1
self.can_merge = True
self.check_saved()
def undo_event(self, event):
if self.pointer == 0:
Reported by Pylint.
Lib/test/mock_socket.py
65 issues
Line: 15
Column: 5
# *before* the socket object is even created. It is intended to handle a single
# line which the socket will feed on recv() or makefile().
def reply_with(line):
global _reply_data
_reply_data = line
class MockFile:
"""Mock file object returned by MockSocket.makefile().
Reported by Pylint.
Line: 39
Column: 9
"""Mock socket object used by smtpd and smtplib tests.
"""
def __init__(self, family=None):
global _reply_data
self.family = family
self.output = []
self.lines = []
if _reply_data:
self.lines.append(_reply_data)
Reported by Pylint.
Line: 52
Column: 29
def queue_recv(self, line):
self.lines.append(line)
def recv(self, bufsize, flags=None):
data = self.lines.pop(0) + b'\r\n'
return data
def fileno(self):
return 0
Reported by Pylint.
Line: 52
Column: 20
def queue_recv(self, line):
self.lines.append(line)
def recv(self, bufsize, flags=None):
data = self.lines.pop(0) + b'\r\n'
return data
def fileno(self):
return 0
Reported by Pylint.
Line: 71
Column: 26
def setsockopt(self, level, optname, value):
pass
def getsockopt(self, level, optname, buflen=None):
return 0
def bind(self, address):
pass
Reported by Pylint.
Line: 71
Column: 42
def setsockopt(self, level, optname, value):
pass
def getsockopt(self, level, optname, buflen=None):
return 0
def bind(self, address):
pass
Reported by Pylint.
Line: 71
Column: 33
def setsockopt(self, level, optname, value):
pass
def getsockopt(self, level, optname, buflen=None):
return 0
def bind(self, address):
pass
Reported by Pylint.
Line: 82
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b104_hardcoded_bind_all_interfaces.html
return self.conn, 'c'
def getsockname(self):
return ('0.0.0.0', 0)
def setblocking(self, flag):
pass
def listen(self, backlog):
Reported by Bandit.
Line: 90
Column: 24
def listen(self, backlog):
pass
def makefile(self, mode='r', bufsize=-1):
handle = MockFile(self.lines)
return handle
def sendall(self, data, flags=None):
self.last = data
Reported by Pylint.
Line: 90
Column: 34
def listen(self, backlog):
pass
def makefile(self, mode='r', bufsize=-1):
handle = MockFile(self.lines)
return handle
def sendall(self, data, flags=None):
self.last = data
Reported by Pylint.
Lib/test/test_asynchat.py
65 issues
Line: 3
Column: 1
# test asynchat
from test import support
from test.support import socket_helper
from test.support import threading_helper
import errno
import socket
import sys
Reported by Pylint.
Line: 42
Column: 15
def run(self):
self.sock.listen()
self.event.set()
conn, client = self.sock.accept()
self.buffer = b""
# collect data until quit message is seen
while SERVER_QUIT not in self.buffer:
data = conn.recv(1)
if not data:
Reported by Pylint.
Line: 43
Column: 9
self.sock.listen()
self.event.set()
conn, client = self.sock.accept()
self.buffer = b""
# collect data until quit message is seen
while SERVER_QUIT not in self.buffer:
data = conn.recv(1)
if not data:
break
Reported by Pylint.
Line: 49
Column: 13
data = conn.recv(1)
if not data:
break
self.buffer = self.buffer + data
# remove the SERVER_QUIT message
self.buffer = self.buffer.replace(SERVER_QUIT, b'')
if self.start_resend_event:
Reported by Pylint.
Line: 52
Column: 9
self.buffer = self.buffer + data
# remove the SERVER_QUIT message
self.buffer = self.buffer.replace(SERVER_QUIT, b'')
if self.start_resend_event:
self.start_resend_event.wait()
# re-send entire set of collected data
Reported by Pylint.
Line: 64
Column: 17
while self.buffer:
n = conn.send(self.buffer[:self.chunk_size])
time.sleep(0.001)
self.buffer = self.buffer[n:]
except:
pass
conn.close()
self.sock.close()
Reported by Pylint.
Line: 65
Column: 9
n = conn.send(self.buffer[:self.chunk_size])
time.sleep(0.001)
self.buffer = self.buffer[n:]
except:
pass
conn.close()
self.sock.close()
Reported by Pylint.
Line: 155
Column: 12
def numeric_terminator_check(self, termlen):
# Try reading a fixed number of bytes
s, event = start_echo_server()
c = echo_client(termlen, s.port)
data = b"hello world, I'm not dead yet!\n"
c.push(data)
c.push(SERVER_QUIT)
asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01)
Reported by Pylint.
Line: 175
Column: 12
def test_none_terminator(self):
# Try reading a fixed number of bytes
s, event = start_echo_server()
c = echo_client(None, s.port)
data = b"hello world, I'm not dead yet!\n"
c.push(data)
c.push(SERVER_QUIT)
asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01)
Reported by Pylint.
Line: 187
Column: 12
self.assertEqual(c.buffer, data)
def test_simple_producer(self):
s, event = start_echo_server()
c = echo_client(b'\n', s.port)
data = b"hello world\nI'm not dead yet!\n"
p = asynchat.simple_producer(data+SERVER_QUIT, buffer_size=8)
c.push_with_producer(p)
asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01)
Reported by Pylint.
Lib/tkinter/test/test_tkinter/test_variables.py
65 issues
Line: 1
Column: 1
import unittest
import gc
import tkinter
from tkinter import (Variable, StringVar, IntVar, DoubleVar, BooleanVar, Tcl,
TclError)
from test.support import ALWAYS_EQ
from tkinter.test.support import AbstractDefaultRootTest
Reported by Pylint.
Line: 7
Column: 1
from tkinter import (Variable, StringVar, IntVar, DoubleVar, BooleanVar, Tcl,
TclError)
from test.support import ALWAYS_EQ
from tkinter.test.support import AbstractDefaultRootTest
class Var(Variable):
_default = "default"
Reported by Pylint.
Line: 10
Column: 1
from tkinter.test.support import AbstractDefaultRootTest
class Var(Variable):
_default = "default"
side_effect = False
def set(self, value):
Reported by Pylint.
Line: 20
Column: 1
super().set(value)
class TestBase(unittest.TestCase):
def setUp(self):
self.root = Tcl()
def tearDown(self):
Reported by Pylint.
Line: 29
Column: 1
del self.root
class TestVariable(TestBase):
def info_exists(self, *args):
return self.root.getboolean(self.root.call("info", "exists", *args))
def test_default(self):
Reported by Pylint.
Line: 31
Column: 5
class TestVariable(TestBase):
def info_exists(self, *args):
return self.root.getboolean(self.root.call("info", "exists", *args))
def test_default(self):
v = Variable(self.root)
self.assertEqual("", v.get())
Reported by Pylint.
Line: 34
Column: 5
def info_exists(self, *args):
return self.root.getboolean(self.root.call("info", "exists", *args))
def test_default(self):
v = Variable(self.root)
self.assertEqual("", v.get())
self.assertRegex(str(v), r"^PY_VAR(\d+)$")
def test_name_and_value(self):
Reported by Pylint.
Line: 35
Column: 9
return self.root.getboolean(self.root.call("info", "exists", *args))
def test_default(self):
v = Variable(self.root)
self.assertEqual("", v.get())
self.assertRegex(str(v), r"^PY_VAR(\d+)$")
def test_name_and_value(self):
v = Variable(self.root, "sample string", "varname")
Reported by Pylint.
Line: 39
Column: 5
self.assertEqual("", v.get())
self.assertRegex(str(v), r"^PY_VAR(\d+)$")
def test_name_and_value(self):
v = Variable(self.root, "sample string", "varname")
self.assertEqual("sample string", v.get())
self.assertEqual("varname", str(v))
def test___del__(self):
Reported by Pylint.
Line: 40
Column: 9
self.assertRegex(str(v), r"^PY_VAR(\d+)$")
def test_name_and_value(self):
v = Variable(self.root, "sample string", "varname")
self.assertEqual("sample string", v.get())
self.assertEqual("varname", str(v))
def test___del__(self):
self.assertFalse(self.info_exists("varname"))
Reported by Pylint.
Lib/colorsys.py
65 issues
Line: 148
Column: 3
def hsv_to_rgb(h, s, v):
if s == 0.0:
return v, v, v
i = int(h*6.0) # XXX assume int() truncates!
f = (h*6.0) - i
p = v*(1.0 - s)
q = v*(1.0 - s*f)
t = v*(1.0 - s*(1.0-f))
i = i%6
Reported by Pylint.
Line: 40
Column: 1
# There are a great many versions of the constants used in these formulae.
# The ones in this library uses constants from the FCC version of NTSC.
def rgb_to_yiq(r, g, b):
y = 0.30*r + 0.59*g + 0.11*b
i = 0.74*(r-y) - 0.27*(b-y)
q = 0.48*(r-y) + 0.41*(b-y)
return (y, i, q)
Reported by Pylint.
Line: 40
Column: 1
# There are a great many versions of the constants used in these formulae.
# The ones in this library uses constants from the FCC version of NTSC.
def rgb_to_yiq(r, g, b):
y = 0.30*r + 0.59*g + 0.11*b
i = 0.74*(r-y) - 0.27*(b-y)
q = 0.48*(r-y) + 0.41*(b-y)
return (y, i, q)
Reported by Pylint.
Line: 40
Column: 1
# There are a great many versions of the constants used in these formulae.
# The ones in this library uses constants from the FCC version of NTSC.
def rgb_to_yiq(r, g, b):
y = 0.30*r + 0.59*g + 0.11*b
i = 0.74*(r-y) - 0.27*(b-y)
q = 0.48*(r-y) + 0.41*(b-y)
return (y, i, q)
Reported by Pylint.
Line: 40
Column: 1
# There are a great many versions of the constants used in these formulae.
# The ones in this library uses constants from the FCC version of NTSC.
def rgb_to_yiq(r, g, b):
y = 0.30*r + 0.59*g + 0.11*b
i = 0.74*(r-y) - 0.27*(b-y)
q = 0.48*(r-y) + 0.41*(b-y)
return (y, i, q)
Reported by Pylint.
Line: 41
Column: 5
# The ones in this library uses constants from the FCC version of NTSC.
def rgb_to_yiq(r, g, b):
y = 0.30*r + 0.59*g + 0.11*b
i = 0.74*(r-y) - 0.27*(b-y)
q = 0.48*(r-y) + 0.41*(b-y)
return (y, i, q)
def yiq_to_rgb(y, i, q):
Reported by Pylint.
Line: 43
Column: 5
def rgb_to_yiq(r, g, b):
y = 0.30*r + 0.59*g + 0.11*b
i = 0.74*(r-y) - 0.27*(b-y)
q = 0.48*(r-y) + 0.41*(b-y)
return (y, i, q)
def yiq_to_rgb(y, i, q):
# r = y + (0.27*q + 0.41*i) / (0.74*0.41 + 0.27*0.48)
# b = y + (0.74*q - 0.48*i) / (0.74*0.41 + 0.27*0.48)
Reported by Pylint.
Line: 46
Column: 1
q = 0.48*(r-y) + 0.41*(b-y)
return (y, i, q)
def yiq_to_rgb(y, i, q):
# r = y + (0.27*q + 0.41*i) / (0.74*0.41 + 0.27*0.48)
# b = y + (0.74*q - 0.48*i) / (0.74*0.41 + 0.27*0.48)
# g = y - (0.30*(r-y) + 0.11*(b-y)) / 0.59
r = y + 0.9468822170900693*i + 0.6235565819861433*q
Reported by Pylint.
Line: 46
Column: 1
q = 0.48*(r-y) + 0.41*(b-y)
return (y, i, q)
def yiq_to_rgb(y, i, q):
# r = y + (0.27*q + 0.41*i) / (0.74*0.41 + 0.27*0.48)
# b = y + (0.74*q - 0.48*i) / (0.74*0.41 + 0.27*0.48)
# g = y - (0.30*(r-y) + 0.11*(b-y)) / 0.59
r = y + 0.9468822170900693*i + 0.6235565819861433*q
Reported by Pylint.
Line: 46
Column: 1
q = 0.48*(r-y) + 0.41*(b-y)
return (y, i, q)
def yiq_to_rgb(y, i, q):
# r = y + (0.27*q + 0.41*i) / (0.74*0.41 + 0.27*0.48)
# b = y + (0.74*q - 0.48*i) / (0.74*0.41 + 0.27*0.48)
# g = y - (0.30*(r-y) + 0.11*(b-y)) / 0.59
r = y + 0.9468822170900693*i + 0.6235565819861433*q
Reported by Pylint.