Initial commit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
"""test"""
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
"""test relative import"""
|
||||
# pylint: disable=no-absolute-import
|
||||
from __future__ import print_function
|
||||
import func_w0401
|
||||
__revision__ = filter(None, map(str, (1, 2, 3)))
|
||||
|
||||
|
||||
def function():
|
||||
"""something"""
|
||||
print(func_w0401)
|
||||
unic = u"unicode"
|
||||
low = unic.looower
|
||||
return low
|
||||
@@ -0,0 +1,38 @@
|
||||
"""Bad continuations in dictionary comprehensions."""
|
||||
|
||||
__revision__ = 0
|
||||
|
||||
# Dictionary comprehensions should not require extra indentation when breaking
|
||||
# before the 'for', which is not part of the value
|
||||
C1 = {'key{}'.format(x): 'value{}'.format(x)
|
||||
for x in range(3)}
|
||||
|
||||
C2 = {'key{}'.format(x): 'value{}'.format(x) for x in
|
||||
range(3)}
|
||||
|
||||
# Dictionary comprehensions with multiple loops broken in different places
|
||||
C3 = {x*y: (x, y) for x in range(3) for y in range(3)}
|
||||
|
||||
C4 = {x*y: (x, y)
|
||||
for x in range(3) for y in range(3)}
|
||||
|
||||
C5 = {x*y: (x, y) for x
|
||||
in range(3) for y in range(3)}
|
||||
|
||||
C6 = {x*y: (x, y) for x in range(3)
|
||||
for y in range(3)}
|
||||
|
||||
C7 = {key:
|
||||
key ** 2
|
||||
for key in range(10)}
|
||||
|
||||
C8 = {
|
||||
key: key ** 2
|
||||
for key in range(10)}
|
||||
|
||||
# Misaligned cases for dict comprehensions
|
||||
C9 = {'key{}'.format(x): 'value{}'.format(x)
|
||||
for x in range(3)} # [bad-continuation]
|
||||
|
||||
C9 = {'key{}'.format(x): 'value{}'.format(x)
|
||||
for x in range(3)} # [bad-continuation]
|
||||
@@ -0,0 +1,24 @@
|
||||
# pylint: disable=E1101
|
||||
# pylint: disable=C0103
|
||||
# pylint: disable=R0903, useless-object-inheritance, unnecessary-pass
|
||||
"""test bugfix for #113231 in logging checker
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
# Muck up the names in an effort to confuse...
|
||||
import logging as renamed_logging
|
||||
|
||||
__revision__ = ''
|
||||
|
||||
class Logger(object):
|
||||
"""Fake logger"""
|
||||
pass
|
||||
|
||||
logger = renamed_logging.getLogger(__name__)
|
||||
fake_logger = Logger()
|
||||
|
||||
# Statements that should be flagged:
|
||||
renamed_logging.warning('%s, %s' % (4, 5))
|
||||
logger.warning('%s' % 5)
|
||||
|
||||
# Statements that should not be flagged:
|
||||
fake_logger.warn('%s' % 5)
|
||||
@@ -0,0 +1,14 @@
|
||||
# This is a very very very very very very very very very very very very very very very very very very very very very long line.
|
||||
# pylint: disable=line-too-long
|
||||
"""Make sure enable/disable pragmas work for messages that are applied to lines and not syntax nodes.
|
||||
|
||||
A disable pragma for a message that applies to nodes is applied to the whole
|
||||
block if it comes before the first statement (excluding the docstring). For
|
||||
line-based messages, this behavior needs to be altered to really only apply to
|
||||
the enclosed lines.
|
||||
"""
|
||||
# pylint: enable=line-too-long
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
print('This is a very long line which the linter will warn about, now that line-too-long has been enabled again.')
|
||||
@@ -0,0 +1,11 @@
|
||||
"""bla"""
|
||||
# pylint: disable=no-absolute-import
|
||||
|
||||
from input import func_w0233
|
||||
|
||||
__revision__ = 'yo'
|
||||
|
||||
class Aaaa(func_w0233.AAAA):
|
||||
"""test dotted name in ancestors"""
|
||||
def __init__(self):
|
||||
func_w0233.AAAA.__init__(self)
|
||||
@@ -0,0 +1,4 @@
|
||||
# pylint:enable=W04044
|
||||
"""check unknown option
|
||||
"""
|
||||
__revision__ = 1
|
||||
@@ -0,0 +1,20 @@
|
||||
"""check for method without self as first argument
|
||||
"""
|
||||
# pylint: disable=useless-object-inheritance
|
||||
from __future__ import print_function
|
||||
__revision__ = 0
|
||||
|
||||
|
||||
class Abcd(object):
|
||||
"""dummy class"""
|
||||
|
||||
def __init__(truc):
|
||||
"""method without self"""
|
||||
print(1)
|
||||
|
||||
def abdc(yoo):
|
||||
"""another test"""
|
||||
print(yoo)
|
||||
def edf(self):
|
||||
"""just another method"""
|
||||
print('yapudju in', self)
|
||||
@@ -0,0 +1,28 @@
|
||||
# pylint: disable=E1101, no-absolute-import
|
||||
"""Test checking of log format strings
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
__revision__ = ''
|
||||
|
||||
|
||||
def pprint():
|
||||
"""Test string format in logging statements.
|
||||
"""
|
||||
# These should all emit lint errors:
|
||||
logging.info(0, '') # 1205
|
||||
logging.info('', '') # 1205
|
||||
logging.info('%s%', '') # 1201
|
||||
logging.info('%s%s', '') # 1206
|
||||
logging.info('%s%y', '', '') # 1200
|
||||
logging.info('%s%s', '', '', '') # 1205
|
||||
|
||||
# These should be okay:
|
||||
logging.info(1)
|
||||
logging.info(True)
|
||||
logging.info('')
|
||||
logging.info('%s%')
|
||||
logging.info('%s', '')
|
||||
logging.info('%s%%', '')
|
||||
logging.info('%s%s', '', '')
|
||||
@@ -0,0 +1,21 @@
|
||||
"""test string format error
|
||||
"""
|
||||
# pylint: disable=print-statement,unsupported-binary-operation
|
||||
from __future__ import print_function
|
||||
|
||||
PARG_1 = PARG_2 = PARG_3 = 1
|
||||
|
||||
def pprint():
|
||||
"""Test string format
|
||||
"""
|
||||
print("%s %s" % {'PARG_1': 1, 'PARG_2': 2}) # E1306
|
||||
print("%s" % (PARG_1, PARG_2)) # E1305
|
||||
print("%(PARG_1)d %d" % {'PARG_1': 1, 'PARG_2': 2}) # E1302
|
||||
print("%(PARG_1)d %(PARG_2)d" % {'PARG_1': 1}) # E1304
|
||||
print("%(PARG_1)d %(PARG_2)d" % {'PARG_1': 1, 'PARG_2':2, 'PARG_3':3}) #W1301
|
||||
print("%(PARG_1)d %(PARG_2)d" % {'PARG_1': 1, 2:3}) # W1300 E1304
|
||||
print("%(PARG_1)d %(PARG_2)d" % (2, 3)) # 1303
|
||||
print("%(PARG_1)d %(PARG_2)d" % [2, 3]) # 1303
|
||||
print("%2z" % PARG_1)
|
||||
print("strange format %2" % PARG_2)
|
||||
print("works in 3 %a" % 1)
|
||||
@@ -0,0 +1,30 @@
|
||||
# pylint:disable=W0105, W0511, misplaced-comparison-constant, comparison-with-itself
|
||||
"""Stray backslash escapes may be missing a raw-string prefix."""
|
||||
|
||||
__revision__ = '$Id$'
|
||||
|
||||
# Bad escape sequences, which probably don't do what you expect.
|
||||
A = "\[\]\\"
|
||||
assert '\/' == '\\/'
|
||||
ESCAPE_BACKSLASH = '\`'
|
||||
|
||||
# Valid escape sequences.
|
||||
NEWLINE = "\n"
|
||||
OLD_ESCAPES = '\a\b\f\n\t\r\v'
|
||||
HEX = '\xad\x0a\x0d'
|
||||
FALSE_OCTAL = '\o123\o000' # Not octal in Python
|
||||
OCTAL = '\123\000'
|
||||
NOT_OCTAL = '\888\999'
|
||||
NUL = '\0'
|
||||
UNICODE = u'\u1234'
|
||||
HIGH_UNICODE = u'\U0000abcd'
|
||||
QUOTES = '\'\"'
|
||||
LITERAL_NEWLINE = '\
|
||||
'
|
||||
ESCAPE_UNICODE = "\\\\n"
|
||||
|
||||
# Bad docstring
|
||||
"""Even in a docstring
|
||||
|
||||
You shouldn't have ambiguous text like: C:\Program Files\alpha
|
||||
"""
|
||||
@@ -0,0 +1,42 @@
|
||||
# pylint: disable=C0111, W0232, useless-object-inheritance
|
||||
"""check for methods first arguments
|
||||
"""
|
||||
|
||||
__revision__ = 0
|
||||
|
||||
|
||||
class Obj(object):
|
||||
# C0202, classmethod
|
||||
def __new__(something):
|
||||
pass
|
||||
|
||||
# C0202, classmethod
|
||||
def class1(cls):
|
||||
pass
|
||||
class1 = classmethod(class1)
|
||||
|
||||
def class2(other):
|
||||
pass
|
||||
class2 = classmethod(class2)
|
||||
|
||||
|
||||
class Meta(type):
|
||||
# C0204, metaclass __new__
|
||||
def __new__(other, name, bases, dct):
|
||||
pass
|
||||
|
||||
# C0203, metaclass method
|
||||
def method1(cls):
|
||||
pass
|
||||
|
||||
def method2(other):
|
||||
pass
|
||||
|
||||
# C0205, metaclass classmethod
|
||||
def class1(cls):
|
||||
pass
|
||||
class1 = classmethod(class1)
|
||||
|
||||
def class2(other):
|
||||
pass
|
||||
class2 = classmethod(class2)
|
||||
@@ -0,0 +1,4 @@
|
||||
# pylint:disable=W0404
|
||||
"""check warning on local disabling
|
||||
"""
|
||||
__revision__ = 1
|
||||
@@ -0,0 +1,4 @@
|
||||
# pylint:enable=W0404
|
||||
"""check warning on local enabling
|
||||
"""
|
||||
__revision__ = 1
|
||||
@@ -0,0 +1,8 @@
|
||||
# pylint: skip-file
|
||||
"""disable-all is usable as an inline option"""
|
||||
|
||||
# no warning should be issued
|
||||
try:
|
||||
import this
|
||||
except:
|
||||
pass
|
||||
@@ -0,0 +1,8 @@
|
||||
# pylint: disable-all
|
||||
"""disable-all is usable as an inline option"""
|
||||
|
||||
# no warning should be issued
|
||||
try:
|
||||
import this
|
||||
except:
|
||||
pass
|
||||
@@ -0,0 +1,8 @@
|
||||
"""Test for reporting of suppressed messages."""
|
||||
|
||||
__revision__ = 0
|
||||
|
||||
def suppressed():
|
||||
"""A function with an unused variable."""
|
||||
# pylint: disable=W0612
|
||||
var = 0
|
||||
@@ -0,0 +1,22 @@
|
||||
"""Deprecated suppression style."""
|
||||
|
||||
__revision__ = None
|
||||
|
||||
a = 1 # pylint: disable=invalid-name
|
||||
b = 1 # pylint: disable-msg=invalid-name
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
c = 1
|
||||
# pylint: enable=invalid-name
|
||||
|
||||
# pylint: disable-msg=invalid-name
|
||||
d = 1
|
||||
# pylint: enable-msg=invalid-name
|
||||
|
||||
# pylint: disable-msg=C0103
|
||||
e = 1
|
||||
# pylint: enable-msg=C0103
|
||||
|
||||
# pylint: disable=C0103
|
||||
f = 1
|
||||
# pylint: enable=C0103
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
"""Logging warnings using a logger class."""
|
||||
from __future__ import absolute_import
|
||||
import logging
|
||||
|
||||
__revision__ = ''
|
||||
|
||||
LOG = logging.getLogger("domain")
|
||||
LOG.debug("%s" % "junk")
|
||||
LOG.log(logging.DEBUG, "%s" % "junk")
|
||||
LOG2 = LOG.debug
|
||||
LOG2("%s" % "junk")
|
||||
|
||||
logging.getLogger("domain").debug("%s" % "junk")
|
||||
@@ -0,0 +1,8 @@
|
||||
"""Tests for loopvar-in-closure."""
|
||||
|
||||
__revision__ = 0
|
||||
|
||||
|
||||
def bad_case():
|
||||
"""Loop variable from dict comprehension."""
|
||||
return {x: lambda: x for x in range(10)}
|
||||
@@ -0,0 +1,9 @@
|
||||
"""http://www.logilab.org/ticket/6949."""
|
||||
from __future__ import print_function
|
||||
__revision__ = None
|
||||
|
||||
print(__dict__ is not None)
|
||||
|
||||
__dict__ = {}
|
||||
|
||||
print(__dict__ is not None)
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
"""pylint doesn't see the NameError in this module"""
|
||||
|
||||
__revision__ = None
|
||||
|
||||
MSG = "hello %s" % MSG
|
||||
|
||||
MSG2 = ("hello %s" %
|
||||
MSG2)
|
||||
@@ -0,0 +1,14 @@
|
||||
"""Make sure warnings about redefinitions do not trigger for dummy variables."""
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
_, INTERESTING = 'a=b'.split('=')
|
||||
|
||||
value = 10
|
||||
|
||||
|
||||
def clobbering():
|
||||
"""Clobbers a dummy name from the outer scope."""
|
||||
value = 9
|
||||
for _ in range(7):
|
||||
print(value)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
# pylint: disable=R0903, useless-object-inheritance
|
||||
"""#10075"""
|
||||
|
||||
__revision__ = 1
|
||||
|
||||
class Aaa(object):
|
||||
"""docstring"""
|
||||
def __init__(self):
|
||||
def inner_function(arg):
|
||||
"""inner docstring"""
|
||||
return arg + 4
|
||||
self.func = inner_function
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
#pylint: disable=C0103,R0904,R0903,W0201,no-absolute-import, useless-object-inheritance
|
||||
"""
|
||||
This module demonstrates a possible problem of pyLint with calling __init__ s
|
||||
from inherited classes.
|
||||
Initializations done there are not considered, which results in Error E0203 for
|
||||
self.cookedq.
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import telnetlib
|
||||
|
||||
class SeeTelnet(telnetlib.Telnet):
|
||||
"""
|
||||
Extension of telnetlib.
|
||||
"""
|
||||
|
||||
def __init__(self, host=None, port=0):
|
||||
"""
|
||||
Constructor.
|
||||
When called without arguments, create an unconnected instance.
|
||||
With a hostname argument, it connects the instance; a port
|
||||
number is optional.
|
||||
Parameter:
|
||||
- host: IP address of the host
|
||||
- port: Port number
|
||||
"""
|
||||
telnetlib.Telnet.__init__(self, host, port)
|
||||
|
||||
def readUntilArray(self, matches, _=None):
|
||||
"""
|
||||
Read until a given string is encountered or until timeout.
|
||||
...
|
||||
"""
|
||||
self.process_rawq()
|
||||
maxLength = 0
|
||||
for match in matches:
|
||||
if len(match) > maxLength:
|
||||
maxLength = len(match)
|
||||
|
||||
class Base(object):
|
||||
"""bla bla"""
|
||||
dougloup_papa = None
|
||||
|
||||
def __init__(self):
|
||||
self._var = False
|
||||
|
||||
class Derived(Base):
|
||||
"""derived blabla"""
|
||||
dougloup_moi = None
|
||||
def Work(self):
|
||||
"""do something"""
|
||||
# E0203 - Access to member '_var' before its definition
|
||||
if self._var:
|
||||
print("True")
|
||||
else:
|
||||
print("False")
|
||||
self._var = True
|
||||
|
||||
# E0203 - Access to member 'dougloup_papa' before its definition
|
||||
if self.dougloup_papa:
|
||||
print('dougloup !')
|
||||
self.dougloup_papa = True
|
||||
# E0203 - Access to member 'dougloup_moi' before its definition
|
||||
if self.dougloup_moi:
|
||||
print('dougloup !')
|
||||
self.dougloup_moi = True
|
||||
|
||||
|
||||
class QoSALConnection(object):
|
||||
"""blabla"""
|
||||
|
||||
_the_instance = None
|
||||
|
||||
def __new__(cls):
|
||||
if cls._the_instance is None:
|
||||
cls._the_instance = object.__new__(cls)
|
||||
return cls._the_instance
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
class DefinedOutsideInit(object):
|
||||
"""use_attr is seen as the method defining attr because its in
|
||||
first position
|
||||
"""
|
||||
def __init__(self):
|
||||
self.reset()
|
||||
|
||||
def use_attr(self):
|
||||
"""use and set members"""
|
||||
if self.attr:
|
||||
print('hop')
|
||||
self.attr = 10
|
||||
|
||||
def reset(self):
|
||||
"""reset members"""
|
||||
self.attr = 4
|
||||
@@ -0,0 +1,35 @@
|
||||
# pylint:disable=R0201, print-statement, too-few-public-methods, useless-object-inheritance
|
||||
"""Checks that class variables are seen as inherited !
|
||||
"""
|
||||
__revision__ = ''
|
||||
|
||||
class BaseClass(object):
|
||||
"""A simple base class
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.base_var = {}
|
||||
|
||||
def met(self):
|
||||
"""yo"""
|
||||
def meeting(self, with_):
|
||||
"""ye"""
|
||||
return with_
|
||||
class MyClass(BaseClass):
|
||||
"""Inherits from BaseClass
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
BaseClass.__init__(self)
|
||||
self.var = {}
|
||||
|
||||
def met(self):
|
||||
"""Checks that base_var is not seen as defined outsite '__init__'
|
||||
"""
|
||||
self.var[1] = 'one'
|
||||
self.base_var[1] = 'one'
|
||||
return self.base_var, self.var
|
||||
|
||||
if __name__ == '__main__':
|
||||
OBJ = MyClass()
|
||||
OBJ.met()
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
"""test import from a builtin module"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from math import log10
|
||||
|
||||
__revision__ = None
|
||||
|
||||
|
||||
def log10_2():
|
||||
"""bla bla bla"""
|
||||
return log10(2)
|
||||
@@ -0,0 +1,18 @@
|
||||
"""Test that valid class attribute doesn't trigger errors"""
|
||||
__revision__ = 'sponge bob'
|
||||
# pylint: disable=useless-object-inheritance
|
||||
|
||||
class Clazz(object):
|
||||
"dummy class"
|
||||
|
||||
def __init__(self):
|
||||
self.topic = 5
|
||||
self._data = 45
|
||||
|
||||
def change_type(self, new_class):
|
||||
"""Change type"""
|
||||
self.__class__ = new_class
|
||||
|
||||
def do_nothing(self):
|
||||
"I do nothing useful"
|
||||
return self.topic + 56
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
# pylint: disable=C0111,R0903,W0232, useless-object-inheritance
|
||||
"""
|
||||
#2479
|
||||
|
||||
R0201 (formely W0212), Method could be a function shouldn't be emitted in case
|
||||
like factory method pattern
|
||||
"""
|
||||
__revision__ = 1
|
||||
|
||||
class XAsub(object):
|
||||
pass
|
||||
class XBsub(XAsub):
|
||||
pass
|
||||
class XCsub(XAsub):
|
||||
pass
|
||||
|
||||
class Aimpl(object):
|
||||
# disable "method could be a function" on classes which are not overriding
|
||||
# the factory method because in that case the usage of polymorphism is not
|
||||
# detected
|
||||
# pylint: disable=R0201
|
||||
def makex(self):
|
||||
return XAsub()
|
||||
|
||||
class Bimpl(Aimpl):
|
||||
|
||||
def makex(self):
|
||||
return XBsub()
|
||||
|
||||
class Cimpl(Aimpl):
|
||||
|
||||
def makex(self):
|
||||
return XCsub()
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
"""
|
||||
#3123: W0212 false positive on static method
|
||||
"""
|
||||
__revision__ = 1
|
||||
|
||||
# pylint: disable=no-classmethod-decorator, no-staticmethod-decorator, useless-object-inheritance
|
||||
class A3123(object):
|
||||
"""oypuee"""
|
||||
_protected = 1
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
def cmeth(cls, val):
|
||||
"""set protected member"""
|
||||
cls._protected = +val
|
||||
|
||||
cmeth = classmethod(cmeth)
|
||||
|
||||
def smeth(val):
|
||||
"""set protected member"""
|
||||
A3123._protected += val
|
||||
|
||||
smeth = staticmethod(smeth)
|
||||
|
||||
prop = property(lambda self: self._protected)
|
||||
@@ -0,0 +1,19 @@
|
||||
# -*- pylint: disable=W0232,R0903, useless-object-inheritance
|
||||
"""Test that decorators sees the class namespace - just like
|
||||
function default values does but function body doesn't.
|
||||
|
||||
https://www.logilab.net/elo/ticket/3711 - bug finding decorator arguments
|
||||
https://www.logilab.net/elo/ticket/5626 - name resolution bug inside classes
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
class Test(object):
|
||||
"""test class"""
|
||||
ident = lambda x: x
|
||||
|
||||
@ident(ident)
|
||||
def method(self, val=ident(7), func=ident):
|
||||
"""hop"""
|
||||
print(self)
|
||||
return func(val)
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
# pylint: disable=R0903, useless-object-inheritance
|
||||
"""
|
||||
False positive case of E1101:
|
||||
|
||||
The error is triggered when the attribute set in the base class is
|
||||
modified with augmented assignment in a derived class.
|
||||
|
||||
http://www.logilab.org/ticket/9588
|
||||
"""
|
||||
__revision__ = 0
|
||||
|
||||
class BaseClass(object):
|
||||
"The base class"
|
||||
def __init__(self):
|
||||
"Set an attribute."
|
||||
self.e1101 = 1
|
||||
|
||||
class FalsePositiveClass(BaseClass):
|
||||
"The first derived class which triggers the false positive"
|
||||
def __init__(self):
|
||||
"Augmented assignment triggers E1101."
|
||||
BaseClass.__init__(self)
|
||||
self.e1101 += 1
|
||||
|
||||
def countup(self):
|
||||
"Consequently this also triggers E1101."
|
||||
self.e1101 += 1
|
||||
|
||||
class NegativeClass(BaseClass):
|
||||
"The second derived class, which does not trigger the error E1101"
|
||||
def __init__(self):
|
||||
"Ordinary assignment is OK."
|
||||
BaseClass.__init__(self)
|
||||
self.e1101 = self.e1101 + 1
|
||||
|
||||
def countup(self):
|
||||
"No problem."
|
||||
self.e1101 += 1
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# pylint: disable=W0232,R0903,W0613, useless-object-inheritance
|
||||
"""tagging a function as a class method cause a crash when checking for
|
||||
signature overriding
|
||||
"""
|
||||
|
||||
def fetch_config(mainattr=None):
|
||||
"""return a class method"""
|
||||
|
||||
def fetch_order(cls, attr, var):
|
||||
"""a class method"""
|
||||
if attr == mainattr:
|
||||
return var
|
||||
return None
|
||||
fetch_order = classmethod(fetch_order)
|
||||
return fetch_order
|
||||
|
||||
class Aaa(object):
|
||||
"""hop"""
|
||||
fetch_order = fetch_config('A')
|
||||
|
||||
__revision__ = None
|
||||
@@ -0,0 +1,33 @@
|
||||
# pylint: disable=R0903, useless-object-inheritance, unnecessary-pass
|
||||
"""Backend Base Classes for the schwelm user DB"""
|
||||
|
||||
__revision__ = "alpha"
|
||||
|
||||
class Aaa(object):
|
||||
"""docstring"""
|
||||
def __init__(self):
|
||||
self.__setattr__('a', 'b')
|
||||
|
||||
|
||||
def one_public(self):
|
||||
"""docstring"""
|
||||
pass
|
||||
|
||||
def another_public(self):
|
||||
"""docstring"""
|
||||
pass
|
||||
|
||||
class Bbb(Aaa):
|
||||
"""docstring"""
|
||||
pass
|
||||
|
||||
class Ccc(Aaa):
|
||||
"""docstring"""
|
||||
|
||||
class Ddd(Aaa):
|
||||
"""docstring"""
|
||||
pass
|
||||
|
||||
class Eee(Ddd):
|
||||
"""docstring"""
|
||||
pass
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
"""https://www.logilab.net/elo/ticket/18862"""
|
||||
from __future__ import print_function
|
||||
__revision__ = 1
|
||||
def function():
|
||||
"""hop"""
|
||||
ggg = lambda: xxx
|
||||
xxx = 1
|
||||
print(ggg())
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user