The following issues were found
Lib/idlelib/idle_test/test_pyshell.py
22 issues
Line: 64
Column: 14
class PyShellRemoveLastNewlineAndSurroundingWhitespaceTest(unittest.TestCase):
regexp = pyshell.PyShell._last_newline_re
def all_removed(self, text):
self.assertEqual('', self.regexp.sub('', text))
def none_removed(self, text):
Reported by Pylint.
Line: 5
Column: 1
# Plus coverage of test_warning. Was 20% with test_openshell.
from idlelib import pyshell
import unittest
from test.support import requires
from tkinter import Tk
class FunctionTest(unittest.TestCase):
Reported by Pylint.
Line: 6
Column: 1
from idlelib import pyshell
import unittest
from test.support import requires
from tkinter import Tk
class FunctionTest(unittest.TestCase):
# Test stand-alone module level non-gui functions.
Reported by Pylint.
Line: 7
Column: 1
from idlelib import pyshell
import unittest
from test.support import requires
from tkinter import Tk
class FunctionTest(unittest.TestCase):
# Test stand-alone module level non-gui functions.
Reported by Pylint.
Line: 10
Column: 1
from tkinter import Tk
class FunctionTest(unittest.TestCase):
# Test stand-alone module level non-gui functions.
def test_restart_line_wide(self):
eq = self.assertEqual
for file, mul, extra in (('', 22, ''), ('finame', 21, '=')):
Reported by Pylint.
Line: 13
Column: 5
class FunctionTest(unittest.TestCase):
# Test stand-alone module level non-gui functions.
def test_restart_line_wide(self):
eq = self.assertEqual
for file, mul, extra in (('', 22, ''), ('finame', 21, '=')):
width = 60
bar = mul * '='
with self.subTest(file=file, bar=bar):
Reported by Pylint.
Line: 14
Column: 9
# Test stand-alone module level non-gui functions.
def test_restart_line_wide(self):
eq = self.assertEqual
for file, mul, extra in (('', 22, ''), ('finame', 21, '=')):
width = 60
bar = mul * '='
with self.subTest(file=file, bar=bar):
file = file or 'Shell'
Reported by Pylint.
Line: 17
Column: 13
eq = self.assertEqual
for file, mul, extra in (('', 22, ''), ('finame', 21, '=')):
width = 60
bar = mul * '='
with self.subTest(file=file, bar=bar):
file = file or 'Shell'
line = pyshell.restart_line(width, file)
eq(len(line), width)
eq(line, f"{bar+extra} RESTART: {file} {bar}")
Reported by Pylint.
Line: 24
Column: 5
eq(len(line), width)
eq(line, f"{bar+extra} RESTART: {file} {bar}")
def test_restart_line_narrow(self):
expect, taglen = "= RESTART: Shell", 16
for width in (taglen-1, taglen, taglen+1):
with self.subTest(width=width):
self.assertEqual(pyshell.restart_line(width, ''), expect)
self.assertEqual(pyshell.restart_line(taglen+2, ''), expect+' =')
Reported by Pylint.
Line: 32
Column: 1
self.assertEqual(pyshell.restart_line(taglen+2, ''), expect+' =')
class PyShellFileListTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
requires('gui')
cls.root = Tk()
Reported by Pylint.
Lib/idlelib/idle_test/test_outwin.py
22 issues
Line: 4
Column: 1
"Test outwin, coverage 76%."
from idlelib import outwin
import unittest
from test.support import requires
from tkinter import Tk, Text
from idlelib.idle_test.mock_tk import Mbox_func
from idlelib.idle_test.mock_idle import Func
from unittest import mock
Reported by Pylint.
Line: 5
Column: 1
from idlelib import outwin
import unittest
from test.support import requires
from tkinter import Tk, Text
from idlelib.idle_test.mock_tk import Mbox_func
from idlelib.idle_test.mock_idle import Func
from unittest import mock
Reported by Pylint.
Line: 6
Column: 1
from idlelib import outwin
import unittest
from test.support import requires
from tkinter import Tk, Text
from idlelib.idle_test.mock_tk import Mbox_func
from idlelib.idle_test.mock_idle import Func
from unittest import mock
Reported by Pylint.
Line: 9
Column: 1
from tkinter import Tk, Text
from idlelib.idle_test.mock_tk import Mbox_func
from idlelib.idle_test.mock_idle import Func
from unittest import mock
class OutputWindowTest(unittest.TestCase):
@classmethod
Reported by Pylint.
Line: 12
Column: 1
from unittest import mock
class OutputWindowTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
requires('gui')
root = cls.root = Tk()
Reported by Pylint.
Line: 19
Column: 9
requires('gui')
root = cls.root = Tk()
root.withdraw()
w = cls.window = outwin.OutputWindow(None, None, None, root)
cls.text = w.text = Text(root)
@classmethod
def tearDownClass(cls):
cls.window.close()
Reported by Pylint.
Line: 32
Column: 5
def setUp(self):
self.text.delete('1.0', 'end')
def test_ispythonsource(self):
# OutputWindow overrides ispythonsource to always return False.
w = self.window
self.assertFalse(w.ispythonsource('test.txt'))
self.assertFalse(w.ispythonsource(__file__))
Reported by Pylint.
Line: 34
Column: 9
def test_ispythonsource(self):
# OutputWindow overrides ispythonsource to always return False.
w = self.window
self.assertFalse(w.ispythonsource('test.txt'))
self.assertFalse(w.ispythonsource(__file__))
def test_window_title(self):
self.assertEqual(self.window.top.title(), 'Output')
Reported by Pylint.
Line: 38
Column: 5
self.assertFalse(w.ispythonsource('test.txt'))
self.assertFalse(w.ispythonsource(__file__))
def test_window_title(self):
self.assertEqual(self.window.top.title(), 'Output')
def test_maybesave(self):
w = self.window
eq = self.assertEqual
Reported by Pylint.
Line: 41
Column: 5
def test_window_title(self):
self.assertEqual(self.window.top.title(), 'Output')
def test_maybesave(self):
w = self.window
eq = self.assertEqual
w.get_saved = Func()
w.get_saved.result = False
Reported by Pylint.
Lib/distutils/command/build.py
22 issues
Line: 12
Column: 5
def show_compilers():
from distutils.ccompiler import show_compilers
show_compilers()
class build(Command):
Reported by Pylint.
Line: 74
Column: 13
def finalize_options(self):
if self.plat_name is None:
self.plat_name = get_platform()
else:
# plat-name only supported for windows (other platforms are
# supported via ./configure flags, if at all). Avoid misleading
# other platforms.
if os.name != 'nt':
Reported by Pylint.
Line: 96
Column: 13
# 'lib.<plat>' under the base build directory. We only use one of
# them for a given distribution, though --
if self.build_purelib is None:
self.build_purelib = os.path.join(self.build_base, 'lib')
if self.build_platlib is None:
self.build_platlib = os.path.join(self.build_base,
'lib' + plat_specifier)
# 'build_lib' is the actual directory that we will use for this
Reported by Pylint.
Line: 98
Column: 13
if self.build_purelib is None:
self.build_purelib = os.path.join(self.build_base, 'lib')
if self.build_platlib is None:
self.build_platlib = os.path.join(self.build_base,
'lib' + plat_specifier)
# 'build_lib' is the actual directory that we will use for this
# particular module distribution -- if user didn't supply it, pick
# one of 'build_purelib' or 'build_platlib'.
Reported by Pylint.
Line: 106
Column: 17
# one of 'build_purelib' or 'build_platlib'.
if self.build_lib is None:
if self.distribution.ext_modules:
self.build_lib = self.build_platlib
else:
self.build_lib = self.build_purelib
# 'build_temp' -- temporary directory for compiler turds,
# "build/temp.<plat>"
Reported by Pylint.
Line: 108
Column: 17
if self.distribution.ext_modules:
self.build_lib = self.build_platlib
else:
self.build_lib = self.build_purelib
# 'build_temp' -- temporary directory for compiler turds,
# "build/temp.<plat>"
if self.build_temp is None:
self.build_temp = os.path.join(self.build_base,
Reported by Pylint.
Line: 113
Column: 13
# 'build_temp' -- temporary directory for compiler turds,
# "build/temp.<plat>"
if self.build_temp is None:
self.build_temp = os.path.join(self.build_base,
'temp' + plat_specifier)
if self.build_scripts is None:
self.build_scripts = os.path.join(self.build_base,
'scripts-%d.%d' % sys.version_info[:2])
Reported by Pylint.
Line: 116
Column: 13
self.build_temp = os.path.join(self.build_base,
'temp' + plat_specifier)
if self.build_scripts is None:
self.build_scripts = os.path.join(self.build_base,
'scripts-%d.%d' % sys.version_info[:2])
if self.executable is None and sys.executable:
self.executable = os.path.normpath(sys.executable)
Reported by Pylint.
Line: 120
Column: 13
'scripts-%d.%d' % sys.version_info[:2])
if self.executable is None and sys.executable:
self.executable = os.path.normpath(sys.executable)
if isinstance(self.parallel, str):
try:
self.parallel = int(self.parallel)
except ValueError:
Reported by Pylint.
Line: 124
Column: 17
if isinstance(self.parallel, str):
try:
self.parallel = int(self.parallel)
except ValueError:
raise DistutilsOptionError("parallel should be an integer")
def run(self):
# Run all relevant sub-commands. This will be some subset of:
Reported by Pylint.
Lib/idlelib/idle_test/test_debugobj.py
22 issues
Line: 4
Column: 1
"Test debugobj, coverage 40%."
from idlelib import debugobj
import unittest
class ObjectTreeItemTest(unittest.TestCase):
def test_init(self):
Reported by Pylint.
Line: 7
Column: 1
import unittest
class ObjectTreeItemTest(unittest.TestCase):
def test_init(self):
ti = debugobj.ObjectTreeItem('label', 22)
self.assertEqual(ti.labeltext, 'label')
self.assertEqual(ti.object, 22)
Reported by Pylint.
Line: 9
Column: 5
class ObjectTreeItemTest(unittest.TestCase):
def test_init(self):
ti = debugobj.ObjectTreeItem('label', 22)
self.assertEqual(ti.labeltext, 'label')
self.assertEqual(ti.object, 22)
self.assertEqual(ti.setfunction, None)
Reported by Pylint.
Line: 10
Column: 9
class ObjectTreeItemTest(unittest.TestCase):
def test_init(self):
ti = debugobj.ObjectTreeItem('label', 22)
self.assertEqual(ti.labeltext, 'label')
self.assertEqual(ti.object, 22)
self.assertEqual(ti.setfunction, None)
Reported by Pylint.
Line: 16
Column: 1
self.assertEqual(ti.setfunction, None)
class ClassTreeItemTest(unittest.TestCase):
def test_isexpandable(self):
ti = debugobj.ClassTreeItem('label', 0)
self.assertTrue(ti.IsExpandable())
Reported by Pylint.
Line: 18
Column: 5
class ClassTreeItemTest(unittest.TestCase):
def test_isexpandable(self):
ti = debugobj.ClassTreeItem('label', 0)
self.assertTrue(ti.IsExpandable())
class AtomicObjectTreeItemTest(unittest.TestCase):
Reported by Pylint.
Line: 19
Column: 9
class ClassTreeItemTest(unittest.TestCase):
def test_isexpandable(self):
ti = debugobj.ClassTreeItem('label', 0)
self.assertTrue(ti.IsExpandable())
class AtomicObjectTreeItemTest(unittest.TestCase):
Reported by Pylint.
Line: 23
Column: 1
self.assertTrue(ti.IsExpandable())
class AtomicObjectTreeItemTest(unittest.TestCase):
def test_isexpandable(self):
ti = debugobj.AtomicObjectTreeItem('label', 0)
self.assertFalse(ti.IsExpandable())
Reported by Pylint.
Line: 25
Column: 5
class AtomicObjectTreeItemTest(unittest.TestCase):
def test_isexpandable(self):
ti = debugobj.AtomicObjectTreeItem('label', 0)
self.assertFalse(ti.IsExpandable())
class SequenceTreeItemTest(unittest.TestCase):
Reported by Pylint.
Line: 26
Column: 9
class AtomicObjectTreeItemTest(unittest.TestCase):
def test_isexpandable(self):
ti = debugobj.AtomicObjectTreeItem('label', 0)
self.assertFalse(ti.IsExpandable())
class SequenceTreeItemTest(unittest.TestCase):
Reported by Pylint.
Lib/distutils/tests/test_filelist.py
22 issues
Line: 13
Column: 1
from test.support import os_helper
from test.support import captured_stdout, run_unittest
from distutils.tests import support
MANIFEST_IN = """\
include ok
include xo
exclude xo
Reported by Pylint.
Line: 31
Column: 1
"""
def make_local_path(s):
"""Converts '/' in a string to os.sep"""
return s.replace('/', os.sep)
class FileListTestCase(support.LoggingSilencer,
Reported by Pylint.
Line: 36
Column: 1
return s.replace('/', os.sep)
class FileListTestCase(support.LoggingSilencer,
unittest.TestCase):
def assertNoWarnings(self):
self.assertEqual(self.get_logs(WARN), [])
self.clear_logs()
Reported by Pylint.
Line: 39
Column: 5
class FileListTestCase(support.LoggingSilencer,
unittest.TestCase):
def assertNoWarnings(self):
self.assertEqual(self.get_logs(WARN), [])
self.clear_logs()
def assertWarnings(self):
self.assertGreater(len(self.get_logs(WARN)), 0)
Reported by Pylint.
Line: 39
Column: 5
class FileListTestCase(support.LoggingSilencer,
unittest.TestCase):
def assertNoWarnings(self):
self.assertEqual(self.get_logs(WARN), [])
self.clear_logs()
def assertWarnings(self):
self.assertGreater(len(self.get_logs(WARN)), 0)
Reported by Pylint.
Line: 43
Column: 5
self.assertEqual(self.get_logs(WARN), [])
self.clear_logs()
def assertWarnings(self):
self.assertGreater(len(self.get_logs(WARN)), 0)
self.clear_logs()
def test_glob_to_re(self):
sep = os.sep
Reported by Pylint.
Line: 43
Column: 5
self.assertEqual(self.get_logs(WARN), [])
self.clear_logs()
def assertWarnings(self):
self.assertGreater(len(self.get_logs(WARN)), 0)
self.clear_logs()
def test_glob_to_re(self):
sep = os.sep
Reported by Pylint.
Line: 47
Column: 5
self.assertGreater(len(self.get_logs(WARN)), 0)
self.clear_logs()
def test_glob_to_re(self):
sep = os.sep
if os.sep == '\\':
sep = re.escape(os.sep)
for glob, regex in (
Reported by Pylint.
Line: 65
Column: 5
regex = regex % {'sep': sep}
self.assertEqual(glob_to_re(glob), regex)
def test_process_template_line(self):
# testing all MANIFEST.in template patterns
file_list = FileList()
l = make_local_path
# simulated file list
Reported by Pylint.
Line: 68
Column: 9
def test_process_template_line(self):
# testing all MANIFEST.in template patterns
file_list = FileList()
l = make_local_path
# simulated file list
file_list.allfiles = ['foo.tmp', 'ok', 'xo', 'four.txt',
'buildout.cfg',
# filelist does not filter out VCS directories,
Reported by Pylint.
Tools/i18n/makelocalealias.py
22 issues
Line: 25
Column: 5
# Remove mojibake in /usr/share/X11/locale/locale.alias.
# b'\xef\xbf\xbd' == '\ufffd'.encode('utf-8')
lines = [line for line in lines if '\xef\xbf\xbd' not in line]
data = {}
for line in lines:
line = line.strip()
if not line:
continue
if line[:1] == '#':
Reported by Pylint.
Line: 32
Column: 9
continue
if line[:1] == '#':
continue
locale, alias = line.split()
# Fix non-standard locale names, e.g. ks_IN@devanagari.UTF-8
if '@' in alias:
alias_lang, _, alias_mod = alias.partition('@')
if '.' in alias_mod:
alias_mod, _, alias_enc = alias_mod.partition('.')
Reported by Pylint.
Line: 60
Column: 5
with open(filename, encoding='latin1') as f:
lines = list(f)
data = {}
for line in lines:
line = line.strip()
if not line:
continue
if line[:1] == '#':
Reported by Pylint.
Line: 74
Column: 9
continue
alias, alias_encoding = words
# Lower-case locale
locale = alias.lower()
# Normalize encoding, if given
if '.' in locale:
lang, encoding = locale.split('.')[:2]
encoding = encoding.replace('-', '')
encoding = encoding.replace('_', '')
Reported by Pylint.
Line: 83
Column: 17
locale = lang + '.' + encoding
# Add an encoding to alias
alias, _, modifier = alias.partition('@')
alias = _locale._replace_encoding(alias, alias_encoding)
if modifier and not (modifier == 'euro' and alias_encoding == 'ISO-8859-15'):
alias += '@' + modifier
data[locale] = alias
return data
Reported by Pylint.
Line: 89
Column: 12
data[locale] = alias
return data
def pprint(data):
items = sorted(data.items())
for k, v in items:
print(' %-40s%a,' % ('%a:' % k, v))
def print_differences(data, olddata):
Reported by Pylint.
Line: 94
Column: 23
for k, v in items:
print(' %-40s%a,' % ('%a:' % k, v))
def print_differences(data, olddata):
items = sorted(olddata.items())
for k, v in items:
if k not in data:
print('# removed %a' % k)
elif olddata[k] != data[k]:
Reported by Pylint.
Line: 96
Column: 12
def print_differences(data, olddata):
items = sorted(olddata.items())
for k, v in items:
if k not in data:
print('# removed %a' % k)
elif olddata[k] != data[k]:
print('# updated %a -> %a to %a' % \
(k, olddata[k], data[k]))
Reported by Pylint.
Line: 104
Column: 14
(k, olddata[k], data[k]))
# Additions are not mentioned
def optimize(data):
locale_alias = locale.locale_alias
locale.locale_alias = data.copy()
for k, v in data.items():
del locale.locale_alias[k]
if locale.normalize(k) != v:
Reported by Pylint.
Line: 118
Column: 11
sys.exit(1)
return newdata
def check(data):
# Check that all alias definitions from the X11 file
# are actually mapped to the correct alias locales.
errors = 0
for k, v in data.items():
if locale.normalize(k) != v:
Reported by Pylint.
Tools/c-analyzer/c_parser/datafiles.py
22 issues
Line: 56
Column: 27
def write_decls(decls, outfile, fmt=None, *, backup=False):
if fmt is None:
fmt = _get_format(infile)
_, write_all = _get_format_handlers('decls', fmt)
write_all(decls, outfile, backup=backup)
#############################
Reported by Pylint.
Line: 58
Column: 5
if fmt is None:
fmt = _get_format(infile)
_, write_all = _get_format_handlers('decls', fmt)
write_all(decls, outfile, backup=backup)
#############################
# formats
Reported by Pylint.
Line: 58
Column: 5
if fmt is None:
fmt = _get_format(infile)
_, write_all = _get_format_handlers('decls', fmt)
write_all(decls, outfile, backup=backup)
#############################
# formats
Reported by Pylint.
Line: 58
Column: 5
if fmt is None:
fmt = _get_format(infile)
_, write_all = _get_format_handlers('decls', fmt)
write_all(decls, outfile, backup=backup)
#############################
# formats
Reported by Pylint.
Line: 124
Column: 21
columns = _get_columns('decls', extracolumns)
if extracolumns:
def render_decl(decl):
if type(row) is tuple:
decl, *extra = decl
else:
extra = ()
extra += ('???',) * (len(extraColumns) - len(extra))
*row, declaration = _render_known_row(decl)
Reported by Pylint.
Line: 128
Column: 38
decl, *extra = decl
else:
extra = ()
extra += ('???',) * (len(extraColumns) - len(extra))
*row, declaration = _render_known_row(decl)
row += extra + (declaration,)
return row
else:
render_decl = _render_known_decl
Reported by Pylint.
Line: 129
Column: 33
else:
extra = ()
extra += ('???',) * (len(extraColumns) - len(extra))
*row, declaration = _render_known_row(decl)
row += extra + (declaration,)
return row
else:
render_decl = _render_known_decl
_tables.write_table(
Reported by Pylint.
Line: 33
Column: 3
# high-level
def read_parsed(infile):
# XXX Support other formats than TSV?
columns = _get_columns('parsed')
for row in _tables.read_table(infile, columns, sep='\t', fix='-'):
yield _info.ParsedItem.from_row(row, columns)
Reported by Pylint.
Line: 40
Column: 3
def write_parsed(items, outfile):
# XXX Support other formats than TSV?
columns = _get_columns('parsed')
rows = (item.as_row(columns) for item in items)
_tables.write_table(outfile, columns, rows, sep='\t', fix='-')
Reported by Pylint.
Line: 74
Column: 3
def _get_format_handlers(group, fmt):
# XXX Use a registry.
if group != 'decls':
raise NotImplementedError(group)
if fmt == 'tsv':
return (_iter_decls_tsv, _write_decls_tsv)
else:
Reported by Pylint.
Lib/test/test_pwd.py
22 issues
Line: 66
Column: 17
# try to get some errors
bynames = {}
byuids = {}
for (n, p, u, g, gecos, d, s) in pwd.getpwall():
bynames[n] = u
byuids[u] = n
allnames = list(bynames.keys())
namei = 0
Reported by Pylint.
Line: 66
Column: 23
# try to get some errors
bynames = {}
byuids = {}
for (n, p, u, g, gecos, d, s) in pwd.getpwall():
bynames[n] = u
byuids[u] = n
allnames = list(bynames.keys())
namei = 0
Reported by Pylint.
Line: 66
Column: 26
# try to get some errors
bynames = {}
byuids = {}
for (n, p, u, g, gecos, d, s) in pwd.getpwall():
bynames[n] = u
byuids[u] = n
allnames = list(bynames.keys())
namei = 0
Reported by Pylint.
Line: 66
Column: 33
# try to get some errors
bynames = {}
byuids = {}
for (n, p, u, g, gecos, d, s) in pwd.getpwall():
bynames[n] = u
byuids[u] = n
allnames = list(bynames.keys())
namei = 0
Reported by Pylint.
Line: 66
Column: 36
# try to get some errors
bynames = {}
byuids = {}
for (n, p, u, g, gecos, d, s) in pwd.getpwall():
bynames[n] = u
byuids[u] = n
allnames = list(bynames.keys())
namei = 0
Reported by Pylint.
Line: 1
Column: 1
import sys
import unittest
from test.support import import_helper
pwd = import_helper.import_module('pwd')
@unittest.skipUnless(hasattr(pwd, 'getpwall'), 'Does not have getpwall()')
class PwdTest(unittest.TestCase):
Reported by Pylint.
Line: 8
Column: 1
pwd = import_helper.import_module('pwd')
@unittest.skipUnless(hasattr(pwd, 'getpwall'), 'Does not have getpwall()')
class PwdTest(unittest.TestCase):
def test_values(self):
entries = pwd.getpwall()
for e in entries:
Reported by Pylint.
Line: 10
Column: 5
@unittest.skipUnless(hasattr(pwd, 'getpwall'), 'Does not have getpwall()')
class PwdTest(unittest.TestCase):
def test_values(self):
entries = pwd.getpwall()
for e in entries:
self.assertEqual(len(e), 7)
self.assertEqual(e[0], e.pw_name)
Reported by Pylint.
Line: 13
Column: 13
def test_values(self):
entries = pwd.getpwall()
for e in entries:
self.assertEqual(len(e), 7)
self.assertEqual(e[0], e.pw_name)
self.assertIsInstance(e.pw_name, str)
self.assertEqual(e[1], e.pw_passwd)
self.assertIsInstance(e.pw_passwd, str)
Reported by Pylint.
Line: 36
Column: 5
# instead of this collect all entries for one uid
# and check afterwards (done in test_values_extended)
def test_values_extended(self):
entries = pwd.getpwall()
entriesbyname = {}
entriesbyuid = {}
if len(entries) > 1000: # Huge passwd file (NIS?) -- skip this test
Reported by Pylint.
Tools/c-analyzer/c_parser/parser/_info.py
22 issues
Line: 3
Column: 1
import re
from ..info import KIND, ParsedItem, FileInfo
class TextInfo:
def __init__(self, text, start=None, end=None):
# immutable:
Reported by Pylint.
Line: 33
Column: 41
else:
if isinstance(lno, FileInfo):
fileinfo = lno
if fileinfo.filename != self.filename:
raise NotImplementedError((fileinfo, self.filename))
lno = fileinfo.lno
# XXX
#if lno < self.end:
# raise NotImplementedError((lno, self.end))
Reported by Pylint.
Line: 34
Column: 58
if isinstance(lno, FileInfo):
fileinfo = lno
if fileinfo.filename != self.filename:
raise NotImplementedError((fileinfo, self.filename))
lno = fileinfo.lno
# XXX
#if lno < self.end:
# raise NotImplementedError((lno, self.end))
line = line.lstrip()
Reported by Pylint.
Line: 1
Column: 1
import re
from ..info import KIND, ParsedItem, FileInfo
class TextInfo:
def __init__(self, text, start=None, end=None):
# immutable:
Reported by Pylint.
Line: 36
Column: 3
if fileinfo.filename != self.filename:
raise NotImplementedError((fileinfo, self.filename))
lno = fileinfo.lno
# XXX
#if lno < self.end:
# raise NotImplementedError((lno, self.end))
line = line.lstrip()
self.text += ' ' + line
self.line = line
Reported by Pylint.
Line: 56
Column: 9
if isinstance(_current, str):
_current = TextInfo(_current)
self._current = _current
start = -1
self._start = _current.start if _current else -1
self._nested = []
self._set_ready()
def __repr__(self):
Reported by Pylint.
Line: 119
Column: 20
def resolve(self, kind, data, name, parent=None):
# "field" isn't a top-level kind, so we leave it as-is.
if kind and kind != 'field':
kind = KIND._from_raw(kind)
fileinfo = FileInfo(self.filename, self._start)
return ParsedItem(fileinfo, kind, parent, name, data)
def done(self):
self._set_ready()
Reported by Pylint.
Line: 153
Column: 3
def _clear(self, start=None):
old = self._current
if self._current is not None:
# XXX Fail if self._current wasn't used up?
if start is None:
start = self._current.end
self._current = None
if start is not None:
self._start = start
Reported by Pylint.
Line: 178
Column: 3
self._start = lno
self._current = TextInfo(line, lno)
else:
# XXX
#if lno < self._current.end:
# # A circular include?
# raise NotImplementedError((lno, self))
self._current.add_line(line, lno)
self._ready = True
Reported by Pylint.
Line: 1
Column: 1
import re
from ..info import KIND, ParsedItem, FileInfo
class TextInfo:
def __init__(self, text, start=None, end=None):
# immutable:
Reported by Pylint.
Lib/test/test_ucn.py
22 issues
Line: 230
Column: 31
@support.cpython_only
@unittest.skipUnless(INT_MAX < PY_SSIZE_T_MAX, "needs UINT_MAX < SIZE_MAX")
@support.bigmemtest(size=UINT_MAX + 1, memuse=2 + 1, dry_run=False)
def test_issue16335(self, size):
# very very long bogus character name
x = b'\\N{SPACE' + b'x' * (UINT_MAX + 1) + b'}'
self.assertEqual(len(x), len(b'\\N{SPACE}') + (UINT_MAX + 1))
self.assertRaisesRegex(UnicodeError,
'unknown Unicode character name',
Reported by Pylint.
Line: 22
Column: 1
except ImportError:
INT_MAX = PY_SSIZE_T_MAX = UINT_MAX = 2**64 - 1
class UnicodeNamesTest(unittest.TestCase):
def checkletter(self, name, code):
# Helper that put all \N escapes inside eval'd raw strings,
# to make sure this script runs even if the compiler
# chokes on \N escapes
Reported by Pylint.
Line: 24
Column: 5
class UnicodeNamesTest(unittest.TestCase):
def checkletter(self, name, code):
# Helper that put all \N escapes inside eval'd raw strings,
# to make sure this script runs even if the compiler
# chokes on \N escapes
res = ast.literal_eval(r'"\N{%s}"' % name)
self.assertEqual(res, code)
Reported by Pylint.
Line: 32
Column: 5
self.assertEqual(res, code)
return res
def test_general(self):
# General and case insensitivity test:
chars = [
"LATIN CAPITAL LETTER T",
"LATIN SMALL LETTER H",
"LATIN SMALL LETTER E",
Reported by Pylint.
Line: 69
Column: 5
string
)
def test_ascii_letters(self):
for char in "".join(map(chr, range(ord("a"), ord("z")))):
name = "LATIN SMALL LETTER %s" % char.upper()
code = unicodedata.lookup(name)
self.assertEqual(unicodedata.name(code), name)
Reported by Pylint.
Line: 75
Column: 5
code = unicodedata.lookup(name)
self.assertEqual(unicodedata.name(code), name)
def test_hangul_syllables(self):
self.checkletter("HANGUL SYLLABLE GA", "\uac00")
self.checkletter("HANGUL SYLLABLE GGWEOSS", "\uafe8")
self.checkletter("HANGUL SYLLABLE DOLS", "\ub3d0")
self.checkletter("HANGUL SYLLABLE RYAN", "\ub7b8")
self.checkletter("HANGUL SYLLABLE MWIK", "\ubba0")
Reported by Pylint.
Line: 92
Column: 5
self.assertRaises(ValueError, unicodedata.name, "\ud7a4")
def test_cjk_unified_ideographs(self):
self.checkletter("CJK UNIFIED IDEOGRAPH-3400", "\u3400")
self.checkletter("CJK UNIFIED IDEOGRAPH-4DB5", "\u4db5")
self.checkletter("CJK UNIFIED IDEOGRAPH-4E00", "\u4e00")
self.checkletter("CJK UNIFIED IDEOGRAPH-9FCB", "\u9fCB")
self.checkletter("CJK UNIFIED IDEOGRAPH-20000", "\U00020000")
Reported by Pylint.
Line: 105
Column: 5
self.checkletter("CJK UNIFIED IDEOGRAPH-2B81D", "\U0002B81D")
self.checkletter("CJK UNIFIED IDEOGRAPH-3134A", "\U0003134A")
def test_bmp_characters(self):
for code in range(0x10000):
char = chr(code)
name = unicodedata.name(char, None)
if name is not None:
self.assertEqual(unicodedata.lookup(name), char)
Reported by Pylint.
Line: 112
Column: 5
if name is not None:
self.assertEqual(unicodedata.lookup(name), char)
def test_misc_symbols(self):
self.checkletter("PILCROW SIGN", "\u00b6")
self.checkletter("REPLACEMENT CHARACTER", "\uFFFD")
self.checkletter("HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK", "\uFF9F")
self.checkletter("FULLWIDTH LATIN SMALL LETTER A", "\uFF41")
Reported by Pylint.
Line: 118
Column: 5
self.checkletter("HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK", "\uFF9F")
self.checkletter("FULLWIDTH LATIN SMALL LETTER A", "\uFF41")
def test_aliases(self):
# Check that the aliases defined in the NameAliases.txt file work.
# This should be updated when new aliases are added or the file
# should be downloaded and parsed instead. See #12753.
aliases = [
('LATIN CAPITAL LETTER GHA', 0x01A2),
Reported by Pylint.