The following issues were found
Lib/encodings/hex_codec.py
18 issues
Line: 13
Column: 16
### Codec APIs
def hex_encode(input, errors='strict'):
assert errors == 'strict'
return (binascii.b2a_hex(input), len(input))
def hex_decode(input, errors='strict'):
assert errors == 'strict'
Reported by Pylint.
Line: 17
Column: 16
assert errors == 'strict'
return (binascii.b2a_hex(input), len(input))
def hex_decode(input, errors='strict'):
assert errors == 'strict'
return (binascii.a2b_hex(input), len(input))
class Codec(codecs.Codec):
def encode(self, input, errors='strict'):
Reported by Pylint.
Line: 22
Column: 22
return (binascii.a2b_hex(input), len(input))
class Codec(codecs.Codec):
def encode(self, input, errors='strict'):
return hex_encode(input, errors)
def decode(self, input, errors='strict'):
return hex_decode(input, errors)
class IncrementalEncoder(codecs.IncrementalEncoder):
Reported by Pylint.
Line: 24
Column: 22
class Codec(codecs.Codec):
def encode(self, input, errors='strict'):
return hex_encode(input, errors)
def decode(self, input, errors='strict'):
return hex_decode(input, errors)
class IncrementalEncoder(codecs.IncrementalEncoder):
def encode(self, input, final=False):
assert self.errors == 'strict'
Reported by Pylint.
Line: 28
Column: 22
return hex_decode(input, errors)
class IncrementalEncoder(codecs.IncrementalEncoder):
def encode(self, input, final=False):
assert self.errors == 'strict'
return binascii.b2a_hex(input)
class IncrementalDecoder(codecs.IncrementalDecoder):
def decode(self, input, final=False):
Reported by Pylint.
Line: 33
Column: 22
return binascii.b2a_hex(input)
class IncrementalDecoder(codecs.IncrementalDecoder):
def decode(self, input, final=False):
assert self.errors == 'strict'
return binascii.a2b_hex(input)
class StreamWriter(Codec, codecs.StreamWriter):
charbuffertype = bytes
Reported by Pylint.
Line: 13
Column: 1
### Codec APIs
def hex_encode(input, errors='strict'):
assert errors == 'strict'
return (binascii.b2a_hex(input), len(input))
def hex_decode(input, errors='strict'):
assert errors == 'strict'
Reported by Pylint.
Line: 14
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
### Codec APIs
def hex_encode(input, errors='strict'):
assert errors == 'strict'
return (binascii.b2a_hex(input), len(input))
def hex_decode(input, errors='strict'):
assert errors == 'strict'
return (binascii.a2b_hex(input), len(input))
Reported by Bandit.
Line: 17
Column: 1
assert errors == 'strict'
return (binascii.b2a_hex(input), len(input))
def hex_decode(input, errors='strict'):
assert errors == 'strict'
return (binascii.a2b_hex(input), len(input))
class Codec(codecs.Codec):
def encode(self, input, errors='strict'):
Reported by Pylint.
Line: 18
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
return (binascii.b2a_hex(input), len(input))
def hex_decode(input, errors='strict'):
assert errors == 'strict'
return (binascii.a2b_hex(input), len(input))
class Codec(codecs.Codec):
def encode(self, input, errors='strict'):
return hex_encode(input, errors)
Reported by Bandit.
Lib/encodings/utf_8_sig.py
17 issues
Line: 14
Column: 12
### Codec APIs
def encode(input, errors='strict'):
return (codecs.BOM_UTF8 + codecs.utf_8_encode(input, errors)[0],
len(input))
def decode(input, errors='strict'):
prefix = 0
Reported by Pylint.
Line: 18
Column: 12
return (codecs.BOM_UTF8 + codecs.utf_8_encode(input, errors)[0],
len(input))
def decode(input, errors='strict'):
prefix = 0
if input[:3] == codecs.BOM_UTF8:
input = input[3:]
prefix = 3
(output, consumed) = codecs.utf_8_decode(input, errors, True)
Reported by Pylint.
Line: 31
Column: 22
codecs.IncrementalEncoder.__init__(self, errors)
self.first = 1
def encode(self, input, final=False):
if self.first:
self.first = 0
return codecs.BOM_UTF8 + \
codecs.utf_8_encode(input, self.errors)[0]
else:
Reported by Pylint.
Line: 54
Column: 30
codecs.BufferedIncrementalDecoder.__init__(self, errors)
self.first = 1
def _buffer_decode(self, input, errors, final):
if self.first:
if len(input) < 3:
if codecs.BOM_UTF8.startswith(input):
# not enough data to decide if this really is a BOM
# => try again on the next call
Reported by Pylint.
Line: 85
Column: 1
codecs.BufferedIncrementalDecoder.setstate(self, state)
self.first = state[1]
class StreamWriter(codecs.StreamWriter):
def reset(self):
codecs.StreamWriter.reset(self)
try:
del self.encode
except AttributeError:
Reported by Pylint.
Line: 93
Column: 22
except AttributeError:
pass
def encode(self, input, errors='strict'):
self.encode = codecs.utf_8_encode
return encode(input, errors)
class StreamReader(codecs.StreamReader):
def reset(self):
Reported by Pylint.
Line: 97
Column: 1
self.encode = codecs.utf_8_encode
return encode(input, errors)
class StreamReader(codecs.StreamReader):
def reset(self):
codecs.StreamReader.reset(self)
try:
del self.decode
except AttributeError:
Reported by Pylint.
Line: 105
Column: 22
except AttributeError:
pass
def decode(self, input, errors='strict'):
if len(input) < 3:
if codecs.BOM_UTF8.startswith(input):
# not enough data to decide if this is a BOM
# => try again on the next call
return ("", 0)
Reported by Pylint.
Line: 14
Column: 1
### Codec APIs
def encode(input, errors='strict'):
return (codecs.BOM_UTF8 + codecs.utf_8_encode(input, errors)[0],
len(input))
def decode(input, errors='strict'):
prefix = 0
Reported by Pylint.
Line: 18
Column: 1
return (codecs.BOM_UTF8 + codecs.utf_8_encode(input, errors)[0],
len(input))
def decode(input, errors='strict'):
prefix = 0
if input[:3] == codecs.BOM_UTF8:
input = input[3:]
prefix = 3
(output, consumed) = codecs.utf_8_decode(input, errors, True)
Reported by Pylint.
Lib/idlelib/squeezer.py
17 issues
Line: 138
Column: 22
)
)
def expand(self, event=None):
"""expand event handler
This inserts the original text in place of the button in the Text
widget, removes the button and updates the Squeezer instance.
Reported by Pylint.
Line: 169
Column: 20
self.editwin.on_squeezed_expand(index, self.s, self.tags)
self.squeezer.expandingbuttons.remove(self)
def copy(self, event=None):
"""copy event handler
Copy the original text to the clipboard.
"""
self.clipboard_clear()
Reported by Pylint.
Line: 177
Column: 20
self.clipboard_clear()
self.clipboard_append(self.s)
def view(self, event=None):
"""view event handler
View the original text in a separate text viewer window.
"""
view_text(self.text, "Squeezed Output Viewer", self.s,
Reported by Pylint.
Line: 28
Column: 1
from idlelib import macosx
def count_lines_with_wrapping(s, linewidth=80):
"""Count the number of lines in a given string.
Lines are counted as if the string was wrapped so that lines are never over
linewidth characters long.
Reported by Pylint.
Line: 41
Column: 9
linecount = 1
current_column = 0
for m in re.finditer(r"[\t\n]", s):
# Process the normal chars up to tab or newline.
numchars = m.start() - pos
pos += numchars
current_column += numchars
Reported by Pylint.
Line: 61
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
linecount += 1
current_column = 0
else:
assert s[pos] == '\t'
current_column += tabwidth - (current_column % tabwidth)
# If a tab passes the end of the line, consider the entire
# tab as being on the next line.
if current_column > linewidth:
Reported by Bandit.
Line: 84
Column: 1
return linecount
class ExpandingButton(tk.Button):
"""Class for the "squeezed" text buttons used by Squeezer
These buttons are displayed inside a Tk Text widget in place of text. A
user can then use the button to replace it with the original text, copy
the original text to the clipboard or view the original text in a separate
Reported by Pylint.
Line: 84
Column: 1
return linecount
class ExpandingButton(tk.Button):
"""Class for the "squeezed" text buttons used by Squeezer
These buttons are displayed inside a Tk Text widget in place of text. A
user can then use the button to replace it with the original text, copy
the original text to the clipboard or view the original text in a separate
Reported by Pylint.
Line: 96
Column: 9
Squeezer instance when it is expanded (and therefore removed).
"""
def __init__(self, s, tags, numoflines, squeezer):
self.s = s
self.tags = tags
self.numoflines = numoflines
self.squeezer = squeezer
self.editwin = editwin = squeezer.editwin
self.text = text = editwin.text
Reported by Pylint.
Line: 127
Column: 5
self.is_dangerous = None
self.after_idle(self.set_is_dangerous)
def set_is_dangerous(self):
dangerous_line_len = 50 * self.text.winfo_width()
self.is_dangerous = (
self.numoflines > 1000 or
len(self.s) > 50000 or
any(
Reported by Pylint.
Lib/idlelib/idle_test/test_macosx.py
17 issues
Line: 37
Column: 17
for platform, types in ('darwin', alltypes), ('other', nontypes):
with self.subTest(platform=platform):
macosx.platform = platform
macosx._tk_type == None
macosx._init_tk_type()
self.assertIn(macosx._tk_type, types)
class IsTypeTkTest(unittest.TestCase):
Reported by Pylint.
Line: 37
Column: 17
for platform, types in ('darwin', alltypes), ('other', nontypes):
with self.subTest(platform=platform):
macosx.platform = platform
macosx._tk_type == None
macosx._init_tk_type()
self.assertIn(macosx._tk_type, types)
class IsTypeTkTest(unittest.TestCase):
Reported by Pylint.
Line: 38
Column: 17
with self.subTest(platform=platform):
macosx.platform = platform
macosx._tk_type == None
macosx._init_tk_type()
self.assertIn(macosx._tk_type, types)
class IsTypeTkTest(unittest.TestCase):
"Test each of the four isTypeTk predecates."
Reported by Pylint.
Line: 39
Column: 31
macosx.platform = platform
macosx._tk_type == None
macosx._init_tk_type()
self.assertIn(macosx._tk_type, types)
class IsTypeTkTest(unittest.TestCase):
"Test each of the four isTypeTk predecates."
isfuncs = ((macosx.isAquaTk, ('carbon', 'cocoa')),
Reported by Pylint.
Line: 53
Column: 9
@mock.patch('idlelib.macosx._init_tk_type')
def test_is_calls_init(self, mockinit):
"Test that each isTypeTk calls _init_tk_type when _tk_type is None."
macosx._tk_type = None
for func, whentrue in self.isfuncs:
with self.subTest(func=func):
func()
self.assertTrue(mockinit.called)
mockinit.reset_mock()
Reported by Pylint.
Line: 54
Column: 19
def test_is_calls_init(self, mockinit):
"Test that each isTypeTk calls _init_tk_type when _tk_type is None."
macosx._tk_type = None
for func, whentrue in self.isfuncs:
with self.subTest(func=func):
func()
self.assertTrue(mockinit.called)
mockinit.reset_mock()
Reported by Pylint.
Line: 65
Column: 21
for func, whentrue in self.isfuncs:
for tktype in alltypes:
with self.subTest(func=func, whentrue=whentrue, tktype=tktype):
macosx._tk_type = tktype
(self.assertTrue if tktype in whentrue else self.assertFalse)\
(func())
class SetupTest(unittest.TestCase):
Reported by Pylint.
Line: 96
Column: 17
flist = FileList(root)
for tktype in alltypes:
with self.subTest(tktype=tktype):
macosx._tk_type = tktype
macosx.setupApp(root, flist)
if tktype in ('carbon', 'cocoa'):
self.assertTrue(overrideRootMenu.called)
overrideRootMenu.reset_mock()
Reported by Pylint.
Line: 4
Column: 1
"Test macosx, coverage 45% on Windows."
from idlelib import macosx
import unittest
from test.support import requires
import tkinter as tk
import unittest.mock as mock
from idlelib.filelist import FileList
Reported by Pylint.
Line: 5
Column: 1
from idlelib import macosx
import unittest
from test.support import requires
import tkinter as tk
import unittest.mock as mock
from idlelib.filelist import FileList
mactypes = {'carbon', 'cocoa', 'xquartz'}
Reported by Pylint.
Lib/encodings/utf_32.py
17 issues
Line: 10
Column: 12
encode = codecs.utf_32_encode
def decode(input, errors='strict'):
return codecs.utf_32_decode(input, errors, True)
class IncrementalEncoder(codecs.IncrementalEncoder):
def __init__(self, errors='strict'):
codecs.IncrementalEncoder.__init__(self, errors)
Reported by Pylint.
Line: 18
Column: 22
codecs.IncrementalEncoder.__init__(self, errors)
self.encoder = None
def encode(self, input, final=False):
if self.encoder is None:
result = codecs.utf_32_encode(input, self.errors)[0]
if sys.byteorder == 'little':
self.encoder = codecs.utf_32_le_encode
else:
Reported by Pylint.
Line: 53
Column: 30
codecs.BufferedIncrementalDecoder.__init__(self, errors)
self.decoder = None
def _buffer_decode(self, input, errors, final):
if self.decoder is None:
(output, consumed, byteorder) = \
codecs.utf_32_ex_decode(input, errors, 0, final)
if byteorder == -1:
self.decoder = codecs.utf_32_le_decode
Reported by Pylint.
Line: 99
Column: 1
else:
self.decoder = None
class StreamWriter(codecs.StreamWriter):
def __init__(self, stream, errors='strict'):
self.encoder = None
codecs.StreamWriter.__init__(self, stream, errors)
def reset(self):
Reported by Pylint.
Line: 108
Column: 22
codecs.StreamWriter.reset(self)
self.encoder = None
def encode(self, input, errors='strict'):
if self.encoder is None:
result = codecs.utf_32_encode(input, errors)
if sys.byteorder == 'little':
self.encoder = codecs.utf_32_le_encode
else:
Reported by Pylint.
Line: 119
Column: 1
else:
return self.encoder(input, errors)
class StreamReader(codecs.StreamReader):
def reset(self):
codecs.StreamReader.reset(self)
try:
del self.decode
Reported by Pylint.
Line: 128
Column: 22
except AttributeError:
pass
def decode(self, input, errors='strict'):
(object, consumed, byteorder) = \
codecs.utf_32_ex_decode(input, errors, 0, False)
if byteorder == -1:
self.decode = codecs.utf_32_le_decode
elif byteorder == 1:
Reported by Pylint.
Line: 129
Column: 10
pass
def decode(self, input, errors='strict'):
(object, consumed, byteorder) = \
codecs.utf_32_ex_decode(input, errors, 0, False)
if byteorder == -1:
self.decode = codecs.utf_32_le_decode
elif byteorder == 1:
self.decode = codecs.utf_32_be_decode
Reported by Pylint.
Line: 4
Column: 1
"""
Python 'utf-32' Codec
"""
import codecs, sys
### Codec APIs
encode = codecs.utf_32_encode
Reported by Pylint.
Line: 10
Column: 1
encode = codecs.utf_32_encode
def decode(input, errors='strict'):
return codecs.utf_32_decode(input, errors, True)
class IncrementalEncoder(codecs.IncrementalEncoder):
def __init__(self, errors='strict'):
codecs.IncrementalEncoder.__init__(self, errors)
Reported by Pylint.
Lib/encodings/utf_16.py
17 issues
Line: 15
Column: 12
encode = codecs.utf_16_encode
def decode(input, errors='strict'):
return codecs.utf_16_decode(input, errors, True)
class IncrementalEncoder(codecs.IncrementalEncoder):
def __init__(self, errors='strict'):
codecs.IncrementalEncoder.__init__(self, errors)
Reported by Pylint.
Line: 23
Column: 22
codecs.IncrementalEncoder.__init__(self, errors)
self.encoder = None
def encode(self, input, final=False):
if self.encoder is None:
result = codecs.utf_16_encode(input, self.errors)[0]
if sys.byteorder == 'little':
self.encoder = codecs.utf_16_le_encode
else:
Reported by Pylint.
Line: 58
Column: 30
codecs.BufferedIncrementalDecoder.__init__(self, errors)
self.decoder = None
def _buffer_decode(self, input, errors, final):
if self.decoder is None:
(output, consumed, byteorder) = \
codecs.utf_16_ex_decode(input, errors, 0, final)
if byteorder == -1:
self.decoder = codecs.utf_16_le_decode
Reported by Pylint.
Line: 104
Column: 1
else:
self.decoder = None
class StreamWriter(codecs.StreamWriter):
def __init__(self, stream, errors='strict'):
codecs.StreamWriter.__init__(self, stream, errors)
self.encoder = None
def reset(self):
Reported by Pylint.
Line: 113
Column: 22
codecs.StreamWriter.reset(self)
self.encoder = None
def encode(self, input, errors='strict'):
if self.encoder is None:
result = codecs.utf_16_encode(input, errors)
if sys.byteorder == 'little':
self.encoder = codecs.utf_16_le_encode
else:
Reported by Pylint.
Line: 124
Column: 1
else:
return self.encoder(input, errors)
class StreamReader(codecs.StreamReader):
def reset(self):
codecs.StreamReader.reset(self)
try:
del self.decode
Reported by Pylint.
Line: 133
Column: 22
except AttributeError:
pass
def decode(self, input, errors='strict'):
(object, consumed, byteorder) = \
codecs.utf_16_ex_decode(input, errors, 0, False)
if byteorder == -1:
self.decode = codecs.utf_16_le_decode
elif byteorder == 1:
Reported by Pylint.
Line: 134
Column: 10
pass
def decode(self, input, errors='strict'):
(object, consumed, byteorder) = \
codecs.utf_16_ex_decode(input, errors, 0, False)
if byteorder == -1:
self.decode = codecs.utf_16_le_decode
elif byteorder == 1:
self.decode = codecs.utf_16_be_decode
Reported by Pylint.
Line: 9
Column: 1
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
import codecs, sys
### Codec APIs
encode = codecs.utf_16_encode
Reported by Pylint.
Line: 15
Column: 1
encode = codecs.utf_16_encode
def decode(input, errors='strict'):
return codecs.utf_16_decode(input, errors, True)
class IncrementalEncoder(codecs.IncrementalEncoder):
def __init__(self, errors='strict'):
codecs.IncrementalEncoder.__init__(self, errors)
Reported by Pylint.
Lib/idlelib/pathbrowser.py
17 issues
Line: 11
Column: 5
class PathBrowser(ModuleBrowser):
def __init__(self, master, *, _htest=False, _utest=False):
"""
_htest - bool, change box location when running htest
"""
self.master = master
self._htest = _htest
Reported by Pylint.
Line: 36
Column: 13
def GetSubList(self):
sublist = []
for dir in sys.path:
item = DirBrowserTreeItem(dir)
sublist.append(item)
return sublist
Reported by Pylint.
Line: 44
Column: 5
class DirBrowserTreeItem(TreeItem):
def __init__(self, dir, packages=[]):
self.dir = dir
self.packages = packages
def GetText(self):
if not self.packages:
Reported by Pylint.
Line: 44
Column: 5
class DirBrowserTreeItem(TreeItem):
def __init__(self, dir, packages=[]):
self.dir = dir
self.packages = packages
def GetText(self):
if not self.packages:
Reported by Pylint.
Line: 44
Column: 24
class DirBrowserTreeItem(TreeItem):
def __init__(self, dir, packages=[]):
self.dir = dir
self.packages = packages
def GetText(self):
if not self.packages:
Reported by Pylint.
Line: 87
Column: 9
suffixes = importlib.machinery.EXTENSION_SUFFIXES[:]
suffixes += importlib.machinery.SOURCE_SUFFIXES
suffixes += importlib.machinery.BYTECODE_SUFFIXES
sorted = []
for suff in suffixes:
i = -len(suff)
for name in allnames[:]:
normed_name = os.path.normcase(name)
if normed_name[i:] == suff:
Reported by Pylint.
Line: 1
Column: 1
import importlib.machinery
import os
import sys
from idlelib.browser import ModuleBrowser, ModuleBrowserTreeItem
from idlelib.tree import TreeItem
class PathBrowser(ModuleBrowser):
Reported by Pylint.
Line: 9
Column: 1
from idlelib.tree import TreeItem
class PathBrowser(ModuleBrowser):
def __init__(self, master, *, _htest=False, _utest=False):
"""
_htest - bool, change box location when running htest
"""
Reported by Pylint.
Line: 29
Column: 1
return PathBrowserTreeItem()
class PathBrowserTreeItem(TreeItem):
def GetText(self):
return "sys.path"
def GetSubList(self):
Reported by Pylint.
Line: 42
Column: 1
return sublist
class DirBrowserTreeItem(TreeItem):
def __init__(self, dir, packages=[]):
self.dir = dir
self.packages = packages
Reported by Pylint.
Lib/distutils/tests/test_spawn.py
17 issues
Line: 32
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b103_set_bad_file_permissions.html
exe = os.path.join(tmpdir, 'foo.bat')
self.write_file(exe, 'exit 1')
os.chmod(exe, 0o777)
self.assertRaises(DistutilsExecError, spawn, [exe])
# now something that works
if sys.platform != 'win32':
exe = os.path.join(tmpdir, 'foo.sh')
Reported by Bandit.
Line: 43
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b103_set_bad_file_permissions.html
exe = os.path.join(tmpdir, 'foo.bat')
self.write_file(exe, 'exit 0')
os.chmod(exe, 0o777)
spawn([exe]) # should work without any error
def test_find_executable(self):
with os_helper.temp_dir() as tmp_dir:
# use TESTFN to get a pseudo-unique filename
Reported by Bandit.
Line: 14
Column: 1
from distutils.errors import DistutilsExecError
from distutils.tests import support
class SpawnTestCase(support.TempdirManager,
support.LoggingSilencer,
unittest.TestCase):
@unittest.skipUnless(os.name in ('nt', 'posix'),
'Runs only under posix or nt')
Reported by Pylint.
Line: 20
Column: 5
@unittest.skipUnless(os.name in ('nt', 'posix'),
'Runs only under posix or nt')
def test_spawn(self):
tmpdir = self.mkdtemp()
# creating something executable
# through the shell that returns 1
if sys.platform != 'win32':
Reported by Pylint.
Line: 46
Column: 5
os.chmod(exe, 0o777)
spawn([exe]) # should work without any error
def test_find_executable(self):
with os_helper.temp_dir() as tmp_dir:
# use TESTFN to get a pseudo-unique filename
program_noeext = os_helper.TESTFN
# Give the temporary program an ".exe" suffix for all.
# It's needed on Windows and not harmful on other platforms.
Reported by Pylint.
Line: 60
Column: 13
os.chmod(filename, stat.S_IXUSR)
# test path parameter
rv = find_executable(program, path=tmp_dir)
self.assertEqual(rv, filename)
if sys.platform == 'win32':
# test without ".exe" extension
rv = find_executable(program_noeext, path=tmp_dir)
Reported by Pylint.
Line: 65
Column: 17
if sys.platform == 'win32':
# test without ".exe" extension
rv = find_executable(program_noeext, path=tmp_dir)
self.assertEqual(rv, filename)
# test find in the current directory
with os_helper.change_cwd(tmp_dir):
rv = find_executable(program)
Reported by Pylint.
Line: 70
Column: 17
# test find in the current directory
with os_helper.change_cwd(tmp_dir):
rv = find_executable(program)
self.assertEqual(rv, program)
# test non-existent program
dont_exist_program = "dontexist_" + program
rv = find_executable(dont_exist_program , path=tmp_dir)
Reported by Pylint.
Line: 75
Column: 13
# test non-existent program
dont_exist_program = "dontexist_" + program
rv = find_executable(dont_exist_program , path=tmp_dir)
self.assertIsNone(rv)
# PATH='': no match, except in the current directory
with os_helper.EnvironmentVarGuard() as env:
env['PATH'] = ''
Reported by Pylint.
Line: 85
Column: 21
return_value=tmp_dir, create=True), \
unittest.mock.patch('distutils.spawn.os.defpath',
tmp_dir):
rv = find_executable(program)
self.assertIsNone(rv)
# look in current directory
with os_helper.change_cwd(tmp_dir):
rv = find_executable(program)
Reported by Pylint.
Lib/idlelib/outwin.py
17 issues
Line: 127
Column: 5
"No flushing needed as write() directly writes to widget."
pass
def showerror(self, *args, **kwargs):
messagebox.showerror(*args, **kwargs)
def goto_file_line(self, event=None):
"""Handle request to open file/line.
Reported by Pylint.
Line: 171
Column: 5
self.flist = flist
self.owin = None
def write(self, s, tags, mark):
if not self.owin:
self.setup()
self.owin.write(s, tags, mark)
def setup(self):
Reported by Pylint.
Line: 25
Column: 5
def compile_progs():
"Compile the patterns for matching to file name and line number."
global file_line_progs
file_line_progs = [re.compile(pat, re.IGNORECASE)
for pat in file_line_pats]
def file_line_helper(line):
Reported by Pylint.
Line: 125
Column: 9
def flush(self):
"No flushing needed as write() directly writes to widget."
pass
def showerror(self, *args, **kwargs):
messagebox.showerror(*args, **kwargs)
def goto_file_line(self, event=None):
Reported by Pylint.
Line: 130
Column: 30
def showerror(self, *args, **kwargs):
messagebox.showerror(*args, **kwargs)
def goto_file_line(self, event=None):
"""Handle request to open file/line.
If the selected or previous line in the output window
contains a file name and line number, then open that file
name in a new window and position on the line number.
Reported by Pylint.
Line: 162
Column: 3
class OnDemandOutputWindow:
tagdefs = {
# XXX Should use IdlePrefs.ColorPrefs
"stdout": {"foreground": "blue"},
"stderr": {"foreground": "#007700"},
}
def __init__(self, flist):
Reported by Pylint.
Line: 20
Column: 1
r'^\s*(\S.*?):\s*(\d+):', # Win abs path with embedded spaces, ltrim
]
file_line_progs = None
def compile_progs():
"Compile the patterns for matching to file name and line number."
global file_line_progs
Reported by Pylint.
Line: 25
Column: 5
def compile_progs():
"Compile the patterns for matching to file name and line number."
global file_line_progs
file_line_progs = [re.compile(pat, re.IGNORECASE)
for pat in file_line_pats]
def file_line_helper(line):
Reported by Pylint.
Line: 45
Column: 17
if match:
filename, lineno = match.group(1, 2)
try:
f = open(filename, "r")
f.close()
break
except OSError:
continue
else:
Reported by Pylint.
Line: 96
Column: 5
return 'yes' if self.get_saved() else 'no'
# Act as output file
def write(self, s, tags=(), mark="insert"):
"""Write text to text widget.
The text is inserted at the given index with the provided
tags. The text widget is then scrolled to make it visible
and updated to display it, giving the effect of seeing each
Reported by Pylint.
Lib/distutils/tests/test_version.py
17 issues
Line: 37
Column: 23
for v1, v2, wanted in versions:
try:
res = StrictVersion(v1)._cmp(StrictVersion(v2))
except ValueError:
if wanted is ValueError:
continue
else:
raise AssertionError(("cmp(%s, %s) "
Reported by Pylint.
Line: 42
Column: 21
if wanted is ValueError:
continue
else:
raise AssertionError(("cmp(%s, %s) "
"shouldn't raise ValueError")
% (v1, v2))
self.assertEqual(res, wanted,
'cmp(%s, %s) should be %s, got %s' %
(v1, v2, wanted, res))
Reported by Pylint.
Line: 48
Column: 19
self.assertEqual(res, wanted,
'cmp(%s, %s) should be %s, got %s' %
(v1, v2, wanted, res))
res = StrictVersion(v1)._cmp(v2)
self.assertEqual(res, wanted,
'cmp(%s, %s) should be %s, got %s' %
(v1, v2, wanted, res))
res = StrictVersion(v1)._cmp(object())
self.assertIs(res, NotImplemented,
Reported by Pylint.
Line: 52
Column: 19
self.assertEqual(res, wanted,
'cmp(%s, %s) should be %s, got %s' %
(v1, v2, wanted, res))
res = StrictVersion(v1)._cmp(object())
self.assertIs(res, NotImplemented,
'cmp(%s, %s) should be NotImplemented, got %s' %
(v1, v2, res))
Reported by Pylint.
Line: 70
Column: 19
for v1, v2, wanted in versions:
res = LooseVersion(v1)._cmp(LooseVersion(v2))
self.assertEqual(res, wanted,
'cmp(%s, %s) should be %s, got %s' %
(v1, v2, wanted, res))
res = LooseVersion(v1)._cmp(v2)
self.assertEqual(res, wanted,
Reported by Pylint.
Line: 74
Column: 19
self.assertEqual(res, wanted,
'cmp(%s, %s) should be %s, got %s' %
(v1, v2, wanted, res))
res = LooseVersion(v1)._cmp(v2)
self.assertEqual(res, wanted,
'cmp(%s, %s) should be %s, got %s' %
(v1, v2, wanted, res))
res = LooseVersion(v1)._cmp(object())
self.assertIs(res, NotImplemented,
Reported by Pylint.
Line: 78
Column: 19
self.assertEqual(res, wanted,
'cmp(%s, %s) should be %s, got %s' %
(v1, v2, wanted, res))
res = LooseVersion(v1)._cmp(object())
self.assertIs(res, NotImplemented,
'cmp(%s, %s) should be NotImplemented, got %s' %
(v1, v2, res))
def test_suite():
Reported by Pylint.
Line: 7
Column: 1
from distutils.version import StrictVersion
from test.support import run_unittest
class VersionTestCase(unittest.TestCase):
def test_prerelease(self):
version = StrictVersion('1.2.3a1')
self.assertEqual(version.version, (1, 2, 3))
self.assertEqual(version.prerelease, ('a', 1))
Reported by Pylint.
Line: 9
Column: 5
class VersionTestCase(unittest.TestCase):
def test_prerelease(self):
version = StrictVersion('1.2.3a1')
self.assertEqual(version.version, (1, 2, 3))
self.assertEqual(version.prerelease, ('a', 1))
self.assertEqual(str(version), '1.2.3a1')
Reported by Pylint.
Line: 18
Column: 5
version = StrictVersion('1.2.0')
self.assertEqual(str(version), '1.2')
def test_cmp_strict(self):
versions = (('1.5.1', '1.5.2b2', -1),
('161', '3.10a', ValueError),
('8.02', '8.02', 0),
('3.4j', '1996.07.12', ValueError),
('3.2.pl0', '3.1.1.6', ValueError),
Reported by Pylint.