The following issues were found
Lib/ctypes/test/test_win32.py
113 issues
Line: 60
Column: 9
sizeof(c_void_p))
def test_COMError(self):
from _ctypes import COMError
if support.HAVE_DOCSTRINGS:
self.assertEqual(COMError.__doc__,
"Raised when a COM method call failed.")
ex = COMError(-1, "text", ("details",))
Reported by Pylint.
Line: 82
Column: 26
e = WinError(ERROR_INVALID_PARAMETER)
self.assertEqual(e.args, args)
self.assertEqual(e.errno, errno.EINVAL)
self.assertEqual(e.winerror, ERROR_INVALID_PARAMETER)
windll.kernel32.SetLastError(ERROR_INVALID_PARAMETER)
try:
raise WinError()
except OSError as exc:
Reported by Pylint.
Line: 91
Column: 26
e = exc
self.assertEqual(e.args, args)
self.assertEqual(e.errno, errno.EINVAL)
self.assertEqual(e.winerror, ERROR_INVALID_PARAMETER)
class Structures(unittest.TestCase):
def test_struct_by_value(self):
class POINT(Structure):
_fields_ = [("x", c_long),
Reported by Pylint.
Line: 3
Column: 1
# Windows specific tests
from ctypes import *
import unittest, sys
from test import support
import _ctypes_test
@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
Reported by Pylint.
Line: 3
Column: 1
# Windows specific tests
from ctypes import *
import unittest, sys
from test import support
import _ctypes_test
@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
Reported by Pylint.
Line: 3
Column: 1
# Windows specific tests
from ctypes import *
import unittest, sys
from test import support
import _ctypes_test
@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
Reported by Pylint.
Line: 3
Column: 1
# Windows specific tests
from ctypes import *
import unittest, sys
from test import support
import _ctypes_test
@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
Reported by Pylint.
Line: 3
Column: 1
# Windows specific tests
from ctypes import *
import unittest, sys
from test import support
import _ctypes_test
@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
Reported by Pylint.
Line: 3
Column: 1
# Windows specific tests
from ctypes import *
import unittest, sys
from test import support
import _ctypes_test
@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
Reported by Pylint.
Line: 3
Column: 1
# Windows specific tests
from ctypes import *
import unittest, sys
from test import support
import _ctypes_test
@unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
Reported by Pylint.
Lib/test/test_opcodes.py
113 issues
Line: 36
Column: 26
def test_default_annotations_exist(self):
class C: pass
self.assertEqual(C.__annotations__, {})
def test_use_existing_annotations(self):
ns = {'__annotations__': {1: 2}}
exec('x: int', ns)
self.assertEqual(ns['__annotations__'], {'x': int, 1: 2})
Reported by Pylint.
Line: 48
Column: 21
with support.swap_item(globals(), '__annotations__', {}):
del globals()['__annotations__']
class C:
del __annotations__
with self.assertRaises(NameError):
x: int
def test_raise_class_exceptions(self):
Reported by Pylint.
Line: 17
Column: 13
except ZeroDivisionError: pass
except TypeError: pass
try: pass
except: pass
try: pass
finally: pass
n = n+i
if n != 90:
self.fail('try inside for')
Reported by Pylint.
Line: 40
Column: 9
def test_use_existing_annotations(self):
ns = {'__annotations__': {1: 2}}
exec('x: int', ns)
self.assertEqual(ns['__annotations__'], {'x': int, 1: 2})
def test_do_not_recreate_annotations(self):
# Don't rely on the existence of the '__annotations__' global.
with support.swap_item(globals(), '__annotations__', {}):
Reported by Pylint.
Line: 40
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html
def test_use_existing_annotations(self):
ns = {'__annotations__': {1: 2}}
exec('x: int', ns)
self.assertEqual(ns['__annotations__'], {'x': int, 1: 2})
def test_do_not_recreate_annotations(self):
# Don't rely on the existence of the '__annotations__' global.
with support.swap_item(globals(), '__annotations__', {}):
Reported by Bandit.
Line: 47
Column: 13
# Don't rely on the existence of the '__annotations__' global.
with support.swap_item(globals(), '__annotations__', {}):
del globals()['__annotations__']
class C:
del __annotations__
with self.assertRaises(NameError):
x: int
def test_raise_class_exceptions(self):
Reported by Pylint.
Line: 58
Column: 13
class BClass(AClass): pass
class CClass(Exception): pass
class DClass(AClass):
def __init__(self, ignore):
pass
try: raise AClass()
except: pass
Reported by Pylint.
Line: 62
Column: 9
pass
try: raise AClass()
except: pass
try: raise AClass()
except AClass: pass
try: raise BClass()
Reported by Pylint.
Line: 72
Column: 9
try: raise BClass()
except CClass: self.fail()
except: pass
a = AClass()
b = BClass()
try:
Reported by Pylint.
Line: 97
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b307-eval
def test_compare_function_objects(self):
f = eval('lambda: None')
g = eval('lambda: None')
self.assertNotEqual(f, g)
f = eval('lambda a: a')
g = eval('lambda a: a')
Reported by Bandit.
Lib/ctypes/test/test_pep3118.py
113 issues
Line: 44
Column: 32
if v.shape:
n = 1
for dim in v.shape:
n = n * dim
self.assertEqual(n * v.itemsize, len(v.tobytes()))
except:
# so that we can see the failing type
print(tp)
Reported by Pylint.
Line: 72
Column: 32
if v.shape:
n = 1
for dim in v.shape:
n = n * dim
self.assertEqual(n, len(v))
except:
# so that we can see the failing type
print(tp)
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
import re, sys
if sys.byteorder == "little":
THIS_ENDIAN = "<"
OTHER_ENDIAN = ">"
else:
THIS_ENDIAN = ">"
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
import re, sys
if sys.byteorder == "little":
THIS_ENDIAN = "<"
OTHER_ENDIAN = ">"
else:
THIS_ENDIAN = ">"
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
import re, sys
if sys.byteorder == "little":
THIS_ENDIAN = "<"
OTHER_ENDIAN = ">"
else:
THIS_ENDIAN = ">"
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
import re, sys
if sys.byteorder == "little":
THIS_ENDIAN = "<"
OTHER_ENDIAN = ">"
else:
THIS_ENDIAN = ">"
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
import re, sys
if sys.byteorder == "little":
THIS_ENDIAN = "<"
OTHER_ENDIAN = ">"
else:
THIS_ENDIAN = ">"
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
import re, sys
if sys.byteorder == "little":
THIS_ENDIAN = "<"
OTHER_ENDIAN = ">"
else:
THIS_ENDIAN = ">"
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
import re, sys
if sys.byteorder == "little":
THIS_ENDIAN = "<"
OTHER_ENDIAN = ">"
else:
THIS_ENDIAN = ">"
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
import re, sys
if sys.byteorder == "little":
THIS_ENDIAN = "<"
OTHER_ENDIAN = ">"
else:
THIS_ENDIAN = ">"
Reported by Pylint.
Lib/test/test_genericalias.py
113 issues
Line: 282
Column: 26
def test_union(self):
a = typing.Union[list[int], list[str]]
self.assertEqual(a.__args__, (list[int], list[str]))
self.assertEqual(a.__parameters__, ())
def test_union_generic(self):
a = typing.Union[list[T], tuple[T, ...]]
self.assertEqual(a.__args__, (list[T], tuple[T, ...]))
self.assertEqual(a.__parameters__, (T,))
Reported by Pylint.
Line: 287
Column: 26
def test_union_generic(self):
a = typing.Union[list[T], tuple[T, ...]]
self.assertEqual(a.__args__, (list[T], tuple[T, ...]))
self.assertEqual(a.__parameters__, (T,))
def test_dir(self):
dir_of_gen_alias = set(dir(list[int]))
self.assertTrue(dir_of_gen_alias.issuperset(dir(list)))
for generic_alias_property in ("__origin__", "__args__", "__parameters__"):
Reported by Pylint.
Line: 8
Column: 1
from collections import (
defaultdict, deque, OrderedDict, Counter, UserDict, UserList
)
from collections.abc import *
from concurrent.futures import Future
from concurrent.futures.thread import _WorkItem
from contextlib import AbstractContextManager, AbstractAsyncContextManager
from contextvars import ContextVar, Token
from dataclasses import Field
Reported by Pylint.
Line: 8
Column: 1
from collections import (
defaultdict, deque, OrderedDict, Counter, UserDict, UserList
)
from collections.abc import *
from concurrent.futures import Future
from concurrent.futures.thread import _WorkItem
from contextlib import AbstractContextManager, AbstractAsyncContextManager
from contextvars import ContextVar, Token
from dataclasses import Field
Reported by Pylint.
Line: 8
Column: 1
from collections import (
defaultdict, deque, OrderedDict, Counter, UserDict, UserList
)
from collections.abc import *
from concurrent.futures import Future
from concurrent.futures.thread import _WorkItem
from contextlib import AbstractContextManager, AbstractAsyncContextManager
from contextvars import ContextVar, Token
from dataclasses import Field
Reported by Pylint.
Line: 8
Column: 1
from collections import (
defaultdict, deque, OrderedDict, Counter, UserDict, UserList
)
from collections.abc import *
from concurrent.futures import Future
from concurrent.futures.thread import _WorkItem
from contextlib import AbstractContextManager, AbstractAsyncContextManager
from contextvars import ContextVar, Token
from dataclasses import Field
Reported by Pylint.
Line: 8
Column: 1
from collections import (
defaultdict, deque, OrderedDict, Counter, UserDict, UserList
)
from collections.abc import *
from concurrent.futures import Future
from concurrent.futures.thread import _WorkItem
from contextlib import AbstractContextManager, AbstractAsyncContextManager
from contextvars import ContextVar, Token
from dataclasses import Field
Reported by Pylint.
Line: 8
Column: 1
from collections import (
defaultdict, deque, OrderedDict, Counter, UserDict, UserList
)
from collections.abc import *
from concurrent.futures import Future
from concurrent.futures.thread import _WorkItem
from contextlib import AbstractContextManager, AbstractAsyncContextManager
from contextvars import ContextVar, Token
from dataclasses import Field
Reported by Pylint.
Line: 8
Column: 1
from collections import (
defaultdict, deque, OrderedDict, Counter, UserDict, UserList
)
from collections.abc import *
from concurrent.futures import Future
from concurrent.futures.thread import _WorkItem
from contextlib import AbstractContextManager, AbstractAsyncContextManager
from contextvars import ContextVar, Token
from dataclasses import Field
Reported by Pylint.
Line: 8
Column: 1
from collections import (
defaultdict, deque, OrderedDict, Counter, UserDict, UserList
)
from collections.abc import *
from concurrent.futures import Future
from concurrent.futures.thread import _WorkItem
from contextlib import AbstractContextManager, AbstractAsyncContextManager
from contextvars import ContextVar, Token
from dataclasses import Field
Reported by Pylint.
Lib/ctypes/test/test_pointers.py
112 issues
Line: 3
Column: 1
import unittest, sys
from ctypes import *
import _ctypes_test
ctype_types = [c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint,
c_long, c_ulong, c_longlong, c_ulonglong, c_double, c_float]
python_types = [int, int, int, int, int, int,
int, int, int, int, float, float]
Reported by Pylint.
Line: 3
Column: 1
import unittest, sys
from ctypes import *
import _ctypes_test
ctype_types = [c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint,
c_long, c_ulong, c_longlong, c_ulonglong, c_double, c_float]
python_types = [int, int, int, int, int, int,
int, int, int, int, float, float]
Reported by Pylint.
Line: 3
Column: 1
import unittest, sys
from ctypes import *
import _ctypes_test
ctype_types = [c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint,
c_long, c_ulong, c_longlong, c_ulonglong, c_double, c_float]
python_types = [int, int, int, int, int, int,
int, int, int, int, float, float]
Reported by Pylint.
Line: 3
Column: 1
import unittest, sys
from ctypes import *
import _ctypes_test
ctype_types = [c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint,
c_long, c_ulong, c_longlong, c_ulonglong, c_double, c_float]
python_types = [int, int, int, int, int, int,
int, int, int, int, float, float]
Reported by Pylint.
Line: 3
Column: 1
import unittest, sys
from ctypes import *
import _ctypes_test
ctype_types = [c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint,
c_long, c_ulong, c_longlong, c_ulonglong, c_double, c_float]
python_types = [int, int, int, int, int, int,
int, int, int, int, float, float]
Reported by Pylint.
Line: 3
Column: 1
import unittest, sys
from ctypes import *
import _ctypes_test
ctype_types = [c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint,
c_long, c_ulong, c_longlong, c_ulonglong, c_double, c_float]
python_types = [int, int, int, int, int, int,
int, int, int, int, float, float]
Reported by Pylint.
Line: 3
Column: 1
import unittest, sys
from ctypes import *
import _ctypes_test
ctype_types = [c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint,
c_long, c_ulong, c_longlong, c_ulonglong, c_double, c_float]
python_types = [int, int, int, int, int, int,
int, int, int, int, float, float]
Reported by Pylint.
Line: 3
Column: 1
import unittest, sys
from ctypes import *
import _ctypes_test
ctype_types = [c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint,
c_long, c_ulong, c_longlong, c_ulonglong, c_double, c_float]
python_types = [int, int, int, int, int, int,
int, int, int, int, float, float]
Reported by Pylint.
Line: 3
Column: 1
import unittest, sys
from ctypes import *
import _ctypes_test
ctype_types = [c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint,
c_long, c_ulong, c_longlong, c_ulonglong, c_double, c_float]
python_types = [int, int, int, int, int, int,
int, int, int, int, float, float]
Reported by Pylint.
Line: 3
Column: 1
import unittest, sys
from ctypes import *
import _ctypes_test
ctype_types = [c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint,
c_long, c_ulong, c_longlong, c_ulonglong, c_double, c_float]
python_types = [int, int, int, int, int, int,
int, int, int, int, float, float]
Reported by Pylint.
Lib/test/test_tcl.py
112 issues
Line: 17
Column: 1
import tkinter
from tkinter import Tcl
from _tkinter import TclError
try:
from _testcapi import INT_MAX, PY_SSIZE_T_MAX
except ImportError:
INT_MAX = PY_SSIZE_T_MAX = sys.maxsize
Reported by Pylint.
Line: 2
Column: 1
import unittest
import locale
import re
import subprocess
import sys
import os
import warnings
from test import support
from test.support import import_helper
Reported by Pylint.
Line: 28
Column: 5
_tk_patchlevel = None
def get_tk_patchlevel():
global _tk_patchlevel
if _tk_patchlevel is None:
tcl = Tcl()
patchlevel = tcl.call('info', 'patchlevel')
m = re.fullmatch(r'(\d+)\.(\d+)([ab.])(\d+)', patchlevel)
major, minor, releaselevel, serial = m.groups()
Reported by Pylint.
Line: 47
Column: 38
def testFlattenLen(self):
# Object without length.
self.assertRaises(TypeError, _tkinter._flatten, True)
# Object with length, but not sequence.
self.assertRaises(TypeError, _tkinter._flatten, {})
# Sequence or set, but not tuple or list.
# (issue44608: there were leaks in the following cases)
self.assertRaises(TypeError, _tkinter._flatten, 'string')
Reported by Pylint.
Line: 49
Column: 38
# Object without length.
self.assertRaises(TypeError, _tkinter._flatten, True)
# Object with length, but not sequence.
self.assertRaises(TypeError, _tkinter._flatten, {})
# Sequence or set, but not tuple or list.
# (issue44608: there were leaks in the following cases)
self.assertRaises(TypeError, _tkinter._flatten, 'string')
self.assertRaises(TypeError, _tkinter._flatten, {'set'})
Reported by Pylint.
Line: 52
Column: 38
self.assertRaises(TypeError, _tkinter._flatten, {})
# Sequence or set, but not tuple or list.
# (issue44608: there were leaks in the following cases)
self.assertRaises(TypeError, _tkinter._flatten, 'string')
self.assertRaises(TypeError, _tkinter._flatten, {'set'})
class TclTest(unittest.TestCase):
Reported by Pylint.
Line: 53
Column: 38
# Sequence or set, but not tuple or list.
# (issue44608: there were leaks in the following cases)
self.assertRaises(TypeError, _tkinter._flatten, 'string')
self.assertRaises(TypeError, _tkinter._flatten, {'set'})
class TclTest(unittest.TestCase):
def setUp(self):
Reported by Pylint.
Line: 150
Column: 3
# bignum was added in Tcl 8.5, but its support is able only since 8.5.8.
# Actually it is determined at compile time, so using get_tk_patchlevel()
# is not reliable.
# TODO: expose full static version.
if tcl_version >= (8, 5):
v = get_tk_patchlevel()
if v >= (8, 6, 0, 'final') or (8, 5, 8) <= v < (8, 6):
integers += (2**63, -2**63-1, 2**1000, -2**1000)
return integers
Reported by Pylint.
Line: 258
Column: 16
filename = "doesnotexists"
try:
os.remove(filename)
except Exception as e:
pass
self.assertRaises(TclError,tcl.evalfile,filename)
def testPackageRequireException(self):
tcl = self.interp
Reported by Pylint.
Line: 258
Column: 9
filename = "doesnotexists"
try:
os.remove(filename)
except Exception as e:
pass
self.assertRaises(TclError,tcl.evalfile,filename)
def testPackageRequireException(self):
tcl = self.interp
Reported by Pylint.
Lib/asyncore.py
111 issues
Line: 93
Column: 5
obj.handle_read_event()
except _reraised_exceptions:
raise
except:
obj.handle_error()
def write(obj):
try:
obj.handle_write_event()
Reported by Pylint.
Line: 101
Column: 5
obj.handle_write_event()
except _reraised_exceptions:
raise
except:
obj.handle_error()
def _exception(obj):
try:
obj.handle_expt_event()
Reported by Pylint.
Line: 109
Column: 5
obj.handle_expt_event()
except _reraised_exceptions:
raise
except:
obj.handle_error()
def readwrite(obj, flags):
try:
if flags & select.POLLIN:
Reported by Pylint.
Line: 129
Column: 5
obj.handle_close()
except _reraised_exceptions:
raise
except:
obj.handle_error()
def poll(timeout=0.0, map=None):
if map is None:
map = socket_map
Reported by Pylint.
Line: 132
Column: 23
except:
obj.handle_error()
def poll(timeout=0.0, map=None):
if map is None:
map = socket_map
if map:
r = []; w = []; e = []
for fd, obj in list(map.items()):
Reported by Pylint.
Line: 171
Column: 24
continue
_exception(obj)
def poll2(timeout=0.0, map=None):
# Use the poll() support added to the select module in Python 2.0
if map is None:
map = socket_map
if timeout is not None:
# timeout is in milliseconds
Reported by Pylint.
Line: 199
Column: 40
poll3 = poll2 # Alias for backward compatibility
def loop(timeout=30.0, use_poll=False, map=None, count=None):
if map is None:
map = socket_map
if use_poll and hasattr(select, 'poll'):
poll_fun = poll2
Reported by Pylint.
Line: 227
Column: 35
addr = None
ignore_log_types = frozenset({'warning'})
def __init__(self, sock=None, map=None):
if map is None:
self._map = socket_map
else:
self._map = map
Reported by Pylint.
Line: 272
Column: 27
status.append(repr(self.addr))
return '<%s at %#x>' % (' '.join(status), id(self))
def add_channel(self, map=None):
#self.log_info('adding channel %s' % self)
if map is None:
map = self._map
map[self._fileno] = self
Reported by Pylint.
Line: 278
Column: 27
map = self._map
map[self._fileno] = self
def del_channel(self, map=None):
fd = self._fileno
if map is None:
map = self._map
if fd in map:
#self.log_info('closing channel %d:%s' % (fd, self))
Reported by Pylint.
Lib/lib2to3/pgen2/pgen.py
111 issues
Line: 5
Column: 1
# Licensed to PSF under a Contributor Agreement.
# Pgen imports
from . import grammar, token, tokenize
class PgenGrammar(grammar.Grammar):
pass
class ParserGenerator(object):
Reported by Pylint.
Line: 42
Column: 28
states = []
for state in dfa:
arcs = []
for label, next in sorted(state.arcs.items()):
arcs.append((self.make_label(c, label), dfa.index(next)))
if state.isfinal:
arcs.append((0, dfa.index(state)))
states.append(arcs)
c.states.append(states)
Reported by Pylint.
Line: 49
Column: 9
states.append(arcs)
c.states.append(states)
c.dfas[c.symbol2number[name]] = (states, self.make_first(c, name))
c.start = c.symbol2number[self.startsymbol]
return c
def make_first(self, c, name):
rawfirst = self.first[name]
first = {}
Reported by Pylint.
Line: 57
Column: 32
first = {}
for label in sorted(rawfirst):
ilabel = self.make_label(c, label)
##assert ilabel not in first # XXX failed on <> ... !=
first[ilabel] = 1
return first
def make_label(self, c, label):
# XXX Maybe this should be a method on a subclass of converter?
Reported by Pylint.
Line: 62
Column: 3
return first
def make_label(self, c, label):
# XXX Maybe this should be a method on a subclass of converter?
ilabel = len(c.labels)
if label[0].isalpha():
# Either a symbol name or a named token
if label in c.symbol2number:
# A symbol name (a non-terminal)
Reported by Pylint.
Line: 88
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b307-eval
else:
# Either a keyword or an operator
assert label[0] in ('"', "'"), label
value = eval(label)
if value[0].isalpha():
# A keyword
if value in c.keywords:
return c.keywords[value]
else:
Reported by Bandit.
Line: 88
Column: 21
else:
# Either a keyword or an operator
assert label[0] in ('"', "'"), label
value = eval(label)
if value[0].isalpha():
# A keyword
if value in c.keywords:
return c.keywords[value]
else:
Reported by Pylint.
Line: 121
Column: 20
state = dfa[0]
totalset = {}
overlapcheck = {}
for label, next in state.arcs.items():
if label in self.dfas:
if label in self.first:
fset = self.first[label]
if fset is None:
raise ValueError("recursion for rule %r" % name)
Reported by Pylint.
Line: 121
Column: 20
state = dfa[0]
totalset = {}
overlapcheck = {}
for label, next in state.arcs.items():
if label in self.dfas:
if label in self.first:
fset = self.first[label]
if fset is None:
raise ValueError("recursion for rule %r" % name)
Reported by Pylint.
Line: 160
Column: 13
#self.dump_nfa(name, a, z)
dfa = self.make_dfa(a, z)
#self.dump_dfa(name, dfa)
oldlen = len(dfa)
self.simplify_dfa(dfa)
newlen = len(dfa)
dfas[name] = dfa
#print name, oldlen, newlen
if startsymbol is None:
Reported by Pylint.
Lib/test/test_dynamicclassattribute.py
111 issues
Line: 88
Column: 5
class ClassWithAbstractVirtualProperty(metaclass=abc.ABCMeta):
@DynamicClassAttribute
@abc.abstractmethod
def color():
pass
class ClassWithPropertyAbstractVirtual(metaclass=abc.ABCMeta):
@abc.abstractmethod
@DynamicClassAttribute
Reported by Pylint.
Line: 94
Column: 5
class ClassWithPropertyAbstractVirtual(metaclass=abc.ABCMeta):
@abc.abstractmethod
@DynamicClassAttribute
def color():
pass
class PropertyTests(unittest.TestCase):
def test_property_decorator_baseclass(self):
# see #1620
Reported by Pylint.
Line: 164
Column: 13
raise ValueError()
__len__ = __bool__
with self.assertRaises(ValueError):
class C(object):
def foo(self):
pass
foo.__isabstractmethod__ = NotBool()
foo = DynamicClassAttribute(foo)
Reported by Pylint.
Line: 48
Column: 5
raise PropertyGet(self._spam)
@spam.setter
def spam(self, value):
raise PropertySet(self._spam)
@spam.deleter
def spam(self):
raise PropertyDel(self._spam)
Reported by Pylint.
Line: 52
Column: 5
raise PropertySet(self._spam)
@spam.deleter
def spam(self):
raise PropertyDel(self._spam)
class PropertyDocBase(object):
_spam = 1
def _get_spam(self):
Reported by Pylint.
Line: 102
Column: 26
# see #1620
base = BaseClass()
self.assertEqual(base.spam, 5)
self.assertEqual(base._spam, 5)
base.spam = 10
self.assertEqual(base.spam, 10)
self.assertEqual(base._spam, 10)
delattr(base, "spam")
self.assertTrue(not hasattr(base, "spam"))
Reported by Pylint.
Line: 105
Column: 26
self.assertEqual(base._spam, 5)
base.spam = 10
self.assertEqual(base.spam, 10)
self.assertEqual(base._spam, 10)
delattr(base, "spam")
self.assertTrue(not hasattr(base, "spam"))
self.assertTrue(not hasattr(base, "_spam"))
base.spam = 20
self.assertEqual(base.spam, 20)
Reported by Pylint.
Line: 111
Column: 26
self.assertTrue(not hasattr(base, "_spam"))
base.spam = 20
self.assertEqual(base.spam, 20)
self.assertEqual(base._spam, 20)
def test_property_decorator_subclass(self):
# see #1620
sub = SubClass()
self.assertRaises(PropertyGet, getattr, sub, "spam")
Reported by Pylint.
Line: 173
Column: 9
def test_abstract_virtual(self):
self.assertRaises(TypeError, ClassWithAbstractVirtualProperty)
self.assertRaises(TypeError, ClassWithPropertyAbstractVirtual)
class APV(ClassWithPropertyAbstractVirtual):
pass
self.assertRaises(TypeError, APV)
class AVP(ClassWithAbstractVirtualProperty):
pass
self.assertRaises(TypeError, AVP)
Reported by Pylint.
Line: 176
Column: 9
class APV(ClassWithPropertyAbstractVirtual):
pass
self.assertRaises(TypeError, APV)
class AVP(ClassWithAbstractVirtualProperty):
pass
self.assertRaises(TypeError, AVP)
class Okay1(ClassWithAbstractVirtualProperty):
@DynamicClassAttribute
def color(self):
Reported by Pylint.
Lib/locale.py
110 issues
Line: 109
Column: 1
_override_localeconv = {}
@functools.wraps(_localeconv)
def localeconv():
d = _localeconv()
if _override_localeconv:
d.update(_override_localeconv)
return d
Reported by Pylint.
Line: 605
Column: 1
raise TypeError('category LC_ALL is not supported')
return _parse_localename(localename)
def setlocale(category, locale=None):
""" Set the locale for the given category. The locale can be
a string, an iterable of two strings (language code and encoding),
or None.
Reported by Pylint.
Line: 47
Column: 5
try:
from _locale import *
except ImportError:
# Locale emulation
Reported by Pylint.
Line: 47
Column: 5
try:
from _locale import *
except ImportError:
# Locale emulation
Reported by Pylint.
Line: 47
Column: 5
try:
from _locale import *
except ImportError:
# Locale emulation
Reported by Pylint.
Line: 47
Column: 5
try:
from _locale import *
except ImportError:
# Locale emulation
Reported by Pylint.
Line: 47
Column: 5
try:
from _locale import *
except ImportError:
# Locale emulation
Reported by Pylint.
Line: 47
Column: 5
try:
from _locale import *
except ImportError:
# Locale emulation
Reported by Pylint.
Line: 47
Column: 5
try:
from _locale import *
except ImportError:
# Locale emulation
Reported by Pylint.
Line: 47
Column: 5
try:
from _locale import *
except ImportError:
# Locale emulation
Reported by Pylint.