diff options
235 files changed, 985 insertions, 1068 deletions
diff --git a/tests/functional/a/abstract/abstract_abc_methods.py b/tests/functional/a/abstract/abstract_abc_methods.py index d63389c50..4d4af2cdb 100644 --- a/tests/functional/a/abstract/abstract_abc_methods.py +++ b/tests/functional/a/abstract/abstract_abc_methods.py @@ -1,9 +1,9 @@ """ This should not warn about `prop` being abstract in Child """
-# pylint: disable=too-few-public-methods, useless-object-inheritance
+# pylint: disable=too-few-public-methods
import abc
-class Parent(object):
+class Parent:
"""Abstract Base Class """
__metaclass__ = abc.ABCMeta
diff --git a/tests/functional/a/abstract/abstract_class_instantiated.py b/tests/functional/a/abstract/abstract_class_instantiated.py index bf1666a85..289870c9d 100644 --- a/tests/functional/a/abstract/abstract_class_instantiated.py +++ b/tests/functional/a/abstract/abstract_class_instantiated.py @@ -4,31 +4,31 @@ abstract methods. """ # pylint: disable=too-few-public-methods, missing-docstring -# pylint: disable=abstract-method, import-error, useless-object-inheritance +# pylint: disable=abstract-method, import-error import abc import weakref from lala import Bala -class GoodClass(object, metaclass=abc.ABCMeta): +class GoodClass(metaclass=abc.ABCMeta): pass -class SecondGoodClass(object, metaclass=abc.ABCMeta): +class SecondGoodClass(metaclass=abc.ABCMeta): def test(self): """ do nothing. """ -class ThirdGoodClass(object, metaclass=abc.ABCMeta): +class ThirdGoodClass(metaclass=abc.ABCMeta): """ This should not raise the warning. """ def test(self): raise NotImplementedError() -class BadClass(object, metaclass=abc.ABCMeta): +class BadClass(metaclass=abc.ABCMeta): @abc.abstractmethod def test(self): """ do nothing. """ -class SecondBadClass(object, metaclass=abc.ABCMeta): +class SecondBadClass(metaclass=abc.ABCMeta): @property @abc.abstractmethod def test(self): @@ -38,7 +38,7 @@ class ThirdBadClass(SecondBadClass): pass -class Structure(object, metaclass=abc.ABCMeta): +class Structure(metaclass=abc.ABCMeta): @abc.abstractmethod def __iter__(self): pass @@ -112,12 +112,12 @@ def main(): if 1: # pylint: disable=using-constant-test - class FourthBadClass(object, metaclass=abc.ABCMeta): + class FourthBadClass(metaclass=abc.ABCMeta): def test(self): pass else: - class FourthBadClass(object, metaclass=abc.ABCMeta): + class FourthBadClass(metaclass=abc.ABCMeta): @abc.abstractmethod def test(self): diff --git a/tests/functional/a/abstract/abstract_class_instantiated_in_class.py b/tests/functional/a/abstract/abstract_class_instantiated_in_class.py index daaa3b689..e31f9470d 100644 --- a/tests/functional/a/abstract/abstract_class_instantiated_in_class.py +++ b/tests/functional/a/abstract/abstract_class_instantiated_in_class.py @@ -1,11 +1,11 @@ """Don't warn if the class is instantiated in its own body."""
-# pylint: disable=missing-docstring, useless-object-inheritance
+# pylint: disable=missing-docstring
import abc
-class Ala(object, metaclass=abc.ABCMeta):
+class Ala(metaclass=abc.ABCMeta):
@abc.abstractmethod
def bala(self):
diff --git a/tests/functional/a/abstract/abstract_method.py b/tests/functional/a/abstract/abstract_method.py index 2ea751141..75ffda220 100644 --- a/tests/functional/a/abstract/abstract_method.py +++ b/tests/functional/a/abstract/abstract_method.py @@ -1,12 +1,12 @@ """Test abstract-method warning.""" -from __future__ import print_function + # pylint: disable=missing-docstring -# pylint: disable=too-few-public-methods, useless-object-inheritance +# pylint: disable=too-few-public-methods import abc -class Abstract(object): +class Abstract: def aaaa(self): """should be overridden in concrete class""" raise NotImplementedError() @@ -51,7 +51,7 @@ class Concrete(Abstract): # [abstract-method] """overridden form Abstract""" -class Structure(object, metaclass=abc.ABCMeta): +class Structure(metaclass=abc.ABCMeta): @abc.abstractmethod def __iter__(self): pass diff --git a/tests/functional/a/access/access_attr_before_def_false_positive.py b/tests/functional/a/access/access_attr_before_def_false_positive.py index c723eb099..ebdb76c6a 100644 --- a/tests/functional/a/access/access_attr_before_def_false_positive.py +++ b/tests/functional/a/access/access_attr_before_def_false_positive.py @@ -1,11 +1,10 @@ # pylint: disable=invalid-name,too-many-public-methods,attribute-defined-outside-init -# pylint: disable=useless-object-inheritance,too-few-public-methods,deprecated-module +# pylint: disable=too-few-public-methods,deprecated-module """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 @@ -37,7 +36,7 @@ class SeeTelnet(telnetlib.Telnet): if len(match) > maxLength: maxLength = len(match) -class Base(object): +class Base: """bla bla""" dougloup_papa = None @@ -66,7 +65,7 @@ class Derived(Base): self.dougloup_moi = True -class QoSALConnection(object): +class QoSALConnection: """blabla""" _the_instance = None @@ -79,7 +78,7 @@ class QoSALConnection(object): def __init__(self): pass -class DefinedOutsideInit(object): +class DefinedOutsideInit: """use_attr is seen as the method defining attr because its in first position """ diff --git a/tests/functional/a/access/access_member_before_definition.py b/tests/functional/a/access/access_member_before_definition.py index 224e6e43e..6ffebdd03 100644 --- a/tests/functional/a/access/access_member_before_definition.py +++ b/tests/functional/a/access/access_member_before_definition.py @@ -1,8 +1,8 @@ # pylint: disable=missing-docstring,too-few-public-methods,invalid-name -# pylint: disable=attribute-defined-outside-init, useless-object-inheritance +# pylint: disable=attribute-defined-outside-init -class Aaaa(object): +class Aaaa: """class with attributes defined in wrong order""" def __init__(self): @@ -11,7 +11,7 @@ class Aaaa(object): self._var3 = var1 -class Bbbb(object): +class Bbbb: A = 23 B = A @@ -31,7 +31,7 @@ class Bbbb(object): return attr -class Mixin(object): +class Mixin: def test_mixin(self): """Don't emit access-member-before-definition for mixin classes.""" if self.already_defined: diff --git a/tests/functional/a/access/access_to__name__.py b/tests/functional/a/access/access_to__name__.py index 9f16d3a7a..18445f7b4 100644 --- a/tests/functional/a/access/access_to__name__.py +++ b/tests/functional/a/access/access_to__name__.py @@ -1,8 +1,8 @@ -# pylint: disable=too-few-public-methods, useless-object-inheritance +# pylint: disable=too-few-public-methods """test access to __name__ gives undefined member on new/old class instances but not on new/old class object """ -from __future__ import print_function + class Aaaa: """old class""" @@ -10,7 +10,7 @@ class Aaaa: print(self.__name__) # [no-member] print(self.__class__.__name__) -class NewClass(object): +class NewClass: """new class""" def __new__(cls, *args, **kwargs): diff --git a/tests/functional/a/access/access_to_protected_members.py b/tests/functional/a/access/access_to_protected_members.py index a521a6467..9ca221628 100644 --- a/tests/functional/a/access/access_to_protected_members.py +++ b/tests/functional/a/access/access_to_protected_members.py @@ -1,9 +1,8 @@ # pylint: disable=too-few-public-methods, super-init-not-called -# pylint: disable=no-classmethod-decorator,useless-object-inheritance +# pylint: disable=no-classmethod-decorator """Test external access to protected class members.""" -from __future__ import print_function -class MyClass(object): +class MyClass: """Class with protected members.""" _cls_protected = 5 @@ -44,7 +43,7 @@ INST._cls_protected = 3 # [protected-access] print(INST._cls_protected) # [protected-access] -class Issue1031(object): +class Issue1031: """Test for GitHub issue 1031""" _attr = 1 @@ -59,7 +58,7 @@ class Issue1031(object): return None -class Issue1802(object): +class Issue1802: """Test for GitHub issue 1802""" def __init__(self, value): self._foo = value @@ -101,7 +100,7 @@ class Issue1802(object): return False -class Issue1159OtherClass(object): +class Issue1159OtherClass: """Test for GitHub issue 1159""" _foo = 0 @@ -110,7 +109,7 @@ class Issue1159OtherClass(object): self._bar = 0 -class Issue1159(object): +class Issue1159: """Test for GitHub issue 1159""" _foo = 0 diff --git a/tests/functional/a/access/access_to_protected_members.txt b/tests/functional/a/access/access_to_protected_members.txt index d9dfd96ce..b49a915a4 100644 --- a/tests/functional/a/access/access_to_protected_members.txt +++ b/tests/functional/a/access/access_to_protected_members.txt @@ -1,28 +1,28 @@ -protected-access:19:14:19:31:MyClass.test:Access to a protected member _haha of a client class:UNDEFINED -protected-access:41:0:41:15::Access to a protected member _protected of a client class:UNDEFINED -protected-access:42:6:42:21::Access to a protected member _protected of a client class:UNDEFINED -protected-access:43:0:43:19::Access to a protected member _cls_protected of a client class:UNDEFINED -protected-access:44:6:44:25::Access to a protected member _cls_protected of a client class:UNDEFINED -protected-access:58:19:58:40:Issue1031.incorrect_access:Access to a protected member _protected of a client class:UNDEFINED -protected-access:72:48:72:63:Issue1802.__eq__:Access to a protected member __private of a client class:UNDEFINED -protected-access:80:32:80:42:Issue1802.not_in_special:Access to a protected member _foo of a client class:UNDEFINED -protected-access:100:32:100:42:Issue1802.__fake_special__:Access to a protected member _foo of a client class:UNDEFINED -protected-access:162:8:162:21:Issue1159.access_other_attr:Access to a protected member _bar of a client class:UNDEFINED -protected-access:163:12:163:25:Issue1159.access_other_attr:Access to a protected member _foo of a client class:UNDEFINED -no-member:194:12:194:25:Issue1159Subclass.access_missing_member:Instance of 'Issue1159Subclass' has no '_baz' member; maybe '_bar'?:INFERENCE -protected-access:194:12:194:25:Issue1159Subclass.access_missing_member:Access to a protected member _baz of a client class:UNDEFINED -attribute-defined-outside-init:203:8:203:21:Issue1159Subclass.assign_missing_member:Attribute '_qux' defined outside __init__:UNDEFINED -protected-access:212:8:212:21:Issue1159Subclass.access_other_attr:Access to a protected member _bar of a client class:UNDEFINED -protected-access:213:12:213:25:Issue1159Subclass.access_other_attr:Access to a protected member _foo of a client class:UNDEFINED -protected-access:232:8:232:30:Issue3066.foobar:Access to a protected member _attr of a client class:UNDEFINED -protected-access:233:8:233:37:Issue3066.foobar:Access to a protected member _attr of a client class:UNDEFINED -protected-access:236:8:236:29:Issue3066.foobar:Access to a protected member _bar of a client class:UNDEFINED -protected-access:237:8:237:36:Issue3066.foobar:Access to a protected member _bar of a client class:UNDEFINED -protected-access:247:12:247:27:Issue3066.Aclass.foobar:Access to a protected member _attr of a client class:UNDEFINED -protected-access:249:12:249:41:Issue3066.Aclass.foobar:Access to a protected member _attr of a client class:UNDEFINED -protected-access:251:12:251:26:Issue3066.Aclass.foobar:Access to a protected member _bar of a client class:UNDEFINED -protected-access:253:12:253:40:Issue3066.Aclass.foobar:Access to a protected member _bar of a client class:UNDEFINED -protected-access:267:16:267:31:Issue3066.Aclass.Bclass.foobar:Access to a protected member _attr of a client class:UNDEFINED -protected-access:268:16:268:38:Issue3066.Aclass.Bclass.foobar:Access to a protected member _attr of a client class:UNDEFINED -protected-access:271:16:271:30:Issue3066.Aclass.Bclass.foobar:Access to a protected member _bar of a client class:UNDEFINED -protected-access:272:16:272:37:Issue3066.Aclass.Bclass.foobar:Access to a protected member _bar of a client class:UNDEFINED +protected-access:18:14:18:31:MyClass.test:Access to a protected member _haha of a client class:UNDEFINED +protected-access:40:0:40:15::Access to a protected member _protected of a client class:UNDEFINED +protected-access:41:6:41:21::Access to a protected member _protected of a client class:UNDEFINED +protected-access:42:0:42:19::Access to a protected member _cls_protected of a client class:UNDEFINED +protected-access:43:6:43:25::Access to a protected member _cls_protected of a client class:UNDEFINED +protected-access:57:19:57:40:Issue1031.incorrect_access:Access to a protected member _protected of a client class:UNDEFINED +protected-access:71:48:71:63:Issue1802.__eq__:Access to a protected member __private of a client class:UNDEFINED +protected-access:79:32:79:42:Issue1802.not_in_special:Access to a protected member _foo of a client class:UNDEFINED +protected-access:99:32:99:42:Issue1802.__fake_special__:Access to a protected member _foo of a client class:UNDEFINED +protected-access:161:8:161:21:Issue1159.access_other_attr:Access to a protected member _bar of a client class:UNDEFINED +protected-access:162:12:162:25:Issue1159.access_other_attr:Access to a protected member _foo of a client class:UNDEFINED +no-member:193:12:193:25:Issue1159Subclass.access_missing_member:Instance of 'Issue1159Subclass' has no '_baz' member; maybe '_bar'?:INFERENCE +protected-access:193:12:193:25:Issue1159Subclass.access_missing_member:Access to a protected member _baz of a client class:UNDEFINED +attribute-defined-outside-init:202:8:202:21:Issue1159Subclass.assign_missing_member:Attribute '_qux' defined outside __init__:UNDEFINED +protected-access:211:8:211:21:Issue1159Subclass.access_other_attr:Access to a protected member _bar of a client class:UNDEFINED +protected-access:212:12:212:25:Issue1159Subclass.access_other_attr:Access to a protected member _foo of a client class:UNDEFINED +protected-access:231:8:231:30:Issue3066.foobar:Access to a protected member _attr of a client class:UNDEFINED +protected-access:232:8:232:37:Issue3066.foobar:Access to a protected member _attr of a client class:UNDEFINED +protected-access:235:8:235:29:Issue3066.foobar:Access to a protected member _bar of a client class:UNDEFINED +protected-access:236:8:236:36:Issue3066.foobar:Access to a protected member _bar of a client class:UNDEFINED +protected-access:246:12:246:27:Issue3066.Aclass.foobar:Access to a protected member _attr of a client class:UNDEFINED +protected-access:248:12:248:41:Issue3066.Aclass.foobar:Access to a protected member _attr of a client class:UNDEFINED +protected-access:250:12:250:26:Issue3066.Aclass.foobar:Access to a protected member _bar of a client class:UNDEFINED +protected-access:252:12:252:40:Issue3066.Aclass.foobar:Access to a protected member _bar of a client class:UNDEFINED +protected-access:266:16:266:31:Issue3066.Aclass.Bclass.foobar:Access to a protected member _attr of a client class:UNDEFINED +protected-access:267:16:267:38:Issue3066.Aclass.Bclass.foobar:Access to a protected member _attr of a client class:UNDEFINED +protected-access:270:16:270:30:Issue3066.Aclass.Bclass.foobar:Access to a protected member _bar of a client class:UNDEFINED +protected-access:271:16:271:37:Issue3066.Aclass.Bclass.foobar:Access to a protected member _bar of a client class:UNDEFINED diff --git a/tests/functional/a/arguments.py b/tests/functional/a/arguments.py index 9e533161e..a065e517e 100644 --- a/tests/functional/a/arguments.py +++ b/tests/functional/a/arguments.py @@ -1,5 +1,5 @@ # pylint: disable=too-few-public-methods, missing-docstring,import-error,wrong-import-position -# pylint: disable=wrong-import-order, useless-object-inheritance,unnecessary-lambda, consider-using-f-string +# pylint: disable=wrong-import-order, unnecessary-lambda, consider-using-f-string # pylint: disable=unnecessary-lambda-assignment def decorator(fun): @@ -7,7 +7,7 @@ def decorator(fun): return fun -class DemoClass(object): +class DemoClass: """Test class for method invocations.""" @staticmethod @@ -84,7 +84,7 @@ def method_tests(): # Test a regression (issue #234) import sys -class Text(object): +class Text: """ Regression """ if sys.version_info > (3,): @@ -98,7 +98,7 @@ class Text(object): Text() -class TestStaticMethod(object): +class TestStaticMethod: @staticmethod def test(first, second=None, **kwargs): @@ -112,7 +112,7 @@ class TestStaticMethod(object): self.test(42, 42, 42) # [too-many-function-args] -class TypeCheckConstructor(object): +class TypeCheckConstructor: def __init__(self, first, second): self.first = first self.second = second @@ -125,7 +125,7 @@ class TypeCheckConstructor(object): type(self)(first=1, second=2) -class Test(object): +class Test: """ lambda needs Test instance as first argument """ lam = lambda self, icon: (self, icon) @@ -139,7 +139,7 @@ Test().lam() # [no-value-for-parameter] # Don't emit a redundant-keyword-arg for this example, # it's perfectly valid -class Issue642(object): +class Issue642: attr = 0 def __str__(self): return "{self.attr}".format(self=self) diff --git a/tests/functional/a/arguments_differ.py b/tests/functional/a/arguments_differ.py index 1dbd40086..f579f89a6 100644 --- a/tests/functional/a/arguments_differ.py +++ b/tests/functional/a/arguments_differ.py @@ -1,7 +1,7 @@ """Test that we are emitting arguments-differ when the arguments are different."""
-# pylint: disable=missing-docstring, too-few-public-methods, unused-argument,useless-super-delegation, useless-object-inheritance, unused-private-member
+# pylint: disable=missing-docstring, too-few-public-methods, unused-argument,useless-super-delegation, unused-private-member
-class Parent(object):
+class Parent:
def test(self):
pass
@@ -13,7 +13,7 @@ class Child(Parent): pass
-class ParentDefaults(object):
+class ParentDefaults:
def test(self, arg=None, barg=None):
pass
@@ -24,7 +24,7 @@ class ChildDefaults(ParentDefaults): pass
-class Classmethod(object):
+class Classmethod:
@classmethod
def func(cls, data):
@@ -54,7 +54,7 @@ class Builtins(dict): pass
-class Varargs(object):
+class Varargs:
def has_kwargs(self, arg, **kwargs):
pass
@@ -72,7 +72,7 @@ class VarargsChild(Varargs): "Addition of kwargs does not violate LSP, but first argument's name has changed."
-class Super(object):
+class Super:
def __init__(self):
pass
@@ -108,7 +108,7 @@ class Sub(Super): pass
-class Staticmethod(object):
+class Staticmethod:
@staticmethod
def func(data):
@@ -122,7 +122,7 @@ class StaticmethodChild(Staticmethod): return data
-class Property(object):
+class Property:
@property
def close(self):
@@ -145,7 +145,7 @@ class StaticmethodChild2(Staticmethod): super().func(data)
-class SuperClass(object):
+class SuperClass:
@staticmethod
def impl(arg1, arg2, **kwargs):
@@ -169,7 +169,7 @@ class MyClass(SuperClass): return arg1 + arg2
-class FirstHasArgs(object):
+class FirstHasArgs:
def test(self, *args):
pass
@@ -181,7 +181,7 @@ class SecondChangesArgs(FirstHasArgs): pass
-class Positional(object):
+class Positional:
def test(self, first, second):
pass
@@ -195,7 +195,7 @@ class PositionalChild(Positional): """
super().test(args[0], args[1])
-class Mixed(object):
+class Mixed:
def mixed(self, first, second, *, third, fourth):
pass
@@ -219,7 +219,7 @@ class MixedChild2(Mixed): super().mixed(first, *args, third, **kwargs)
-class HasSpecialMethod(object):
+class HasSpecialMethod:
def __getitem__(self, key):
return key
@@ -232,7 +232,7 @@ class OverridesSpecialMethod(HasSpecialMethod): return cheie + 1
-class ParentClass(object):
+class ParentClass:
def meth(self, arg, arg1):
raise NotImplementedError
diff --git a/tests/functional/a/arguments_renamed.py b/tests/functional/a/arguments_renamed.py index b9145eb9a..73105f824 100644 --- a/tests/functional/a/arguments_renamed.py +++ b/tests/functional/a/arguments_renamed.py @@ -1,4 +1,4 @@ -# pylint: disable=unused-argument, missing-docstring, line-too-long, useless-object-inheritance, too-few-public-methods +# pylint: disable=unused-argument, missing-docstring, line-too-long, too-few-public-methods import enum @@ -27,7 +27,7 @@ class Banana(Fruit): def eat_with_condiment(self, fruit_name: str, condiment: Condiment, error: str): # [arguments-differ] print(f"Eating a fruit named {fruit_name} with {condiment}") -class Parent(object): +class Parent: def test(self, arg): return arg + 1 @@ -51,7 +51,7 @@ class Child2(Parent): def kwargs_test(self, *, var1, kw2): #[arguments-differ] print(f"keyword parameters are {var1} and {kw2}.") -class ParentDefaults(object): +class ParentDefaults: def test1(self, arg, barg): print(f"Argument values are {arg} and {barg}") diff --git a/tests/functional/a/assigning/assigning_non_slot.py b/tests/functional/a/assigning/assigning_non_slot.py index d4e9d1d45..6e1fcd255 100644 --- a/tests/functional/a/assigning/assigning_non_slot.py +++ b/tests/functional/a/assigning/assigning_non_slot.py @@ -1,15 +1,15 @@ """ Checks assigning attributes not found in class slots will trigger assigning-non-slot warning. """ -# pylint: disable=too-few-public-methods, missing-docstring, import-error, useless-object-inheritance, redundant-u-string-prefix, unnecessary-dunder-call +# pylint: disable=too-few-public-methods, missing-docstring, import-error, redundant-u-string-prefix, unnecessary-dunder-call from collections import deque from missing import Unknown -class Empty(object): +class Empty: """ empty """ -class Bad(object): +class Bad: """ missing not in slots. """ __slots__ = ['member'] @@ -17,7 +17,7 @@ class Bad(object): def __init__(self): self.missing = 42 # [assigning-non-slot] -class Bad2(object): +class Bad2: """ missing not in slots """ __slots__ = [deque.__name__, 'member'] @@ -45,7 +45,7 @@ class Good(Empty): def __init__(self): self.missing = 42 -class Good2(object): +class Good2: """ Using __dict__ in slots will be safe. """ __slots__ = ['__dict__', 'comp'] @@ -54,7 +54,7 @@ class Good2(object): self.comp = 4 self.missing = 5 -class PropertyGood(object): +class PropertyGood: """ Using properties is safe. """ __slots__ = ['tmp', '_value'] @@ -71,7 +71,7 @@ class PropertyGood(object): def __init__(self): self.test = 42 -class PropertyGood2(object): +class PropertyGood2: """ Using properties in the body of the class is safe. """ __slots__ = ['_value'] @@ -87,7 +87,7 @@ class PropertyGood2(object): def __init__(self): self.test = 24 -class UnicodeSlots(object): +class UnicodeSlots: """Using unicode objects in __slots__ is okay. On Python 3.3 onward, u'' is equivalent to '', @@ -100,7 +100,7 @@ class UnicodeSlots(object): self.second = 24 -class DataDescriptor(object): +class DataDescriptor: def __init__(self, name, default=''): self.__name = name self.__default = default @@ -112,12 +112,12 @@ class DataDescriptor(object): setattr(inst, self.__name, value) -class NonDataDescriptor(object): +class NonDataDescriptor: def __get__(self, inst, cls): return 42 -class SlotsWithDescriptor(object): +class SlotsWithDescriptor: __slots__ = ['_err'] data_descriptor = DataDescriptor('_err') non_data_descriptor = NonDataDescriptor() @@ -132,18 +132,18 @@ def dont_emit_for_descriptors(): inst.non_data_descriptor = 'lala' # [assigning-non-slot] -class ClassWithSlots(object): +class ClassWithSlots: __slots__ = ['foobar'] -class ClassReassigningDunderClass(object): +class ClassReassigningDunderClass: __slots__ = ['foobar'] def release(self): self.__class__ = ClassWithSlots -class ClassReassingingInvalidLayoutClass(object): +class ClassReassingingInvalidLayoutClass: __slots__ = [] def release(self): @@ -175,7 +175,7 @@ class Cls(Generic[TYPE]): self.value = value -class ClassDefiningSetattr(object): +class ClassDefiningSetattr: __slots__ = ["foobar"] def __init__(self): diff --git a/tests/functional/a/assignment/assignment_from_no_return_2.py b/tests/functional/a/assignment/assignment_from_no_return_2.py index fd1489dbc..f42b66545 100644 --- a/tests/functional/a/assignment/assignment_from_no_return_2.py +++ b/tests/functional/a/assignment/assignment_from_no_return_2.py @@ -1,4 +1,4 @@ -# pylint: disable=useless-return, useless-object-inheritance, condition-evals-to-constant +# pylint: disable=useless-return, condition-evals-to-constant """check assignment to function call where the function doesn't return 'E1111': ('Assigning to function call which doesn\'t return', @@ -9,7 +9,6 @@ inferred function returns nothing but None.'), """ -from __future__ import generators, print_function def func_no_return(): """function without return""" @@ -50,7 +49,7 @@ def generator(): A = generator() -class Abstract(object): +class Abstract: """bla bla""" def abstract_method(self): diff --git a/tests/functional/a/assignment/assignment_from_no_return_2.txt b/tests/functional/a/assignment/assignment_from_no_return_2.txt index b6aec14da..bc1fff92b 100644 --- a/tests/functional/a/assignment/assignment_from_no_return_2.txt +++ b/tests/functional/a/assignment/assignment_from_no_return_2.txt @@ -1,4 +1,4 @@ -assignment-from-no-return:18:0:18:20::Assigning result of a function call, where the function has no return:UNDEFINED -assignment-from-none:26:0:26:22::Assigning result of a function call, where the function returns None:UNDEFINED -assignment-from-none:33:0:33:31::Assigning result of a function call, where the function returns None:UNDEFINED -assignment-from-none:36:0:36:14::Assigning result of a function call, where the function returns None:INFERENCE +assignment-from-no-return:17:0:17:20::Assigning result of a function call, where the function has no return:UNDEFINED +assignment-from-none:25:0:25:22::Assigning result of a function call, where the function returns None:UNDEFINED +assignment-from-none:32:0:32:31::Assigning result of a function call, where the function returns None:UNDEFINED +assignment-from-none:35:0:35:14::Assigning result of a function call, where the function returns None:INFERENCE diff --git a/tests/functional/a/async_functions.py b/tests/functional/a/async_functions.py index e2b005f28..315055e9c 100644 --- a/tests/functional/a/async_functions.py +++ b/tests/functional/a/async_functions.py @@ -1,6 +1,6 @@ """Check that Python 3.5's async functions are properly analyzed by Pylint.""" # pylint: disable=missing-docstring,invalid-name,too-few-public-methods -# pylint: disable=using-constant-test, useless-object-inheritance +# pylint: disable=using-constant-test async def next(): # [redefined-builtin] pass @@ -9,14 +9,14 @@ async def some_function(arg1, arg2): # [unused-argument] await arg1 -class OtherClass(object): +class OtherClass: @staticmethod def test(): return 42 -class Class(object): +class Class: async def some_method(self): super(OtherClass, self).test() # [bad-super-call] diff --git a/tests/functional/a/attribute_defined_outside_init.py b/tests/functional/a/attribute_defined_outside_init.py index 1cb319c61..0b6f1ef49 100644 --- a/tests/functional/a/attribute_defined_outside_init.py +++ b/tests/functional/a/attribute_defined_outside_init.py @@ -1,6 +1,6 @@ -# pylint: disable=missing-docstring,too-few-public-methods,invalid-name, useless-object-inheritance +# pylint: disable=missing-docstring,too-few-public-methods,invalid-name -class A(object): +class A: def __init__(self): self.x = 0 @@ -26,7 +26,7 @@ class B(A): self.z = 44 # [attribute-defined-outside-init] -class C(object): +class C: def __init__(self): self._init() @@ -35,7 +35,7 @@ class C(object): self.z = 44 -class D(object): +class D: def setUp(self): self.set_z() @@ -44,7 +44,7 @@ class D(object): self.z = 42 -class E(object): +class E: def __init__(self): i = self._init @@ -54,7 +54,7 @@ class E(object): self.z = 44 -class Mixin(object): +class Mixin: def test_mixin(self): """Don't emit attribute-defined-outside-init for mixin classes.""" diff --git a/tests/functional/b/bad_exception_cause.py b/tests/functional/b/bad_exception_cause.py index 0e876a073..fd9a9cca0 100644 --- a/tests/functional/b/bad_exception_cause.py +++ b/tests/functional/b/bad_exception_cause.py @@ -4,7 +4,6 @@ import socket, unknown -__revision__ = 0 class ExceptionSubclass(Exception): """ subclass """ diff --git a/tests/functional/b/bad_exception_cause.txt b/tests/functional/b/bad_exception_cause.txt index 63395b03c..ef8ce8831 100644 --- a/tests/functional/b/bad_exception_cause.txt +++ b/tests/functional/b/bad_exception_cause.txt @@ -1,5 +1,5 @@ -bad-exception-cause:14:4:14:27:test:Exception cause set to something which is not an exception, nor None:INFERENCE -bad-exception-cause:17:4:17:34:test:Exception cause set to something which is not an exception, nor None:INFERENCE -bad-exception-cause:23:4:23:36:test:Exception cause set to something which is not an exception, nor None:INFERENCE -catching-non-exception:31:7:31:15::"Catching an exception which doesn't inherit from Exception: function":UNDEFINED -bad-exception-cause:32:4:32:28::Exception cause set to something which is not an exception, nor None:INFERENCE +bad-exception-cause:13:4:13:27:test:Exception cause set to something which is not an exception, nor None:INFERENCE +bad-exception-cause:16:4:16:34:test:Exception cause set to something which is not an exception, nor None:INFERENCE +bad-exception-cause:22:4:22:36:test:Exception cause set to something which is not an exception, nor None:INFERENCE +catching-non-exception:30:7:30:15::"Catching an exception which doesn't inherit from Exception: function":UNDEFINED +bad-exception-cause:31:4:31:28::Exception cause set to something which is not an exception, nor None:INFERENCE diff --git a/tests/functional/b/bad_indentation.py b/tests/functional/b/bad_indentation.py index 4c50eae0b..3b38347e4 100644 --- a/tests/functional/b/bad_indentation.py +++ b/tests/functional/b/bad_indentation.py @@ -1,5 +1,4 @@ # pylint: disable=missing-docstring, pointless-statement -from __future__ import print_function def totoo(): diff --git a/tests/functional/b/bad_indentation.txt b/tests/functional/b/bad_indentation.txt index ac9f2cbd8..2e96434b1 100644 --- a/tests/functional/b/bad_indentation.txt +++ b/tests/functional/b/bad_indentation.txt @@ -1,2 +1,2 @@ -bad-indentation:6:0:None:None::Bad indentation. Found 1 spaces, expected 4:UNDEFINED -bad-indentation:12:0:None:None::Bad indentation. Found 5 spaces, expected 4:UNDEFINED +bad-indentation:5:0:None:None::Bad indentation. Found 1 spaces, expected 4:UNDEFINED +bad-indentation:11:0:None:None::Bad indentation. Found 5 spaces, expected 4:UNDEFINED diff --git a/tests/functional/b/bad_reversed_sequence.py b/tests/functional/b/bad_reversed_sequence.py index 791823154..c4380491e 100644 --- a/tests/functional/b/bad_reversed_sequence.py +++ b/tests/functional/b/bad_reversed_sequence.py @@ -1,16 +1,16 @@ """ Checks that reversed() receive proper argument """ -# pylint: disable=missing-docstring, useless-object-inheritance +# pylint: disable=missing-docstring # pylint: disable=too-few-public-methods from collections import deque, OrderedDict from enum import IntEnum -class GoodReversed(object): +class GoodReversed: """ Implements __reversed__ """ def __reversed__(self): return [1, 2, 3] -class SecondGoodReversed(object): +class SecondGoodReversed: """ Implements __len__ and __getitem__ """ def __len__(self): return 3 @@ -18,12 +18,12 @@ class SecondGoodReversed(object): def __getitem__(self, index): return index -class BadReversed(object): +class BadReversed: """ implements only len() """ def __len__(self): return 3 -class SecondBadReversed(object): +class SecondBadReversed: """ implements only __getitem__ """ def __getitem__(self, index): return index diff --git a/tests/functional/b/bad_staticmethod_argument.py b/tests/functional/b/bad_staticmethod_argument.py index e73bf3dcd..846058d55 100644 --- a/tests/functional/b/bad_staticmethod_argument.py +++ b/tests/functional/b/bad_staticmethod_argument.py @@ -1,6 +1,6 @@ -# pylint: disable=missing-docstring, no-staticmethod-decorator, useless-object-inheritance +# pylint: disable=missing-docstring, no-staticmethod-decorator -class Abcd(object): +class Abcd: def method1(self): # [bad-staticmethod-argument] pass diff --git a/tests/functional/b/base_init_vars.py b/tests/functional/b/base_init_vars.py index d103aa968..c2c25baab 100644 --- a/tests/functional/b/base_init_vars.py +++ b/tests/functional/b/base_init_vars.py @@ -1,8 +1,8 @@ -# pylint:disable=too-few-public-methods, useless-object-inheritance +# pylint:disable=too-few-public-methods """Checks that class variables are seen as inherited !""" -class BaseClass(object): +class BaseClass: """A simple base class """ diff --git a/tests/functional/b/broad_except.py b/tests/functional/b/broad_except.py index 24c839951..b38b6f8dc 100644 --- a/tests/functional/b/broad_except.py +++ b/tests/functional/b/broad_except.py @@ -1,5 +1,4 @@ # pylint: disable=missing-docstring -from __future__ import print_function __revision__ = 0 try: diff --git a/tests/functional/b/broad_except.txt b/tests/functional/b/broad_except.txt index 55fce74ca..9a795d3c6 100644 --- a/tests/functional/b/broad_except.txt +++ b/tests/functional/b/broad_except.txt @@ -1,2 +1,2 @@ -broad-except:7:7:7:16::Catching too general exception Exception:UNDEFINED -broad-except:13:7:13:20::Catching too general exception BaseException:UNDEFINED +broad-except:6:7:6:16::Catching too general exception Exception:UNDEFINED +broad-except:12:7:12:20::Catching too general exception BaseException:UNDEFINED diff --git a/tests/functional/b/builtin_module_test.py b/tests/functional/b/builtin_module_test.py index 9b1e7ce8e..ae59217a0 100644 --- a/tests/functional/b/builtin_module_test.py +++ b/tests/functional/b/builtin_module_test.py @@ -3,8 +3,6 @@ from __future__ import absolute_import from math import log10 -__revision__ = None - def log10_2(): """bla bla bla""" diff --git a/tests/functional/c/cellvar_escaping_loop.py b/tests/functional/c/cellvar_escaping_loop.py index 0de26bede..8781e6c5c 100644 --- a/tests/functional/c/cellvar_escaping_loop.py +++ b/tests/functional/c/cellvar_escaping_loop.py @@ -1,6 +1,6 @@ # pylint: disable=unnecessary-comprehension,missing-docstring,too-few-public-methods,unnecessary-direct-lambda-call """Tests for loopvar-in-closure.""" -from __future__ import print_function + from enum import Enum diff --git a/tests/functional/c/class_attributes.py b/tests/functional/c/class_attributes.py index 1d41f9d7a..ea3858876 100644 --- a/tests/functional/c/class_attributes.py +++ b/tests/functional/c/class_attributes.py @@ -1,8 +1,8 @@ """Test that valid class attribute doesn't trigger errors""" -__revision__ = 'sponge bob' -# pylint: disable=useless-object-inheritance,missing-docstring,too-few-public-methods +# pylint: disable=missing-docstring,too-few-public-methods -class Clazz(object): + +class Clazz: "dummy class" def __init__(self): diff --git a/tests/functional/c/class_members_py30.py b/tests/functional/c/class_members_py30.py index afaee5872..0d65331f9 100644 --- a/tests/functional/c/class_members_py30.py +++ b/tests/functional/c/class_members_py30.py @@ -1,7 +1,7 @@ """ Various tests for class members access. """
-# pylint: disable=too-few-public-methods,import-error,missing-docstring, wrong-import-position,wrong-import-order, useless-object-inheritance, unnecessary-dunder-call
+# pylint: disable=too-few-public-methods,import-error,missing-docstring, wrong-import-position,wrong-import-order, unnecessary-dunder-call
from missing import Missing
-class MyClass(object):
+class MyClass:
"""class docstring"""
def __init__(self):
@@ -16,7 +16,7 @@ class MyClass(object): self.nonexistent1.truc() # [no-member]
self.nonexistent2[1] = 'hehe' # [no-member]
-class XYZMixin(object):
+class XYZMixin:
"""access to undefined members should be ignored in mixin classes by
default
"""
@@ -24,14 +24,14 @@ class XYZMixin(object): print(self.nonexistent)
-class NewClass(object):
+class NewClass:
"""use object.__setattr__"""
def __init__(self):
self.__setattr__('toto', 'tutu')
from abc import ABCMeta
-class TestMetaclass(object, metaclass=ABCMeta):
+class TestMetaclass(metaclass=ABCMeta):
""" Test attribute access for metaclasses. """
class Metaclass(type):
@@ -40,7 +40,7 @@ class Metaclass(type): def test(cls):
""" classmethod """
-class UsingMetaclass(object, metaclass=Metaclass):
+class UsingMetaclass(metaclass=Metaclass):
""" empty """
TestMetaclass.register(int)
@@ -55,7 +55,7 @@ class NoKnownBases(Missing): NoKnownBases().lalala()
-class MetaClass(object):
+class MetaClass:
"""Look some methods in the implicit metaclass."""
@classmethod
diff --git a/tests/functional/c/class_scope.py b/tests/functional/c/class_scope.py index 74db27443..85ee86fbf 100644 --- a/tests/functional/c/class_scope.py +++ b/tests/functional/c/class_scope.py @@ -1,9 +1,8 @@ -# pylint: disable=too-few-public-methods, useless-object-inheritance, unnecessary-lambda-assignment +# pylint: disable=too-few-public-methods, unnecessary-lambda-assignment """check for scope problems""" -__revision__ = None -class Well(object): +class Well: """well""" attr = 42 get_attr = lambda arg=attr: arg * 24 @@ -13,7 +12,7 @@ class Well(object): bad_lambda = lambda: get_attr_bad # [undefined-variable] bad_gen = list(attr + i for i in range(10)) # [undefined-variable] - class Data(object): + class Data: """base hidden class""" class Sub(Data): """whaou, is Data found???""" diff --git a/tests/functional/c/class_scope.txt b/tests/functional/c/class_scope.txt index d065c1b97..081387a22 100644 --- a/tests/functional/c/class_scope.txt +++ b/tests/functional/c/class_scope.txt @@ -1,7 +1,7 @@ -undefined-variable:11:39:11:46:Well.<lambda>:Undefined variable 'revattr':UNDEFINED -used-before-assignment:11:30:11:37:Well.<lambda>:Using variable 'revattr' before assignment:HIGH -undefined-variable:13:25:13:37:Well.<lambda>:Undefined variable 'get_attr_bad':UNDEFINED -undefined-variable:14:19:14:23:Well:Undefined variable 'attr':UNDEFINED -undefined-variable:20:15:20:19:Well.Sub:Undefined variable 'Data':UNDEFINED -undefined-variable:23:15:23:18:Well.func:Undefined variable 'Sub':UNDEFINED -undefined-variable:41:22:41:26:Wrong.work:Undefined variable 'self':UNDEFINED +undefined-variable:10:39:10:46:Well.<lambda>:Undefined variable 'revattr':UNDEFINED +used-before-assignment:10:30:10:37:Well.<lambda>:Using variable 'revattr' before assignment:HIGH +undefined-variable:12:25:12:37:Well.<lambda>:Undefined variable 'get_attr_bad':UNDEFINED +undefined-variable:13:19:13:23:Well:Undefined variable 'attr':UNDEFINED +undefined-variable:19:15:19:19:Well.Sub:Undefined variable 'Data':UNDEFINED +undefined-variable:22:15:22:18:Well.func:Undefined variable 'Sub':UNDEFINED +undefined-variable:40:22:40:26:Wrong.work:Undefined variable 'self':UNDEFINED diff --git a/tests/functional/c/classes_meth_could_be_a_function.py b/tests/functional/c/classes_meth_could_be_a_function.py index 4a967a5b5..82f627dfb 100644 --- a/tests/functional/c/classes_meth_could_be_a_function.py +++ b/tests/functional/c/classes_meth_could_be_a_function.py @@ -1,20 +1,20 @@ -# pylint: disable=missing-docstring,too-few-public-methods,useless-object-inheritance +# pylint: disable=missing-docstring,too-few-public-methods """ #2479 R0201 (formerly W0212), Method could be a function shouldn't be emitted in case like factory method pattern """ -__revision__ = 1 -class XAsub(object): + +class XAsub: pass class XBsub(XAsub): pass class XCsub(XAsub): pass -class Aimpl(object): +class Aimpl: # 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 diff --git a/tests/functional/c/classes_protected_member_access.py b/tests/functional/c/classes_protected_member_access.py index 516efd7d4..fe540be85 100644 --- a/tests/functional/c/classes_protected_member_access.py +++ b/tests/functional/c/classes_protected_member_access.py @@ -1,10 +1,10 @@ """ #3123: W0212 false positive on static method """ -__revision__ = 1 -# pylint: disable=no-classmethod-decorator, no-staticmethod-decorator, useless-object-inheritance -class A3123(object): + +# pylint: disable=no-classmethod-decorator, no-staticmethod-decorator +class A3123: """oypuee""" _protected = 1 def __init__(self): diff --git a/tests/functional/c/comparison_with_callable.py b/tests/functional/c/comparison_with_callable.py index 777594d75..1e8ea5d90 100644 --- a/tests/functional/c/comparison_with_callable.py +++ b/tests/functional/c/comparison_with_callable.py @@ -1,4 +1,4 @@ -# pylint: disable = disallowed-name, missing-docstring, useless-return, invalid-name, line-too-long, useless-object-inheritance, comparison-of-constants +# pylint: disable = disallowed-name, missing-docstring, useless-return, invalid-name, line-too-long, comparison-of-constants def foo(): return None @@ -18,7 +18,7 @@ if foo() == goo(): pass -class FakeClass(object): +class FakeClass: def __init__(self): self._fake_prop = 'fake it till you make it!!' diff --git a/tests/functional/c/confidence_filter.py b/tests/functional/c/confidence_filter.py index 42351998d..5f8dfd4f0 100644 --- a/tests/functional/c/confidence_filter.py +++ b/tests/functional/c/confidence_filter.py @@ -1,8 +1,7 @@ """Test for the confidence filter.""" -from __future__ import print_function -# pylint: disable=useless-object-inheritance -class Client(object): + +class Client: """use provider class""" def __init__(self): diff --git a/tests/functional/c/confidence_filter.txt b/tests/functional/c/confidence_filter.txt index 86a0f28c4..ede967f68 100644 --- a/tests/functional/c/confidence_filter.txt +++ b/tests/functional/c/confidence_filter.txt @@ -1 +1 @@ -no-member:16:6:16:18::Instance of 'Client' has no 'foo' member:INFERENCE +no-member:15:6:15:18::Instance of 'Client' has no 'foo' member:INFERENCE diff --git a/tests/functional/c/consider/consider_iterating_dictionary.py b/tests/functional/c/consider/consider_iterating_dictionary.py index 149810042..fdb76e869 100644 --- a/tests/functional/c/consider/consider_iterating_dictionary.py +++ b/tests/functional/c/consider/consider_iterating_dictionary.py @@ -1,11 +1,11 @@ # pylint: disable=missing-docstring, expression-not-assigned, too-few-public-methods -# pylint: disable=no-member, import-error, line-too-long, useless-object-inheritance +# pylint: disable=no-member, import-error, line-too-long # pylint: disable=unnecessary-comprehension, use-dict-literal, use-implicit-booleaness-not-comparison from unknown import Unknown -class CustomClass(object): +class CustomClass: def keys(self): return [] diff --git a/tests/functional/c/consider/consider_using_enumerate.py b/tests/functional/c/consider/consider_using_enumerate.py index 359bb29fa..352669f6a 100644 --- a/tests/functional/c/consider/consider_using_enumerate.py +++ b/tests/functional/c/consider/consider_using_enumerate.py @@ -1,6 +1,6 @@ """Emit a message for iteration through range and len is encountered."""
-# pylint: disable=missing-docstring, import-error, useless-object-inheritance, unsubscriptable-object, too-few-public-methods, unnecessary-list-index-lookup
+# pylint: disable=missing-docstring, import-error, unsubscriptable-object, too-few-public-methods, unnecessary-list-index-lookup
def bad():
iterable = [1, 2, 3]
@@ -10,7 +10,7 @@ def bad(): yield iterable[obj]
-class Bad(object):
+class Bad:
def __iter__(self):
iterable = [1, 2, 3]
@@ -60,7 +60,7 @@ def good(): yield test([1, 2, 3])
-class Good(object):
+class Good:
def __iter__(self):
# Should not suggest enumerate on self
@@ -74,7 +74,7 @@ def does_not_crash_on_range_without_args(): # False negative described in #3657
# https://github.com/PyCQA/pylint/issues/3657
-class MyClass(object):
+class MyClass:
def __init__(self):
self.my_list = []
diff --git a/tests/functional/c/crash_missing_module_type.py b/tests/functional/c/crash_missing_module_type.py index d80d27afc..94b9af6ec 100644 --- a/tests/functional/c/crash_missing_module_type.py +++ b/tests/functional/c/crash_missing_module_type.py @@ -1,12 +1,12 @@ """ Test for a crash found in
https://bitbucket.org/logilab/astroid/issue/45/attributeerror-module-object-has-no#comment-11944673
"""
-# pylint: disable=invalid-name, too-few-public-methods, redefined-outer-name, useless-object-inheritance
+# pylint: disable=invalid-name, too-few-public-methods, redefined-outer-name
def decor(trop):
""" decorator """
return trop
-class Foo(object):
+class Foo:
""" Class """
@decor
def prop(self):
diff --git a/tests/functional/c/ctor_arguments.py b/tests/functional/c/ctor_arguments.py index ee10413e3..954d9b8b2 100644 --- a/tests/functional/c/ctor_arguments.py +++ b/tests/functional/c/ctor_arguments.py @@ -2,18 +2,18 @@ Based on tests/functional/a/arguments.py """ -# pylint: disable=missing-docstring,too-few-public-methods,super-init-not-called,useless-object-inheritance +# pylint: disable=missing-docstring,too-few-public-methods,super-init-not-called -class Class1Arg(object): +class Class1Arg: def __init__(self, first_argument): """one argument function""" -class Class3Arg(object): +class Class3Arg: def __init__(self, first_argument, second_argument, third_argument): """three arguments function""" -class ClassDefaultArg(object): +class ClassDefaultArg: def __init__(self, one=1, two=2): """function with default value""" @@ -27,7 +27,7 @@ class ClassAllArgs(Class1Arg): class ClassMultiInheritance(Class1Arg, Class3Arg): pass -class ClassNew(object): +class ClassNew: def __new__(cls, first_argument, kwarg=None): return first_argument, kwarg @@ -85,7 +85,7 @@ class BuiltinExc(Exception): BuiltinExc(42, 24, badarg=1) # [too-many-function-args,unexpected-keyword-arg] -class Clsmethod(object): +class Clsmethod: def __init__(self, first, second): self.first = first self.second = second diff --git a/tests/functional/d/decorator_scope.py b/tests/functional/d/decorator_scope.py index 2f6d037c6..f499e15db 100644 --- a/tests/functional/d/decorator_scope.py +++ b/tests/functional/d/decorator_scope.py @@ -1,4 +1,4 @@ -# -*- pylint: disable=too-few-public-methods, useless-object-inheritance, unnecessary-lambda-assignment +# -*- pylint: disable=too-few-public-methods, unnecessary-lambda-assignment """Test that decorators sees the class namespace - just like function default values does but function body doesn't. @@ -6,9 +6,8 @@ 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): +class Test: """test class""" ident = lambda x: x diff --git a/tests/functional/d/defined_and_used_on_same_line.py b/tests/functional/d/defined_and_used_on_same_line.py index e7d1ab3e4..bec45419c 100644 --- a/tests/functional/d/defined_and_used_on_same_line.py +++ b/tests/functional/d/defined_and_used_on_same_line.py @@ -1,6 +1,6 @@ """Check for definitions and usage happening on the same line.""" #pylint: disable=missing-docstring,multiple-statements,wrong-import-position,unnecessary-comprehension,unspecified-encoding,unnecessary-lambda-assignment -from __future__ import print_function + print([index for index in range(10)]) diff --git a/tests/functional/d/docstrings.py b/tests/functional/d/docstrings.py index b9827ef96..f86c702ce 100644 --- a/tests/functional/d/docstrings.py +++ b/tests/functional/d/docstrings.py @@ -1,6 +1,5 @@ -# pylint: disable=useless-object-inheritance, unnecessary-pass, consider-using-f-string
+# pylint: disable=unnecessary-pass, consider-using-f-string
# -1: [missing-module-docstring]
-from __future__ import print_function
# +1: [empty-docstring]
def function0():
@@ -20,7 +19,7 @@ def function3(value): print(value)
# +1: [missing-class-docstring]
-class AAAA(object):
+class AAAA:
# missing docstring
## class BBBB:
diff --git a/tests/functional/d/docstrings.txt b/tests/functional/d/docstrings.txt index d1e21f7af..b66920fc8 100644 --- a/tests/functional/d/docstrings.txt +++ b/tests/functional/d/docstrings.txt @@ -1,8 +1,8 @@ missing-module-docstring:1:0:None:None::Missing module docstring:HIGH -empty-docstring:6:0:6:13:function0:Empty function docstring:HIGH -missing-function-docstring:10:0:10:13:function1:Missing function or method docstring:HIGH -missing-class-docstring:23:0:23:10:AAAA:Missing class docstring:HIGH -missing-function-docstring:40:4:40:15:AAAA.method1:Missing function or method docstring:INFERENCE -empty-docstring:48:4:48:15:AAAA.method3:Empty method docstring:INFERENCE -empty-docstring:62:4:62:15:DDDD.method2:Empty method docstring:INFERENCE -missing-function-docstring:70:4:70:15:DDDD.method4:Missing function or method docstring:INFERENCE +empty-docstring:5:0:5:13:function0:Empty function docstring:HIGH +missing-function-docstring:9:0:9:13:function1:Missing function or method docstring:HIGH +missing-class-docstring:22:0:22:10:AAAA:Missing class docstring:HIGH +missing-function-docstring:39:4:39:15:AAAA.method1:Missing function or method docstring:INFERENCE +empty-docstring:47:4:47:15:AAAA.method3:Empty method docstring:INFERENCE +empty-docstring:61:4:61:15:DDDD.method2:Empty method docstring:INFERENCE +missing-function-docstring:69:4:69:15:DDDD.method4:Missing function or method docstring:INFERENCE diff --git a/tests/functional/e/e1101_9588_base_attr_aug_assign.py b/tests/functional/e/e1101_9588_base_attr_aug_assign.py index 7306840cb..9fe95fd4b 100644 --- a/tests/functional/e/e1101_9588_base_attr_aug_assign.py +++ b/tests/functional/e/e1101_9588_base_attr_aug_assign.py @@ -1,4 +1,4 @@ -# pylint: disable=too-few-public-methods, useless-object-inheritance +# pylint: disable=too-few-public-methods """ False positive case of E1101: @@ -7,9 +7,9 @@ modified with augmented assignment in a derived class. https://www.logilab.org/ticket/9588 """ -__revision__ = 0 -class BaseClass(object): + +class BaseClass: "The base class" def __init__(self): "Set an attribute." diff --git a/tests/functional/e/exception_is_binary_op.py b/tests/functional/e/exception_is_binary_op.py index f71163d1f..6840d820d 100644 --- a/tests/functional/e/exception_is_binary_op.py +++ b/tests/functional/e/exception_is_binary_op.py @@ -1,5 +1,5 @@ """Warn about binary operations used as exceptions.""" -from __future__ import print_function + try: pass except Exception or BaseException: # [binary-op-exception] diff --git a/tests/functional/e/excess_escapes.py b/tests/functional/e/excess_escapes.py index d680c2b5e..75836572c 100644 --- a/tests/functional/e/excess_escapes.py +++ b/tests/functional/e/excess_escapes.py @@ -2,7 +2,6 @@ """Stray backslash escapes may be missing a raw-string prefix.""" # pylint: disable=redundant-u-string-prefix -__revision__ = '$Id$' # Bad escape sequences, which probably don't do what you expect. A = "\[\]\\" # [anomalous-backslash-in-string,anomalous-backslash-in-string] diff --git a/tests/functional/e/excess_escapes.txt b/tests/functional/e/excess_escapes.txt index 1555d8ebb..c9446828f 100644 --- a/tests/functional/e/excess_escapes.txt +++ b/tests/functional/e/excess_escapes.txt @@ -1,9 +1,9 @@ -anomalous-backslash-in-string:8:5:None:None::"Anomalous backslash in string: '\['. String constant might be missing an r prefix.":UNDEFINED -anomalous-backslash-in-string:8:7:None:None::"Anomalous backslash in string: '\]'. String constant might be missing an r prefix.":UNDEFINED -anomalous-backslash-in-string:9:8:None:None::"Anomalous backslash in string: '\/'. String constant might be missing an r prefix.":UNDEFINED -anomalous-backslash-in-string:10:20:None:None::"Anomalous backslash in string: '\`'. String constant might be missing an r prefix.":UNDEFINED -anomalous-backslash-in-string:17:15:None:None::"Anomalous backslash in string: '\o'. String constant might be missing an r prefix.":UNDEFINED -anomalous-backslash-in-string:17:20:None:None::"Anomalous backslash in string: '\o'. String constant might be missing an r prefix.":UNDEFINED -anomalous-backslash-in-string:19:13:None:None::"Anomalous backslash in string: '\8'. String constant might be missing an r prefix.":UNDEFINED -anomalous-backslash-in-string:19:17:None:None::"Anomalous backslash in string: '\9'. String constant might be missing an r prefix.":UNDEFINED -anomalous-backslash-in-string:32:42:None:None::"Anomalous backslash in string: '\P'. String constant might be missing an r prefix.":UNDEFINED +anomalous-backslash-in-string:7:5:None:None::"Anomalous backslash in string: '\['. String constant might be missing an r prefix.":UNDEFINED +anomalous-backslash-in-string:7:7:None:None::"Anomalous backslash in string: '\]'. String constant might be missing an r prefix.":UNDEFINED +anomalous-backslash-in-string:8:8:None:None::"Anomalous backslash in string: '\/'. String constant might be missing an r prefix.":UNDEFINED +anomalous-backslash-in-string:9:20:None:None::"Anomalous backslash in string: '\`'. String constant might be missing an r prefix.":UNDEFINED +anomalous-backslash-in-string:16:15:None:None::"Anomalous backslash in string: '\o'. String constant might be missing an r prefix.":UNDEFINED +anomalous-backslash-in-string:16:20:None:None::"Anomalous backslash in string: '\o'. String constant might be missing an r prefix.":UNDEFINED +anomalous-backslash-in-string:18:13:None:None::"Anomalous backslash in string: '\8'. String constant might be missing an r prefix.":UNDEFINED +anomalous-backslash-in-string:18:17:None:None::"Anomalous backslash in string: '\9'. String constant might be missing an r prefix.":UNDEFINED +anomalous-backslash-in-string:31:42:None:None::"Anomalous backslash in string: '\P'. String constant might be missing an r prefix.":UNDEFINED diff --git a/tests/functional/e/exec_used.py b/tests/functional/e/exec_used.py index 5f849480e..4f7e3b8cc 100644 --- a/tests/functional/e/exec_used.py +++ b/tests/functional/e/exec_used.py @@ -1,6 +1,6 @@ # pylint: disable=missing-docstring -exec('a = __revision__') # [exec-used] +exec('a = 42') # [exec-used] exec('a = 1', globals={}) # [exec-used] exec('a = 1', globals=globals()) # [exec-used] diff --git a/tests/functional/e/exec_used.txt b/tests/functional/e/exec_used.txt index d25bcfd28..964a1fd16 100644 --- a/tests/functional/e/exec_used.txt +++ b/tests/functional/e/exec_used.txt @@ -1,4 +1,4 @@ -exec-used:3:0:3:24::Use of exec:UNDEFINED +exec-used:3:0:3:14::Use of exec:UNDEFINED exec-used:4:0:4:25::Use of exec:UNDEFINED exec-used:6:0:6:32::Use of exec:UNDEFINED exec-used:9:4:9:17:func:Use of exec:UNDEFINED diff --git a/tests/functional/e/external_classmethod_crash.py b/tests/functional/e/external_classmethod_crash.py index c24bbd872..5e3e0f171 100644 --- a/tests/functional/e/external_classmethod_crash.py +++ b/tests/functional/e/external_classmethod_crash.py @@ -1,4 +1,4 @@ -# pylint: disable=too-few-public-methods,unused-argument,useless-object-inheritance +# pylint: disable=too-few-public-methods,unused-argument """tagging a function as a class method cause a crash when checking for signature overriding """ @@ -14,8 +14,6 @@ def fetch_config(mainattr=None): fetch_order = classmethod(fetch_order) return fetch_order -class Aaa(object): +class Aaa: """hop""" fetch_order = fetch_config('A') - -__revision__ = None diff --git a/tests/functional/ext/comparison_placement/misplaced_comparison_constant.py b/tests/functional/ext/comparison_placement/misplaced_comparison_constant.py index 0d0296742..82751f2b2 100644 --- a/tests/functional/ext/comparison_placement/misplaced_comparison_constant.py +++ b/tests/functional/ext/comparison_placement/misplaced_comparison_constant.py @@ -1,9 +1,9 @@ """Check that the constants are on the right side of the comparisons""" -# pylint: disable=singleton-comparison, missing-docstring, too-few-public-methods, useless-object-inheritance +# pylint: disable=singleton-comparison, missing-docstring, too-few-public-methods # pylint: disable=comparison-of-constants -class MyClass(object): +class MyClass: def __init__(self): self.attr = 1 diff --git a/tests/functional/ext/mccabe/mccabe.py b/tests/functional/ext/mccabe/mccabe.py index e57d13e2e..e3d11c5c8 100644 --- a/tests/functional/ext/mccabe/mccabe.py +++ b/tests/functional/ext/mccabe/mccabe.py @@ -1,6 +1,6 @@ # pylint: disable=invalid-name,unnecessary-pass,no-else-return,useless-else-on-loop # pylint: disable=undefined-variable,consider-using-sys-exit,unused-variable,too-many-return-statements -# pylint: disable=redefined-outer-name,useless-object-inheritance,using-constant-test,unused-argument +# pylint: disable=redefined-outer-name,using-constant-test,unused-argument # pylint: disable=broad-except, not-context-manager, no-method-argument, unspecified-encoding """Checks use of "too-complex" check""" @@ -130,7 +130,7 @@ def f10(): # [too-complex] return myint -class MyClass1(object): +class MyClass1: """Class of example to test mccabe""" _name = "MyClass" # To force a tail.node=None diff --git a/tests/functional/ext/no_self_use/no_self_use.py b/tests/functional/ext/no_self_use/no_self_use.py index dfe3f6f35..d362a1d3e 100644 --- a/tests/functional/ext/no_self_use/no_self_use.py +++ b/tests/functional/ext/no_self_use/no_self_use.py @@ -1,10 +1,10 @@ -# pylint: disable=too-few-public-methods,missing-docstring,useless-object-inheritance,invalid-name +# pylint: disable=too-few-public-methods,missing-docstring,invalid-name """test detection of method which could be a function""" from abc import ABC, abstractmethod from typing import Protocol, overload -class Toto(object): +class Toto: """bla bal abl""" def __init__(self): @@ -26,7 +26,7 @@ class Toto(object): """this async method isn't a real method since it doesn't need self""" print('hello') -class Base(object): +class Base: """an abstract class""" def __init__(self): @@ -46,7 +46,7 @@ class Sub(Base): """ return arg == 0 -class Super(object): +class Super: """same as before without abstract""" attr = 1 def method(self): @@ -74,7 +74,7 @@ class Sub1(Super): return 42 -class Prop(object): +class Prop: @property def count(self): diff --git a/tests/functional/ext/redefined_loop_name/reused_outer_loop_variable.py b/tests/functional/ext/redefined_loop_name/reused_outer_loop_variable.py index 1a6274976..4b64ebe46 100644 --- a/tests/functional/ext/redefined_loop_name/reused_outer_loop_variable.py +++ b/tests/functional/ext/redefined_loop_name/reused_outer_loop_variable.py @@ -1,6 +1,5 @@ """Tests for redefining an outer loop variable.""" -from __future__ import print_function -__revision__ = 0 + # Simple nested loop for i in range(10): diff --git a/tests/functional/ext/redefined_loop_name/reused_outer_loop_variable.txt b/tests/functional/ext/redefined_loop_name/reused_outer_loop_variable.txt index ea26e01d1..055bd4aa5 100644 --- a/tests/functional/ext/redefined_loop_name/reused_outer_loop_variable.txt +++ b/tests/functional/ext/redefined_loop_name/reused_outer_loop_variable.txt @@ -1,5 +1,5 @@ -redefined-loop-name:7:4:8:16::Redefining 'i' from loop (line 6):HIGH -redefined-loop-name:12:4:13:25::Redefining 'i' from loop (line 11):HIGH -redefined-loop-name:17:4:18:25::Redefining 'i' from loop (line 16):HIGH -redefined-loop-name:22:4:23:25::Redefining 'a' from loop (line 21):HIGH -redefined-loop-name:41:4:42:16::Redefining 'j' from loop (line 40):HIGH +redefined-loop-name:6:4:7:16::Redefining 'i' from loop (line 5):HIGH +redefined-loop-name:11:4:12:25::Redefining 'i' from loop (line 10):HIGH +redefined-loop-name:16:4:17:25::Redefining 'i' from loop (line 15):HIGH +redefined-loop-name:21:4:22:25::Redefining 'a' from loop (line 20):HIGH +redefined-loop-name:40:4:41:16::Redefining 'j' from loop (line 39):HIGH diff --git a/tests/functional/ext/redefined_variable_type/redefined_variable_type.py b/tests/functional/ext/redefined_variable_type/redefined_variable_type.py index aa89383d9..7cd14b81e 100644 --- a/tests/functional/ext/redefined_variable_type/redefined_variable_type.py +++ b/tests/functional/ext/redefined_variable_type/redefined_variable_type.py @@ -1,12 +1,12 @@ """Checks variable types aren't redefined within a method or a function""" -# pylint: disable=too-few-public-methods,missing-docstring,unused-variable,invalid-name, useless-object-inheritance +# pylint: disable=too-few-public-methods,missing-docstring,unused-variable,invalid-name _OK = True -class MyClass(object): +class MyClass: - class Klass(object): + class Klass: def __init__(self): self.var2 = 'var' diff --git a/tests/functional/f/first_arg.py b/tests/functional/f/first_arg.py index 16824d4f2..d8007e144 100644 --- a/tests/functional/f/first_arg.py +++ b/tests/functional/f/first_arg.py @@ -1,11 +1,9 @@ -# pylint: disable=missing-docstring, useless-object-inheritance +# pylint: disable=missing-docstring """check for methods first arguments """ -__revision__ = 0 - -class Obj(object): +class Obj: # C0202, classmethod def __new__(something): # [bad-classmethod-argument] pass diff --git a/tests/functional/f/first_arg.txt b/tests/functional/f/first_arg.txt index e75743b33..26aabd22e 100644 --- a/tests/functional/f/first_arg.txt +++ b/tests/functional/f/first_arg.txt @@ -1,9 +1,9 @@ -bad-classmethod-argument:10:4:10:15:Obj.__new__:Class method __new__ should have 'cls' as first argument:UNDEFINED -no-classmethod-decorator:16:4:16:10:Obj:Consider using a decorator instead of calling classmethod:UNDEFINED -bad-classmethod-argument:18:4:18:14:Obj.class2:Class method class2 should have 'cls' as first argument:UNDEFINED -no-classmethod-decorator:20:4:20:10:Obj:Consider using a decorator instead of calling classmethod:UNDEFINED -bad-mcs-classmethod-argument:25:4:25:15:Meta.__new__:Metaclass class method __new__ should have 'cls' as first argument:UNDEFINED -bad-mcs-method-argument:32:4:32:15:Meta.method2:Metaclass method method2 should have 'cls' as first argument:UNDEFINED -no-classmethod-decorator:38:4:38:10:Meta:Consider using a decorator instead of calling classmethod:UNDEFINED -bad-mcs-classmethod-argument:40:4:40:14:Meta.class2:Metaclass class method class2 should have 'cls' as first argument:UNDEFINED -no-classmethod-decorator:42:4:42:10:Meta:Consider using a decorator instead of calling classmethod:UNDEFINED +bad-classmethod-argument:8:4:8:15:Obj.__new__:Class method __new__ should have 'cls' as first argument:UNDEFINED +no-classmethod-decorator:14:4:14:10:Obj:Consider using a decorator instead of calling classmethod:UNDEFINED +bad-classmethod-argument:16:4:16:14:Obj.class2:Class method class2 should have 'cls' as first argument:UNDEFINED +no-classmethod-decorator:18:4:18:10:Obj:Consider using a decorator instead of calling classmethod:UNDEFINED +bad-mcs-classmethod-argument:23:4:23:15:Meta.__new__:Metaclass class method __new__ should have 'cls' as first argument:UNDEFINED +bad-mcs-method-argument:30:4:30:15:Meta.method2:Metaclass method method2 should have 'cls' as first argument:UNDEFINED +no-classmethod-decorator:36:4:36:10:Meta:Consider using a decorator instead of calling classmethod:UNDEFINED +bad-mcs-classmethod-argument:38:4:38:14:Meta.class2:Metaclass class method class2 should have 'cls' as first argument:UNDEFINED +no-classmethod-decorator:40:4:40:10:Meta:Consider using a decorator instead of calling classmethod:UNDEFINED diff --git a/tests/functional/f/func_disable_linebased.py b/tests/functional/f/func_disable_linebased.py index bb4ad232c..6a807d9ea 100644 --- a/tests/functional/f/func_disable_linebased.py +++ b/tests/functional/f/func_disable_linebased.py @@ -10,6 +10,5 @@ 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.') # [line-too-long] diff --git a/tests/functional/f/func_disable_linebased.txt b/tests/functional/f/func_disable_linebased.txt index 92a551d4b..727ef79bb 100644 --- a/tests/functional/f/func_disable_linebased.txt +++ b/tests/functional/f/func_disable_linebased.txt @@ -1,2 +1,2 @@ line-too-long:1:0:None:None::Line too long (146/100):UNDEFINED -line-too-long:15:0:None:None::Line too long (133/100):UNDEFINED +line-too-long:14:0:None:None::Line too long (133/100):UNDEFINED diff --git a/tests/functional/f/function_redefined.py b/tests/functional/f/function_redefined.py index eab8a6d1f..a87c79680 100644 --- a/tests/functional/f/function_redefined.py +++ b/tests/functional/f/function_redefined.py @@ -1,11 +1,11 @@ -# pylint: disable=missing-docstring,using-constant-test, useless-object-inheritance +# pylint: disable=missing-docstring,using-constant-test # pylint: disable=unused-import,wrong-import-position,reimported, unnecessary-pass from __future__ import division from typing import Callable __revision__ = '' -class AAAA(object): +class AAAA: """docstring""" def __init__(self): pass @@ -18,7 +18,7 @@ class AAAA(object): def method2(self): # [function-redefined] """docstring""" -class AAAA(object): # [function-redefined] +class AAAA: # [function-redefined] """docstring""" def __init__(self): pass diff --git a/tests/functional/g/generated_members.py b/tests/functional/g/generated_members.py index 72878329d..ffb3de631 100644 --- a/tests/functional/g/generated_members.py +++ b/tests/functional/g/generated_members.py @@ -1,10 +1,10 @@ """Test the generated-members config option.""" -# pylint: disable=pointless-statement, invalid-name, useless-object-inheritance +# pylint: disable=pointless-statement, invalid-name from __future__ import annotations from astroid import nodes from pylint import checkers -class Klass(object): +class Klass: """A class with a generated member.""" print(Klass().DoesNotExist) diff --git a/tests/functional/g/genexp_in_class_scope.py b/tests/functional/g/genexp_in_class_scope.py index 93e0ceaae..73585c2be 100644 --- a/tests/functional/g/genexp_in_class_scope.py +++ b/tests/functional/g/genexp_in_class_scope.py @@ -1,6 +1,5 @@ # pylint: disable=too-few-public-methods, missing-docstring -# pylint: disable=useless-object-inheritance """Class scope must be handled correctly in genexps""" -class MyClass(object): +class MyClass: var1 = [] var2 = list(value*2 for value in var1) diff --git a/tests/functional/g/genexpr_variable_scope.py b/tests/functional/g/genexpr_variable_scope.py index a00d72d32..721038739 100644 --- a/tests/functional/g/genexpr_variable_scope.py +++ b/tests/functional/g/genexpr_variable_scope.py @@ -1,5 +1,5 @@ """test name defined in generator expression are not available outside the genexpr scope """ -from __future__ import print_function + print(n) # [undefined-variable] diff --git a/tests/functional/g/globals.py b/tests/functional/g/globals.py index f12c06800..78538c042 100644 --- a/tests/functional/g/globals.py +++ b/tests/functional/g/globals.py @@ -1,6 +1,5 @@ """Warnings about global statements and usage of global variables.""" # pylint: disable=invalid-name, redefined-outer-name, missing-function-docstring, missing-class-docstring, import-outside-toplevel, too-few-public-methods -from __future__ import print_function global CSTE # [global-at-module-level] print(CSTE) # [undefined-variable] diff --git a/tests/functional/g/globals.txt b/tests/functional/g/globals.txt index 975506cc8..8c1db54fd 100644 --- a/tests/functional/g/globals.txt +++ b/tests/functional/g/globals.txt @@ -1,14 +1,14 @@ -global-at-module-level:5:0:5:11::Using the global statement at the module level:UNDEFINED -undefined-variable:6:6:6:10::Undefined variable 'CSTE':UNDEFINED -global-statement:17:4:17:19:fix_contant:Using the global statement:UNDEFINED -global-variable-not-assigned:24:4:24:14:other:Using global for 'HOP' but no assignment is done:UNDEFINED -undefined-variable:25:10:25:13:other:Undefined variable 'HOP':UNDEFINED -global-variable-undefined:30:4:30:18:define_constant:Global variable 'SOMEVAR' undefined at the module level:UNDEFINED -global-statement:36:4:36:14:global_with_import:Using the global statement:UNDEFINED -global-variable-not-assigned:42:4:42:19:global_no_assign:Using global for 'CONSTANT' but no assignment is done:UNDEFINED -global-statement:48:4:48:19:global_del:Using the global statement:UNDEFINED -global-statement:55:4:55:19:global_operator_assign:Using the global statement:UNDEFINED -global-statement:62:4:62:19:global_function_assign:Using the global statement:UNDEFINED -global-statement:72:4:72:15:override_func:Using the global statement:UNDEFINED -global-statement:81:4:81:14:func:Using the global statement:UNDEFINED -global-statement:87:4:87:16:override_class:Using the global statement:UNDEFINED +global-at-module-level:4:0:4:11::Using the global statement at the module level:UNDEFINED +undefined-variable:5:6:5:10::Undefined variable 'CSTE':UNDEFINED +global-statement:16:4:16:19:fix_contant:Using the global statement:UNDEFINED +global-variable-not-assigned:23:4:23:14:other:Using global for 'HOP' but no assignment is done:UNDEFINED +undefined-variable:24:10:24:13:other:Undefined variable 'HOP':UNDEFINED +global-variable-undefined:29:4:29:18:define_constant:Global variable 'SOMEVAR' undefined at the module level:UNDEFINED +global-statement:35:4:35:14:global_with_import:Using the global statement:UNDEFINED +global-variable-not-assigned:41:4:41:19:global_no_assign:Using global for 'CONSTANT' but no assignment is done:UNDEFINED +global-statement:47:4:47:19:global_del:Using the global statement:UNDEFINED +global-statement:54:4:54:19:global_operator_assign:Using the global statement:UNDEFINED +global-statement:61:4:61:19:global_function_assign:Using the global statement:UNDEFINED +global-statement:71:4:71:15:override_func:Using the global statement:UNDEFINED +global-statement:80:4:80:14:func:Using the global statement:UNDEFINED +global-statement:86:4:86:16:override_class:Using the global statement:UNDEFINED diff --git a/tests/functional/i/import_itself.py b/tests/functional/i/import_itself.py index 1f4928f3e..213532dbd 100644 --- a/tests/functional/i/import_itself.py +++ b/tests/functional/i/import_itself.py @@ -1,6 +1,5 @@ """test module importing itself""" # pylint: disable=using-constant-test -from __future__ import print_function from . import import_itself # [import-self] __revision__ = 0 diff --git a/tests/functional/i/import_itself.txt b/tests/functional/i/import_itself.txt index 67f19cd97..ea30b6141 100644 --- a/tests/functional/i/import_itself.txt +++ b/tests/functional/i/import_itself.txt @@ -1 +1 @@ -import-self:4:0:4:27::Module import itself:UNDEFINED +import-self:3:0:3:27::Module import itself:UNDEFINED diff --git a/tests/functional/i/inherit_non_class.py b/tests/functional/i/inherit_non_class.py index b0ed93df7..fb00d6f99 100644 --- a/tests/functional/i/inherit_non_class.py +++ b/tests/functional/i/inherit_non_class.py @@ -1,8 +1,8 @@ """Test that inheriting from something which is not
a class emits a warning. """
-# pylint: disable=import-error, invalid-name, using-constant-test, useless-object-inheritance
-# pylint: disable=missing-docstring, too-few-public-methods
+# pylint: disable=import-error, invalid-name, using-constant-test
+# pylint: disable=missing-docstring, too-few-public-methods, useless-object-inheritance
from missing import Missing
@@ -11,7 +11,7 @@ if 1: else:
Ambiguous = int
-class Empty(object):
+class Empty:
""" Empty class. """
def return_class():
@@ -33,7 +33,7 @@ class Bad3(return_class): # [inherit-non-class] class Bad4(Empty()): # [inherit-non-class]
""" Can't inherit from instance. """
-class Good(object):
+class Good:
pass
class Good1(int):
@@ -48,7 +48,7 @@ class Good3(type(int)): class Good4(return_class()):
pass
-class Good5(Good4, int, object):
+class Good5(Good4, int):
pass
class Good6(Ambiguous):
diff --git a/tests/functional/i/init_is_generator.py b/tests/functional/i/init_is_generator.py index 17f96db30..a2ce1e8b4 100644 --- a/tests/functional/i/init_is_generator.py +++ b/tests/functional/i/init_is_generator.py @@ -1,5 +1,5 @@ -# pylint: disable=missing-docstring,too-few-public-methods, useless-object-inheritance +# pylint: disable=missing-docstring,too-few-public-methods -class SomeClass(object): +class SomeClass: def __init__(self): # [init-is-generator] yield None diff --git a/tests/functional/i/init_not_called.py b/tests/functional/i/init_not_called.py index ac4baac6e..c310ae836 100644 --- a/tests/functional/i/init_not_called.py +++ b/tests/functional/i/init_not_called.py @@ -1,7 +1,6 @@ # pylint: disable=too-few-public-methods, import-error, missing-docstring, wrong-import-position -# pylint: disable=useless-super-delegation, useless-object-inheritance, unnecessary-pass +# pylint: disable=useless-super-delegation, unnecessary-pass -from __future__ import print_function from typing import overload @@ -33,7 +32,7 @@ class ZZZZ(AAAA, BBBB, CCCC): AAAA.__init__(self) -class NewStyleA(object): +class NewStyleA: """new style class""" def __init__(self): @@ -48,7 +47,7 @@ class NewStyleB(NewStyleA): super().__init__() -class NewStyleC(object): +class NewStyleC: """__init__ defined by assignment.""" def xx_init(self): diff --git a/tests/functional/i/init_not_called.txt b/tests/functional/i/init_not_called.txt index b944b5585..2f2d51b4f 100644 --- a/tests/functional/i/init_not_called.txt +++ b/tests/functional/i/init_not_called.txt @@ -1 +1 @@ -super-init-not-called:32:4:32:16:ZZZZ.__init__:__init__ method from base class 'BBBB' is not called:INFERENCE +super-init-not-called:31:4:31:16:ZZZZ.__init__:__init__ method from base class 'BBBB' is not called:INFERENCE diff --git a/tests/functional/i/init_return_from_inner_function.py b/tests/functional/i/init_return_from_inner_function.py index 065a1ad70..662d18a87 100644 --- a/tests/functional/i/init_return_from_inner_function.py +++ b/tests/functional/i/init_return_from_inner_function.py @@ -1,9 +1,8 @@ -# pylint: disable=too-few-public-methods, useless-object-inheritance +# pylint: disable=too-few-public-methods """#10075""" -__revision__ = 1 -class Aaa(object): +class Aaa: """docstring""" def __init__(self): def inner_function(arg): diff --git a/tests/functional/i/init_subclass_classmethod.py b/tests/functional/i/init_subclass_classmethod.py index 8153aa2d4..81fa8799b 100644 --- a/tests/functional/i/init_subclass_classmethod.py +++ b/tests/functional/i/init_subclass_classmethod.py @@ -1,6 +1,6 @@ -# pylint: disable=too-few-public-methods, missing-docstring, useless-object-inheritance +# pylint: disable=too-few-public-methods, missing-docstring -class PluginBase(object): +class PluginBase: subclasses = [] def __init_subclass__(cls, **kwargs): diff --git a/tests/functional/i/inner_classes.py b/tests/functional/i/inner_classes.py index cabae5734..3e26045a3 100644 --- a/tests/functional/i/inner_classes.py +++ b/tests/functional/i/inner_classes.py @@ -1,9 +1,8 @@ -# pylint: disable=too-few-public-methods, useless-object-inheritance, unnecessary-pass, unnecessary-dunder-call +# pylint: disable=too-few-public-methods, unnecessary-pass, unnecessary-dunder-call """Backend Base Classes for the schwelm user DB""" -__revision__ = "alpha" -class Aaa(object): +class Aaa: """docstring""" def __init__(self): self.__setattr__('a', 'b') diff --git a/tests/functional/i/invalid/invalid_bool_returned.py b/tests/functional/i/invalid/invalid_bool_returned.py index 72e91f511..eb888155b 100644 --- a/tests/functional/i/invalid/invalid_bool_returned.py +++ b/tests/functional/i/invalid/invalid_bool_returned.py @@ -1,19 +1,19 @@ """Check invalid value returned by __bool__ """ -# pylint: disable=too-few-public-methods,missing-docstring,import-error,useless-object-inheritance,unnecessary-lambda-assignment +# pylint: disable=too-few-public-methods,missing-docstring,import-error,unnecessary-lambda-assignment import six from missing import Missing -class FirstGoodBool(object): +class FirstGoodBool: """__bool__ returns <type 'bool'>""" def __bool__(self): return True -class SecondGoodBool(object): +class SecondGoodBool: """__bool__ returns <type 'bool'>""" def __bool__(self): @@ -26,37 +26,37 @@ class BoolMetaclass(type): @six.add_metaclass(BoolMetaclass) -class ThirdGoodBool(object): +class ThirdGoodBool: """Bool through the metaclass.""" -class FirstBadBool(object): +class FirstBadBool: """ __bool__ returns an integer """ def __bool__(self): # [invalid-bool-returned] return 1 -class SecondBadBool(object): +class SecondBadBool: """ __bool__ returns str """ def __bool__(self): # [invalid-bool-returned] return "True" -class ThirdBadBool(object): +class ThirdBadBool: """ __bool__ returns node which does not have 'value' in AST """ def __bool__(self): # [invalid-bool-returned] return lambda: 3 -class AmbigousBool(object): +class AmbigousBool: """ Uninferable return value """ __bool__ = lambda self: Missing -class AnotherAmbiguousBool(object): +class AnotherAmbiguousBool: """Potential uninferable return value""" def __bool__(self): return bool(Missing) diff --git a/tests/functional/i/invalid/invalid_bytes_returned.py b/tests/functional/i/invalid/invalid_bytes_returned.py index 993bd8777..5ba832523 100644 --- a/tests/functional/i/invalid/invalid_bytes_returned.py +++ b/tests/functional/i/invalid/invalid_bytes_returned.py @@ -1,19 +1,19 @@ """Check invalid value returned by __bytes__ """ -# pylint: disable=too-few-public-methods,missing-docstring,import-error,useless-object-inheritance,unnecessary-lambda-assignment +# pylint: disable=too-few-public-methods,missing-docstring,import-error,unnecessary-lambda-assignment import six from missing import Missing -class FirstGoodBytes(object): +class FirstGoodBytes: """__bytes__ returns <type 'bytes'>""" def __bytes__(self): return b"some bytes" -class SecondGoodBytes(object): +class SecondGoodBytes: """__bytes__ returns <type 'bytes'>""" def __bytes__(self): @@ -26,38 +26,38 @@ class BytesMetaclass(type): @six.add_metaclass(BytesMetaclass) -class ThirdGoodBytes(object): +class ThirdGoodBytes: """Bytes through the metaclass.""" -class FirstBadBytes(object): +class FirstBadBytes: """ __bytes__ returns bytes """ def __bytes__(self): # [invalid-bytes-returned] return "123" -class SecondBadBytes(object): +class SecondBadBytes: """ __bytes__ returns int """ def __bytes__(self): # [invalid-bytes-returned] return 1 -class ThirdBadBytes(object): +class ThirdBadBytes: """ __bytes__ returns node which does not have 'value' in AST """ def __bytes__(self): # [invalid-bytes-returned] return lambda: b"some bytes" -class AmbiguousBytes(object): +class AmbiguousBytes: """ Uninferable return value """ __bytes__ = lambda self: Missing -class AnotherAmbiguousBytes(object): +class AnotherAmbiguousBytes: """Potential uninferable return value""" def __bytes__(self): diff --git a/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_caught.py b/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_caught.py index ef4957fc4..1b513f972 100644 --- a/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_caught.py +++ b/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_caught.py @@ -1,13 +1,12 @@ -# pylint: disable=missing-docstring, too-few-public-methods, useless-object-inheritance, use-list-literal +# pylint: disable=missing-docstring, too-few-public-methods, use-list-literal # pylint: disable=too-many-ancestors, import-error, multiple-imports,wrong-import-position -from __future__ import print_function import socket, binascii, abc, six -class MyException(object): +class MyException: """Custom 'exception'.""" -class MySecondException(object): +class MySecondException: """Custom 'exception'.""" class MyGoodException(Exception): diff --git a/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_caught.txt b/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_caught.txt index 3c906b661..6d35a1e22 100644 --- a/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_caught.txt +++ b/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_caught.txt @@ -1,12 +1,12 @@ -catching-non-exception:27:7:27:18::"Catching an exception which doesn't inherit from Exception: MyException":UNDEFINED -catching-non-exception:33:7:33:39::"Catching an exception which doesn't inherit from Exception: MyException":UNDEFINED -catching-non-exception:33:7:33:39::"Catching an exception which doesn't inherit from Exception: MySecondException":UNDEFINED -catching-non-exception:54:7:54:21::"Catching an exception which doesn't inherit from Exception: None":UNDEFINED -catching-non-exception:54:7:54:21::"Catching an exception which doesn't inherit from Exception: list()":UNDEFINED -catching-non-exception:59:7:59:11::"Catching an exception which doesn't inherit from Exception: None":UNDEFINED -catching-non-exception:72:7:72:52::"Catching an exception which doesn't inherit from Exception: 4":UNDEFINED -catching-non-exception:72:7:72:52::"Catching an exception which doesn't inherit from Exception: None":UNDEFINED -catching-non-exception:72:7:72:52::"Catching an exception which doesn't inherit from Exception: list([4, 5, 6])":UNDEFINED -catching-non-exception:85:7:85:26::"Catching an exception which doesn't inherit from Exception: NON_EXCEPTION_TUPLE":UNDEFINED -catching-non-exception:103:7:103:13::"Catching an exception which doesn't inherit from Exception: object":UNDEFINED -catching-non-exception:108:7:108:12::"Catching an exception which doesn't inherit from Exception: range":UNDEFINED +catching-non-exception:26:7:26:18::"Catching an exception which doesn't inherit from Exception: MyException":UNDEFINED +catching-non-exception:32:7:32:39::"Catching an exception which doesn't inherit from Exception: MyException":UNDEFINED +catching-non-exception:32:7:32:39::"Catching an exception which doesn't inherit from Exception: MySecondException":UNDEFINED +catching-non-exception:53:7:53:21::"Catching an exception which doesn't inherit from Exception: None":UNDEFINED +catching-non-exception:53:7:53:21::"Catching an exception which doesn't inherit from Exception: list()":UNDEFINED +catching-non-exception:58:7:58:11::"Catching an exception which doesn't inherit from Exception: None":UNDEFINED +catching-non-exception:71:7:71:52::"Catching an exception which doesn't inherit from Exception: 4":UNDEFINED +catching-non-exception:71:7:71:52::"Catching an exception which doesn't inherit from Exception: None":UNDEFINED +catching-non-exception:71:7:71:52::"Catching an exception which doesn't inherit from Exception: list([4, 5, 6])":UNDEFINED +catching-non-exception:84:7:84:26::"Catching an exception which doesn't inherit from Exception: NON_EXCEPTION_TUPLE":UNDEFINED +catching-non-exception:102:7:102:13::"Catching an exception which doesn't inherit from Exception: object":UNDEFINED +catching-non-exception:107:7:107:12::"Catching an exception which doesn't inherit from Exception: range":UNDEFINED diff --git a/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_raised.py b/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_raised.py index f7e52819d..a0b5ad39f 100644 --- a/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_raised.py +++ b/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_raised.py @@ -1,4 +1,4 @@ -# pylint:disable=too-few-public-methods,import-error,missing-docstring, not-callable, useless-object-inheritance,import-outside-toplevel +# pylint:disable=too-few-public-methods,import-error,missing-docstring, not-callable, import-outside-toplevel """test pb with exceptions and old/new style classes""" @@ -8,7 +8,7 @@ class ValidException(Exception): class OldStyleClass: """Not an exception.""" -class NewStyleClass(object): +class NewStyleClass: """Not an exception.""" diff --git a/tests/functional/i/invalid/invalid_format_returned.py b/tests/functional/i/invalid/invalid_format_returned.py index b46feb4fe..f97d0f29d 100644 --- a/tests/functional/i/invalid/invalid_format_returned.py +++ b/tests/functional/i/invalid/invalid_format_returned.py @@ -1,19 +1,19 @@ """Check invalid value returned by __format__ """ -# pylint: disable=too-few-public-methods,missing-docstring,import-error,useless-object-inheritance,unnecessary-lambda-assignment +# pylint: disable=too-few-public-methods,missing-docstring,import-error,unnecessary-lambda-assignment import six from missing import Missing -class FirstGoodFormat(object): +class FirstGoodFormat: """__format__ returns <type 'str'>""" def __format__(self, format_spec): return "some format" -class SecondGoodFormat(object): +class SecondGoodFormat: """__format__ returns <type 'str'>""" def __format__(self, format_spec): @@ -26,38 +26,38 @@ class FormatMetaclass(type): @six.add_metaclass(FormatMetaclass) -class ThirdGoodFormat(object): +class ThirdGoodFormat: """Format through the metaclass.""" -class FirstBadFormat(object): +class FirstBadFormat: """ __format__ returns bytes """ def __format__(self, format_spec): # [invalid-format-returned] return b"123" -class SecondBadFormat(object): +class SecondBadFormat: """ __format__ returns int """ def __format__(self, format_spec): # [invalid-format-returned] return 1 -class ThirdBadFormat(object): +class ThirdBadFormat: """ __format__ returns node which does not have 'value' in AST """ def __format__(self, format_spec): # [invalid-format-returned] return lambda: "some format" -class AmbiguousFormat(object): +class AmbiguousFormat: """ Uninferable return value """ __format__ = lambda self, format_spec: Missing -class AnotherAmbiguousFormat(object): +class AnotherAmbiguousFormat: """Potential uninferable return value""" def __format__(self, format_spec): diff --git a/tests/functional/i/invalid/invalid_getnewargs/invalid_getnewargs_ex_returned.py b/tests/functional/i/invalid/invalid_getnewargs/invalid_getnewargs_ex_returned.py index 5e55ad197..5614674c3 100644 --- a/tests/functional/i/invalid/invalid_getnewargs/invalid_getnewargs_ex_returned.py +++ b/tests/functional/i/invalid/invalid_getnewargs/invalid_getnewargs_ex_returned.py @@ -1,19 +1,19 @@ """Check invalid value returned by __getnewargs_ex__ """ -# pylint: disable=too-few-public-methods,missing-docstring,import-error,useless-object-inheritance,use-dict-literal,unnecessary-lambda-assignment +# pylint: disable=too-few-public-methods,missing-docstring,import-error,use-dict-literal,unnecessary-lambda-assignment import six from missing import Missing -class FirstGoodGetNewArgsEx(object): +class FirstGoodGetNewArgsEx: """__getnewargs_ex__ returns <type 'tuple'>""" def __getnewargs_ex__(self): return ((1,), {"2": "2"}) -class SecondGoodGetNewArgsEx(object): +class SecondGoodGetNewArgsEx: """__getnewargs_ex__ returns <type 'tuple'>""" def __getnewargs_ex__(self): @@ -26,59 +26,59 @@ class GetNewArgsExMetaclass(type): @six.add_metaclass(GetNewArgsExMetaclass) -class ThirdGoodGetNewArgsEx(object): +class ThirdGoodGetNewArgsEx: """GetNewArgsEx through the metaclass.""" -class FirstBadGetNewArgsEx(object): +class FirstBadGetNewArgsEx: """ __getnewargs_ex__ returns an integer """ def __getnewargs_ex__(self): # [invalid-getnewargs-ex-returned] return 1 -class SecondBadGetNewArgsEx(object): +class SecondBadGetNewArgsEx: """ __getnewargs_ex__ returns tuple with incorrect arg length""" def __getnewargs_ex__(self): # [invalid-getnewargs-ex-returned] return (tuple(1), dict(x="y"), 1) -class ThirdBadGetNewArgsEx(object): +class ThirdBadGetNewArgsEx: """ __getnewargs_ex__ returns tuple with wrong type for first arg """ def __getnewargs_ex__(self): # [invalid-getnewargs-ex-returned] return (dict(x="y"), dict(x="y")) -class FourthBadGetNewArgsEx(object): +class FourthBadGetNewArgsEx: """ __getnewargs_ex__ returns tuple with wrong type for second arg """ def __getnewargs_ex__(self): # [invalid-getnewargs-ex-returned] return ((1, ), (1, )) -class FifthBadGetNewArgsEx(object): +class FifthBadGetNewArgsEx: """ __getnewargs_ex__ returns tuple with wrong type for both args """ def __getnewargs_ex__(self): # [invalid-getnewargs-ex-returned] return ({'x': 'y'}, (2,)) -class SixthBadGetNewArgsEx(object): +class SixthBadGetNewArgsEx: """ __getnewargs_ex__ returns node which does not have 'value' in AST """ def __getnewargs_ex__(self): # [invalid-getnewargs-ex-returned] return lambda: (1, 2) -class AmbigousGetNewArgsEx(object): +class AmbigousGetNewArgsEx: """ Uninferable return value """ __getnewargs_ex__ = lambda self: Missing -class AnotherAmbiguousGetNewArgsEx(object): +class AnotherAmbiguousGetNewArgsEx: """Potential uninferable return value""" def __getnewargs_ex__(self): diff --git a/tests/functional/i/invalid/invalid_getnewargs/invalid_getnewargs_returned.py b/tests/functional/i/invalid/invalid_getnewargs/invalid_getnewargs_returned.py index b4fd2cb4c..49fe7b602 100644 --- a/tests/functional/i/invalid/invalid_getnewargs/invalid_getnewargs_returned.py +++ b/tests/functional/i/invalid/invalid_getnewargs/invalid_getnewargs_returned.py @@ -1,19 +1,19 @@ """Check invalid value returned by __getnewargs__ """ -# pylint: disable=too-few-public-methods,missing-docstring,import-error,useless-object-inheritance,unnecessary-lambda-assignment +# pylint: disable=too-few-public-methods,missing-docstring,import-error,unnecessary-lambda-assignment import six from missing import Missing -class FirstGoodGetNewArgs(object): +class FirstGoodGetNewArgs: """__getnewargs__ returns <type 'tuple'>""" def __getnewargs__(self): return (1, "2", 3) -class SecondGoodGetNewArgs(object): +class SecondGoodGetNewArgs: """__getnewargs__ returns <type 'tuple'>""" def __getnewargs__(self): @@ -26,37 +26,37 @@ class GetNewArgsMetaclass(type): @six.add_metaclass(GetNewArgsMetaclass) -class ThirdGoodGetNewArgs(object): +class ThirdGoodGetNewArgs: """GetNewArgs through the metaclass.""" -class FirstBadGetNewArgs(object): +class FirstBadGetNewArgs: """ __getnewargs__ returns an integer """ def __getnewargs__(self): # [invalid-getnewargs-returned] return 1 -class SecondBadGetNewArgs(object): +class SecondBadGetNewArgs: """ __getnewargs__ returns str """ def __getnewargs__(self): # [invalid-getnewargs-returned] return "(1, 2, 3)" -class ThirdBadGetNewArgs(object): +class ThirdBadGetNewArgs: """ __getnewargs__ returns node which does not have 'value' in AST """ def __getnewargs__(self): # [invalid-getnewargs-returned] return lambda: tuple(1, 2) -class AmbigousGetNewArgs(object): +class AmbigousGetNewArgs: """ Uninferable return value """ __getnewargs__ = lambda self: Missing -class AnotherAmbiguousGetNewArgs(object): +class AnotherAmbiguousGetNewArgs: """Potential uninferable return value""" def __getnewargs__(self): return tuple(Missing) diff --git a/tests/functional/i/invalid/invalid_hash_returned.py b/tests/functional/i/invalid/invalid_hash_returned.py index 501d3dd82..4fedb63bc 100644 --- a/tests/functional/i/invalid/invalid_hash_returned.py +++ b/tests/functional/i/invalid/invalid_hash_returned.py @@ -1,19 +1,19 @@ """Check invalid value returned by __hash__ """ -# pylint: disable=too-few-public-methods,missing-docstring,import-error,useless-object-inheritance,unnecessary-lambda-assignment +# pylint: disable=too-few-public-methods,missing-docstring,import-error,unnecessary-lambda-assignment import six from missing import Missing -class FirstGoodHash(object): +class FirstGoodHash: """__hash__ returns <type 'int'>""" def __hash__(self): return 1 -class SecondGoodHash(object): +class SecondGoodHash: """__hash__ returns <type 'int'>""" def __hash__(self): @@ -26,45 +26,45 @@ class HashMetaclass(type): @six.add_metaclass(HashMetaclass) -class ThirdGoodHash(object): +class ThirdGoodHash: """Hash through the metaclass.""" -class FirstBadHash(object): +class FirstBadHash: """ __hash__ returns a dict """ def __hash__(self): # [invalid-hash-returned] return {} -class SecondBadHash(object): +class SecondBadHash: """ __hash__ returns str """ def __hash__(self): # [invalid-hash-returned] return "True" -class ThirdBadHash(object): +class ThirdBadHash: """ __hash__ returns a float""" def __hash__(self): # [invalid-hash-returned] return 1.11 -class FourthBadHash(object): +class FourthBadHash: """ __hash__ returns node which does not have 'value' in AST """ def __hash__(self): # [invalid-hash-returned] return lambda: 3 -class AmbigousHash(object): +class AmbigousHash: """ Uninferable return value """ __hash__ = lambda self: Missing -class AnotherAmbiguousHash(object): +class AnotherAmbiguousHash: """Potential uninferable return value""" def __hash__(self): diff --git a/tests/functional/i/invalid/invalid_index_returned.py b/tests/functional/i/invalid/invalid_index_returned.py index 8e452fcce..83c7fb02b 100644 --- a/tests/functional/i/invalid/invalid_index_returned.py +++ b/tests/functional/i/invalid/invalid_index_returned.py @@ -1,19 +1,19 @@ """Check invalid value returned by __index__ """ -# pylint: disable=too-few-public-methods,missing-docstring,import-error,useless-object-inheritance,unnecessary-lambda-assignment +# pylint: disable=too-few-public-methods,missing-docstring,import-error,unnecessary-lambda-assignment import six from missing import Missing -class FirstGoodIndex(object): +class FirstGoodIndex: """__index__ returns <type 'int'>""" def __index__(self): return 1 -class SecondGoodIndex(object): +class SecondGoodIndex: """__index__ returns <type 'int'>""" def __index__(self): @@ -26,45 +26,45 @@ class IndexMetaclass(type): @six.add_metaclass(IndexMetaclass) -class ThirdGoodIndex(object): +class ThirdGoodIndex: """Index through the metaclass.""" -class FirstBadIndex(object): +class FirstBadIndex: """ __index__ returns a dict """ def __index__(self): # [invalid-index-returned] return {'1': '1'} -class SecondBadIndex(object): +class SecondBadIndex: """ __index__ returns str """ def __index__(self): # [invalid-index-returned] return "42" -class ThirdBadIndex(object): +class ThirdBadIndex: """ __index__ returns a float""" def __index__(self): # [invalid-index-returned] return 1.11 -class FourthBadIndex(object): +class FourthBadIndex: """ __index__ returns node which does not have 'value' in AST """ def __index__(self): # [invalid-index-returned] return lambda: 3 -class AmbigousIndex(object): +class AmbigousIndex: """ Uninferable return value """ __index__ = lambda self: Missing -class AnotherAmbiguousIndex(object): +class AnotherAmbiguousIndex: """Potential uninferable return value""" def __index__(self): diff --git a/tests/functional/i/invalid/invalid_length/invalid_length_hint_returned.py b/tests/functional/i/invalid/invalid_length/invalid_length_hint_returned.py index 2e3273692..e8178863c 100644 --- a/tests/functional/i/invalid/invalid_length/invalid_length_hint_returned.py +++ b/tests/functional/i/invalid/invalid_length/invalid_length_hint_returned.py @@ -1,6 +1,6 @@ """Check invalid value returned by __length_hint__ """ -# pylint: disable=too-few-public-methods,missing-docstring,import-error,useless-object-inheritance,unnecessary-lambda-assignment +# pylint: disable=too-few-public-methods,missing-docstring,import-error,unnecessary-lambda-assignment import sys import six @@ -8,14 +8,14 @@ import six from missing import Missing -class FirstGoodLengthHint(object): +class FirstGoodLengthHint: """__length_hint__ returns <type 'int'>""" def __length_hint__(self): return 0 -class SecondGoodLengthHint(object): +class SecondGoodLengthHint: """__length_hint__ returns <type 'long'>""" def __length_hint__(self): @@ -28,37 +28,37 @@ class LengthHintMetaclass(type): @six.add_metaclass(LengthHintMetaclass) -class ThirdGoodLengthHint(object): +class ThirdGoodLengthHint: """LengthHintgth through the metaclass.""" -class FirstBadLengthHint(object): +class FirstBadLengthHint: """ __length_hint__ returns a negative integer """ def __length_hint__(self): # [invalid-length-hint-returned] return -1 -class SecondBadLengthHint(object): +class SecondBadLengthHint: """ __length_hint__ returns non-int """ def __length_hint__(self): # [invalid-length-hint-returned] return 3.0 -class ThirdBadLengthHint(object): +class ThirdBadLengthHint: """ __length_hint__ returns node which does not have 'value' in AST """ def __length_hint__(self): # [invalid-length-hint-returned] return lambda: 3 -class AmbigousLengthHint(object): +class AmbigousLengthHint: """ Uninferable return value """ __length_hint__ = lambda self: Missing -class AnotherAmbiguousLengthHint(object): +class AnotherAmbiguousLengthHint: """Potential uninferable return value""" def __length_hint__(self): return int(Missing) diff --git a/tests/functional/i/invalid/invalid_length/invalid_length_returned.py b/tests/functional/i/invalid/invalid_length/invalid_length_returned.py index 7ffdbf93a..14758687d 100644 --- a/tests/functional/i/invalid/invalid_length/invalid_length_returned.py +++ b/tests/functional/i/invalid/invalid_length/invalid_length_returned.py @@ -1,6 +1,6 @@ """Check invalid value returned by __len__ """ -# pylint: disable=too-few-public-methods,missing-docstring,import-error,useless-object-inheritance,unnecessary-lambda-assignment +# pylint: disable=too-few-public-methods,missing-docstring,import-error,unnecessary-lambda-assignment import sys import six @@ -8,14 +8,14 @@ import six from missing import Missing -class FirstGoodLen(object): +class FirstGoodLen: """__len__ returns <type 'int'>""" def __len__(self): return 0 -class SecondGoodLen(object): +class SecondGoodLen: """__len__ returns <type 'long'>""" def __len__(self): @@ -28,44 +28,44 @@ class LenMetaclass(type): @six.add_metaclass(LenMetaclass) -class ThirdGoodLen(object): +class ThirdGoodLen: """Length through the metaclass.""" -class FirstBadLen(object): +class FirstBadLen: """ __len__ returns a negative integer """ def __len__(self): # [invalid-length-returned] return -1 -class SecondBadLen(object): +class SecondBadLen: """ __len__ returns non-int """ def __len__(self): # [invalid-length-returned] return 3.0 -class ThirdBadLen(object): +class ThirdBadLen: """ __len__ returns node which does not have 'value' in AST """ def __len__(self): # [invalid-length-returned] return lambda: 3 -class NonRegression(object): +class NonRegression: """ __len__ returns nothing """ def __len__(self): # [invalid-length-returned] print(3.0) -class AmbigousLen(object): +class AmbigousLen: """ Uninferable return value """ __len__ = lambda self: Missing -class AnotherAmbiguousLen(object): +class AnotherAmbiguousLen: """Potential uninferable return value""" def __len__(self): return int(Missing) diff --git a/tests/functional/i/invalid/invalid_metaclass.py b/tests/functional/i/invalid/invalid_metaclass.py index ec251e47d..1dc59791a 100644 --- a/tests/functional/i/invalid/invalid_metaclass.py +++ b/tests/functional/i/invalid/invalid_metaclass.py @@ -1,4 +1,4 @@ -# pylint: disable=missing-docstring, too-few-public-methods, import-error,unused-argument, useless-object-inheritance +# pylint: disable=missing-docstring, too-few-public-methods, import-error,unused-argument import abc @@ -6,7 +6,7 @@ import six from unknown import Unknown -class InvalidAsMetaclass(object): +class InvalidAsMetaclass: pass @@ -15,38 +15,38 @@ class ValidAsMetaclass(type): @six.add_metaclass(type) -class FirstGood(object): +class FirstGood: pass @six.add_metaclass(abc.ABCMeta) -class SecondGood(object): +class SecondGood: pass @six.add_metaclass(Unknown) -class ThirdGood(object): +class ThirdGood: pass @six.add_metaclass(ValidAsMetaclass) -class FourthGood(object): +class FourthGood: pass -class FirstInvalid(object, metaclass=int): # [invalid-metaclass] +class FirstInvalid(metaclass=int): # [invalid-metaclass] pass -class SecondInvalid(object, metaclass=InvalidAsMetaclass): # [invalid-metaclass] +class SecondInvalid(metaclass=InvalidAsMetaclass): # [invalid-metaclass] pass -class ThirdInvalid(object, metaclass=2): # [invalid-metaclass] +class ThirdInvalid(metaclass=2): # [invalid-metaclass] pass -class FourthInvalid(object, metaclass=InvalidAsMetaclass()): # [invalid-metaclass] +class FourthInvalid(metaclass=InvalidAsMetaclass()): # [invalid-metaclass] pass diff --git a/tests/functional/i/invalid/invalid_repr_returned.py b/tests/functional/i/invalid/invalid_repr_returned.py index 80fe38bb5..afcc217a8 100644 --- a/tests/functional/i/invalid/invalid_repr_returned.py +++ b/tests/functional/i/invalid/invalid_repr_returned.py @@ -1,19 +1,19 @@ """Check invalid value returned by __repr__ """ -# pylint: disable=too-few-public-methods,missing-docstring,import-error,useless-object-inheritance,unnecessary-lambda-assignment +# pylint: disable=too-few-public-methods,missing-docstring,import-error,unnecessary-lambda-assignment import six from missing import Missing -class FirstGoodRepr(object): +class FirstGoodRepr: """__repr__ returns <type 'str'>""" def __repr__(self): return "some repr" -class SecondGoodRepr(object): +class SecondGoodRepr: """__repr__ returns <type 'str'>""" def __repr__(self): @@ -26,38 +26,38 @@ class ReprMetaclass(type): @six.add_metaclass(ReprMetaclass) -class ThirdGoodRepr(object): +class ThirdGoodRepr: """Repr through the metaclass.""" -class FirstBadRepr(object): +class FirstBadRepr: """ __repr__ returns bytes """ def __repr__(self): # [invalid-repr-returned] return b"123" -class SecondBadRepr(object): +class SecondBadRepr: """ __repr__ returns int """ def __repr__(self): # [invalid-repr-returned] return 1 -class ThirdBadRepr(object): +class ThirdBadRepr: """ __repr__ returns node which does not have 'value' in AST """ def __repr__(self): # [invalid-repr-returned] return lambda: "some repr" -class AmbiguousRepr(object): +class AmbiguousRepr: """ Uninferable return value """ __repr__ = lambda self: Missing -class AnotherAmbiguousRepr(object): +class AnotherAmbiguousRepr: """Potential uninferable return value""" def __repr__(self): diff --git a/tests/functional/i/invalid/invalid_sequence_index.py b/tests/functional/i/invalid/invalid_sequence_index.py index 3dd941f9f..ec12b6e94 100644 --- a/tests/functional/i/invalid/invalid_sequence_index.py +++ b/tests/functional/i/invalid/invalid_sequence_index.py @@ -1,5 +1,5 @@ """Errors for invalid sequence indices""" -# pylint: disable=too-few-public-methods, import-error, missing-docstring, useless-object-inheritance, unnecessary-pass +# pylint: disable=too-few-public-methods, import-error, missing-docstring, unnecessary-pass import six from unknown import Unknown @@ -26,7 +26,7 @@ def function4(): def function5(): """list index does not implement __index__""" - class NonIndexType(object): + class NonIndexType: """Class without __index__ method""" pass @@ -62,7 +62,7 @@ def function11(): def function12(): """list index implements __index__""" - class IndexType(object): + class IndexType: """Class with __index__ method""" def __index__(self): """Allow objects of this class to be used as slice indices""" @@ -72,7 +72,7 @@ def function12(): def function13(): """list index implements __index__ in a superclass""" - class IndexType(object): + class IndexType: """Class with __index__ method""" def __index__(self): """Allow objects of this class to be used as slice indices""" @@ -209,7 +209,7 @@ def function25(): def function26(): """Extended slice used with an object that implements __getitem__""" - class ExtSliceTest(object): + class ExtSliceTest: """Permit extslice syntax by implementing __getitem__""" def __getitem__(self, index): return 0 @@ -232,7 +232,7 @@ def function28(): return 24 @six.add_metaclass(Meta) - class Works(object): + class Works: pass @six.add_metaclass(Meta) diff --git a/tests/functional/i/invalid/invalid_slice_index.py b/tests/functional/i/invalid/invalid_slice_index.py index 894742a2f..2e5d2cdb0 100644 --- a/tests/functional/i/invalid/invalid_slice_index.py +++ b/tests/functional/i/invalid/invalid_slice_index.py @@ -1,5 +1,5 @@ """Errors for invalid slice indices""" -# pylint: disable=too-few-public-methods,missing-docstring,expression-not-assigned,useless-object-inheritance,unnecessary-pass +# pylint: disable=too-few-public-methods,missing-docstring,expression-not-assigned,unnecessary-pass TESTLIST = [1, 2, 3] @@ -16,7 +16,7 @@ def function2(): def function3(): """class without __index__ used as index""" - class NoIndexTest(object): + class NoIndexTest: """Class with no __index__ method""" pass @@ -33,7 +33,7 @@ def function5(): def function6(): """class with __index__ used as index""" - class IndexTest(object): + class IndexTest: """Class with __index__ method""" def __index__(self): """Allow objects of this class to be used as slice indices""" @@ -43,7 +43,7 @@ def function6(): def function7(): """class with __index__ in superclass used as index""" - class IndexType(object): + class IndexType: """Class with __index__ method""" def __index__(self): """Allow objects of this class to be used as slice indices""" diff --git a/tests/functional/i/invalid/invalid_str_returned.py b/tests/functional/i/invalid/invalid_str_returned.py index dac98b50a..d02aef148 100644 --- a/tests/functional/i/invalid/invalid_str_returned.py +++ b/tests/functional/i/invalid/invalid_str_returned.py @@ -1,19 +1,19 @@ """Check invalid value returned by __str__ """ -# pylint: disable=too-few-public-methods,missing-docstring,import-error,useless-object-inheritance,unnecessary-lambda-assignment +# pylint: disable=too-few-public-methods,missing-docstring,import-error,unnecessary-lambda-assignment import six from missing import Missing -class FirstGoodStr(object): +class FirstGoodStr: """__str__ returns <type 'str'>""" def __str__(self): return "some str" -class SecondGoodStr(object): +class SecondGoodStr: """__str__ returns <type 'str'>""" def __str__(self): @@ -26,38 +26,38 @@ class StrMetaclass(type): @six.add_metaclass(StrMetaclass) -class ThirdGoodStr(object): +class ThirdGoodStr: """Str through the metaclass.""" -class FirstBadStr(object): +class FirstBadStr: """ __str__ returns bytes """ def __str__(self): # [invalid-str-returned] return b"123" -class SecondBadStr(object): +class SecondBadStr: """ __str__ returns int """ def __str__(self): # [invalid-str-returned] return 1 -class ThirdBadStr(object): +class ThirdBadStr: """ __str__ returns node which does not have 'value' in AST """ def __str__(self): # [invalid-str-returned] return lambda: "some str" -class AmbiguousStr(object): +class AmbiguousStr: """ Uninferable return value """ __str__ = lambda self: Missing -class AnotherAmbiguousStr(object): +class AnotherAmbiguousStr: """Potential uninferable return value""" def __str__(self): diff --git a/tests/functional/i/invalid/invalid_unary_operand_type.py b/tests/functional/i/invalid/invalid_unary_operand_type.py index e7231c34d..5881f89ec 100644 --- a/tests/functional/i/invalid/invalid_unary_operand_type.py +++ b/tests/functional/i/invalid/invalid_unary_operand_type.py @@ -1,11 +1,11 @@ """Detect problems with invalid operands used on invalid objects."""
# pylint: disable=missing-docstring,too-few-public-methods,invalid-name
-# pylint: disable=unused-variable, useless-object-inheritance, use-dict-literal
+# pylint: disable=unused-variable, use-dict-literal
import collections
-class Implemented(object):
+class Implemented:
def __invert__(self):
return 42
def __pos__(self):
@@ -42,7 +42,7 @@ def these_are_bad(): neg_str = -"" # [invalid-unary-operand-type]
invert_str = ~"" # [invalid-unary-operand-type]
pos_str = +"" # [invalid-unary-operand-type]
- class A(object):
+ class A:
pass
invert_func = ~(lambda: None) # [invalid-unary-operand-type]
invert_class = ~A # [invalid-unary-operand-type]
diff --git a/tests/functional/i/iterable_context.py b/tests/functional/i/iterable_context.py index 643cacd53..bc77ade34 100644 --- a/tests/functional/i/iterable_context.py +++ b/tests/functional/i/iterable_context.py @@ -2,9 +2,8 @@ Checks that primitive values are not used in an iterating/mapping context. """ -# pylint: disable=missing-docstring,invalid-name,too-few-public-methods,import-error,unused-argument,bad-mcs-method-argument,wrong-import-position,no-else-return, useless-object-inheritance, unnecessary-comprehension,redundant-u-string-prefix -from __future__ import print_function - +# pylint: disable=missing-docstring,invalid-name,too-few-public-methods,import-error,unused-argument,bad-mcs-method-argument, +# pylint: disable=wrong-import-position,no-else-return, unnecessary-comprehension,redundant-u-string-prefix # primitives numbers = [1, 2, 3] @@ -59,10 +58,10 @@ for i in powers_of_two: # [not-an-iterable] pass # check for custom iterators -class A(object): +class A: pass -class B(object): +class B: def __iter__(self): return self @@ -72,7 +71,7 @@ class B(object): def next(self): return 1 -class C(object): +class C: "old-style iterator" def __getitem__(self, k): if k > 10: @@ -128,7 +127,7 @@ for i in m: print(i) # skip checks if statement is inside mixin/base/abstract class -class ManagedAccessViewMixin(object): +class ManagedAccessViewMixin: access_requirements = None def get_access_requirements(self): @@ -141,7 +140,7 @@ class ManagedAccessViewMixin(object): for requirement in classes: print(requirement) -class BaseType(object): +class BaseType: valid_values = None def validate(self, value): @@ -154,7 +153,7 @@ class BaseType(object): return True return False -class AbstractUrlMarkManager(object): +class AbstractUrlMarkManager: def __init__(self): self._lineparser = None self._init_lineparser() @@ -167,7 +166,7 @@ class AbstractUrlMarkManager(object): # class is not named as abstract # but still is deduceably abstract -class UrlMarkManager(object): +class UrlMarkManager: def __init__(self): self._lineparser = None self._init_lineparser() @@ -179,7 +178,7 @@ class UrlMarkManager(object): raise NotImplementedError -class HasDynamicGetattr(object): +class HasDynamicGetattr: def __init__(self): self._obj = [] diff --git a/tests/functional/i/iterable_context.txt b/tests/functional/i/iterable_context.txt index ef59b379c..e0ca8c4fe 100644 --- a/tests/functional/i/iterable_context.txt +++ b/tests/functional/i/iterable_context.txt @@ -1,10 +1,10 @@ -not-an-iterable:58:9:58:22::Non-iterable value powers_of_two is used in an iterating context:UNDEFINED -not-an-iterable:93:6:93:9::Non-iterable value A() is used in an iterating context:UNDEFINED -not-an-iterable:95:6:95:7::Non-iterable value B is used in an iterating context:UNDEFINED -not-an-iterable:96:9:96:12::Non-iterable value A() is used in an iterating context:UNDEFINED -not-an-iterable:100:9:100:10::Non-iterable value B is used in an iterating context:UNDEFINED -not-an-iterable:103:9:103:14::Non-iterable value range is used in an iterating context:UNDEFINED -not-an-iterable:107:9:107:13::Non-iterable value True is used in an iterating context:UNDEFINED -not-an-iterable:110:9:110:13::Non-iterable value None is used in an iterating context:UNDEFINED -not-an-iterable:113:9:113:12::Non-iterable value 8.5 is used in an iterating context:UNDEFINED -not-an-iterable:116:9:116:11::Non-iterable value 10 is used in an iterating context:UNDEFINED +not-an-iterable:57:9:57:22::Non-iterable value powers_of_two is used in an iterating context:UNDEFINED +not-an-iterable:92:6:92:9::Non-iterable value A() is used in an iterating context:UNDEFINED +not-an-iterable:94:6:94:7::Non-iterable value B is used in an iterating context:UNDEFINED +not-an-iterable:95:9:95:12::Non-iterable value A() is used in an iterating context:UNDEFINED +not-an-iterable:99:9:99:10::Non-iterable value B is used in an iterating context:UNDEFINED +not-an-iterable:102:9:102:14::Non-iterable value range is used in an iterating context:UNDEFINED +not-an-iterable:106:9:106:13::Non-iterable value True is used in an iterating context:UNDEFINED +not-an-iterable:109:9:109:13::Non-iterable value None is used in an iterating context:UNDEFINED +not-an-iterable:112:9:112:12::Non-iterable value 8.5 is used in an iterating context:UNDEFINED +not-an-iterable:115:9:115:11::Non-iterable value 10 is used in an iterating context:UNDEFINED diff --git a/tests/functional/k/keyword_arg_before_vararg.py b/tests/functional/k/keyword_arg_before_vararg.py index 119287410..9824aac95 100644 --- a/tests/functional/k/keyword_arg_before_vararg.py +++ b/tests/functional/k/keyword_arg_before_vararg.py @@ -1,7 +1,6 @@ """Unittests for W1125 (kw args before *args)""" -from __future__ import absolute_import, print_function -# pylint: disable=unused-argument, useless-object-inheritance, unnecessary-pass +# pylint: disable=unused-argument, unnecessary-pass def check_kwargs_before_args(param1, param2=2, *args): # [keyword-arg-before-vararg] """docstring""" pass @@ -9,7 +8,7 @@ def check_kwargs_before_args(param1, param2=2, *args): # [keyword-arg-before-var check_kwargs_before_args(5) # pylint: disable=too-few-public-methods, invalid-name -class AAAA(object): +class AAAA: """class AAAA""" def func_in_class(self, param1, param2=2, *args): # [keyword-arg-before-vararg] "method in class AAAA" diff --git a/tests/functional/k/keyword_arg_before_vararg.txt b/tests/functional/k/keyword_arg_before_vararg.txt index 87a88f1a4..2a5987200 100644 --- a/tests/functional/k/keyword_arg_before_vararg.txt +++ b/tests/functional/k/keyword_arg_before_vararg.txt @@ -1,4 +1,4 @@ -keyword-arg-before-vararg:5:0:5:28:check_kwargs_before_args:Keyword argument before variable positional arguments list in the definition of check_kwargs_before_args function:UNDEFINED -keyword-arg-before-vararg:14:4:14:21:AAAA.func_in_class:Keyword argument before variable positional arguments list in the definition of func_in_class function:UNDEFINED -keyword-arg-before-vararg:19:4:19:30:AAAA.static_method_in_class:Keyword argument before variable positional arguments list in the definition of static_method_in_class function:UNDEFINED -keyword-arg-before-vararg:24:4:24:29:AAAA.class_method_in_class:Keyword argument before variable positional arguments list in the definition of class_method_in_class function:UNDEFINED +keyword-arg-before-vararg:4:0:4:28:check_kwargs_before_args:Keyword argument before variable positional arguments list in the definition of check_kwargs_before_args function:UNDEFINED +keyword-arg-before-vararg:13:4:13:21:AAAA.func_in_class:Keyword argument before variable positional arguments list in the definition of func_in_class function:UNDEFINED +keyword-arg-before-vararg:18:4:18:30:AAAA.static_method_in_class:Keyword argument before variable positional arguments list in the definition of static_method_in_class function:UNDEFINED +keyword-arg-before-vararg:23:4:23:29:AAAA.class_method_in_class:Keyword argument before variable positional arguments list in the definition of class_method_in_class function:UNDEFINED diff --git a/tests/functional/l/lambda_use_before_assign.py b/tests/functional/l/lambda_use_before_assign.py index f3df31bd4..c604e8fbf 100644 --- a/tests/functional/l/lambda_use_before_assign.py +++ b/tests/functional/l/lambda_use_before_assign.py @@ -1,8 +1,7 @@ """https://www.logilab.net/elo/ticket/18862""" # pylint: disable=unnecessary-lambda-assignment -from __future__ import print_function -__revision__ = 1 + def function(): """hop""" ggg = lambda: xxx diff --git a/tests/functional/l/line/line_too_long_with_utf8_2.py b/tests/functional/l/line/line_too_long_with_utf8_2.py index 138e4e299..288f63db0 100644 --- a/tests/functional/l/line/line_too_long_with_utf8_2.py +++ b/tests/functional/l/line/line_too_long_with_utf8_2.py @@ -2,7 +2,6 @@ """this utf-8 doc string have some non ASCII characters like 'é', or '¢»ß'""" ### check also comments with some more non ASCII characters like 'é' or '¢»ß' -__revision__ = 1100 ASCII = "----------------------------------------------------------------------" UTF_8 = "--------------------------------------------------------------------éé" diff --git a/tests/functional/l/logging/logging_not_lazy_with_logger.py b/tests/functional/l/logging/logging_not_lazy_with_logger.py index 69d0e9bd4..ad94d32e1 100644 --- a/tests/functional/l/logging/logging_not_lazy_with_logger.py +++ b/tests/functional/l/logging/logging_not_lazy_with_logger.py @@ -3,7 +3,6 @@ from __future__ import absolute_import import logging -__revision__ = '' LOG = logging.getLogger("domain") LOG.debug("%s" % "junk") # [logging-not-lazy] diff --git a/tests/functional/l/logging/logging_not_lazy_with_logger.txt b/tests/functional/l/logging/logging_not_lazy_with_logger.txt index 908d02b65..6496c6e52 100644 --- a/tests/functional/l/logging/logging_not_lazy_with_logger.txt +++ b/tests/functional/l/logging/logging_not_lazy_with_logger.txt @@ -1,4 +1,4 @@ -logging-not-lazy:9:0:9:24::Use lazy % formatting in logging functions:UNDEFINED -logging-not-lazy:10:0:10:37::Use lazy % formatting in logging functions:UNDEFINED -logging-not-lazy:12:0:12:19::Use lazy % formatting in logging functions:UNDEFINED -logging-not-lazy:14:0:14:48::Use lazy % formatting in logging functions:UNDEFINED +logging-not-lazy:8:0:8:24::Use lazy % formatting in logging functions:UNDEFINED +logging-not-lazy:9:0:9:37::Use lazy % formatting in logging functions:UNDEFINED +logging-not-lazy:11:0:11:19::Use lazy % formatting in logging functions:UNDEFINED +logging-not-lazy:13:0:13:48::Use lazy % formatting in logging functions:UNDEFINED diff --git a/tests/functional/l/loopvar_in_dict_comp.py b/tests/functional/l/loopvar_in_dict_comp.py index 072ea1bf5..cc204c93f 100644 --- a/tests/functional/l/loopvar_in_dict_comp.py +++ b/tests/functional/l/loopvar_in_dict_comp.py @@ -1,7 +1,5 @@ """Tests for loopvar-in-closure.""" -__revision__ = 0 - def bad_case(): """Loop variable from dict comprehension.""" diff --git a/tests/functional/l/loopvar_in_dict_comp.txt b/tests/functional/l/loopvar_in_dict_comp.txt index b8fab5f9c..881a49ccc 100644 --- a/tests/functional/l/loopvar_in_dict_comp.txt +++ b/tests/functional/l/loopvar_in_dict_comp.txt @@ -1 +1 @@ -cell-var-from-loop:8:23:8:24:bad_case.<lambda>:Cell variable x defined in loop:UNDEFINED +cell-var-from-loop:6:23:6:24:bad_case.<lambda>:Cell variable x defined in loop:UNDEFINED diff --git a/tests/functional/m/mapping_context.py b/tests/functional/m/mapping_context.py index 506477694..1d8a46afc 100644 --- a/tests/functional/m/mapping_context.py +++ b/tests/functional/m/mapping_context.py @@ -1,8 +1,7 @@ """ Checks that only valid values are used in a mapping context. """ -# pylint: disable=missing-docstring,invalid-name,too-few-public-methods,import-error,wrong-import-position, useless-object-inheritance -from __future__ import print_function +# pylint: disable=missing-docstring,invalid-name,too-few-public-methods,import-error,wrong-import-position def test(**kwargs): @@ -18,7 +17,7 @@ test(**dict_comp) # in order to be used in kwargs custom mapping class should define # __iter__(), __getitem__(key) and keys(). -class CustomMapping(object): +class CustomMapping: def __init__(self): self.data = dict(a=1, b=2, c=3, d=4, e=5) @@ -31,13 +30,13 @@ class CustomMapping(object): test(**CustomMapping()) test(**CustomMapping) # [not-a-mapping] -class NotMapping(object): +class NotMapping: pass test(**NotMapping()) # [not-a-mapping] # skip checks if statement is inside mixin/base/abstract class -class SomeMixin(object): +class SomeMixin: kwargs = None def get_kwargs(self): @@ -50,7 +49,7 @@ class SomeMixin(object): kws = self.get_kwargs() self.run(**kws) -class AbstractThing(object): +class AbstractThing: kwargs = None def get_kwargs(self): @@ -63,7 +62,7 @@ class AbstractThing(object): kws = self.get_kwargs() self.run(**kws) -class BaseThing(object): +class BaseThing: kwargs = None def get_kwargs(self): @@ -77,7 +76,7 @@ class BaseThing(object): self.run(**kws) # abstract class -class Thing(object): +class Thing: def get_kwargs(self): raise NotImplementedError @@ -97,7 +96,7 @@ class MyClass(Mapping): test(**MyClass()) -class HasDynamicGetattr(object): +class HasDynamicGetattr: def __init__(self): self._obj = {} diff --git a/tests/functional/m/mapping_context.txt b/tests/functional/m/mapping_context.txt index 7391d6765..ce144dc31 100644 --- a/tests/functional/m/mapping_context.txt +++ b/tests/functional/m/mapping_context.txt @@ -1,2 +1,2 @@ -not-a-mapping:32:7:32:20::Non-mapping value CustomMapping is used in a mapping context:UNDEFINED -not-a-mapping:37:7:37:19::Non-mapping value NotMapping() is used in a mapping context:UNDEFINED +not-a-mapping:31:7:31:20::Non-mapping value CustomMapping is used in a mapping context:UNDEFINED +not-a-mapping:36:7:36:19::Non-mapping value NotMapping() is used in a mapping context:UNDEFINED diff --git a/tests/functional/m/mapping_context_py3.py b/tests/functional/m/mapping_context_py3.py index 3646910d8..4865fbb77 100644 --- a/tests/functional/m/mapping_context_py3.py +++ b/tests/functional/m/mapping_context_py3.py @@ -1,5 +1,5 @@ # pylint: disable=missing-docstring,invalid-name,too-few-public-methods -from __future__ import print_function + def test(**kwargs): print(kwargs) diff --git a/tests/functional/m/member/member_checks.py b/tests/functional/m/member/member_checks.py index 22b853d73..ff109d659 100644 --- a/tests/functional/m/member/member_checks.py +++ b/tests/functional/m/member/member_checks.py @@ -1,7 +1,7 @@ -# pylint: disable=missing-docstring,too-few-public-methods,bare-except,broad-except, useless-object-inheritance, unused-private-member +# pylint: disable=missing-docstring,too-few-public-methods,bare-except,broad-except, unused-private-member # pylint: disable=using-constant-test,expression-not-assigned, assigning-non-slot, unused-variable,pointless-statement, wrong-import-order, wrong-import-position,import-outside-toplevel -from __future__ import print_function -class Provider(object): + +class Provider: """provide some attributes and method""" cattr = 4 def __init__(self): @@ -14,7 +14,7 @@ class Provider(object): print('hop hop hop', self) -class Client(object): +class Client: """use provider class""" def __init__(self): @@ -64,17 +64,17 @@ class Client(object): super().misssing() # [no-member] -class Mixin(object): +class Mixin: """No no-member should be emitted for mixins.""" -class Getattr(object): +class Getattr: """no-member shouldn't be emitted for classes with dunder getattr.""" def __getattr__(self, attr): return self.__dict__[attr] -class Getattribute(object): +class Getattribute: """no-member shouldn't be emitted for classes with dunder getattribute.""" def __getattribute__(self, attr): @@ -164,13 +164,13 @@ def no_conjugate_member(magic_flag): return something.conjugate() -class NoDunderNameInInstance(object): +class NoDunderNameInInstance: """Emit a warning when accessing __name__ from an instance.""" def __init__(self): self.var = self.__name__ # [no-member] -class InvalidAccessBySlots(object): +class InvalidAccessBySlots: __slots__ = ('a', ) def __init__(self): var = self.teta # [no-member] @@ -183,13 +183,13 @@ class MetaWithDynamicGetattr(type): return attr -class SomeClass(object, metaclass=MetaWithDynamicGetattr): +class SomeClass(metaclass=MetaWithDynamicGetattr): pass SomeClass.does_not_exist -class ClassWithMangledAttribute(object): +class ClassWithMangledAttribute: def __init__(self): self.name = 'Bug1643' def __bar(self): diff --git a/tests/functional/m/member/member_checks_hints.py b/tests/functional/m/member/member_checks_hints.py index 3925f4741..f8f5dfcfc 100644 --- a/tests/functional/m/member/member_checks_hints.py +++ b/tests/functional/m/member/member_checks_hints.py @@ -1,7 +1,7 @@ -# pylint: disable=missing-docstring, too-few-public-methods, pointless-statement, useless-object-inheritance +# pylint: disable=missing-docstring, too-few-public-methods, pointless-statement -class Parent(object): +class Parent: def __init__(self): self._parent = 42 diff --git a/tests/functional/m/member/member_checks_no_hints.py b/tests/functional/m/member/member_checks_no_hints.py index 3925f4741..f8f5dfcfc 100644 --- a/tests/functional/m/member/member_checks_no_hints.py +++ b/tests/functional/m/member/member_checks_no_hints.py @@ -1,7 +1,7 @@ -# pylint: disable=missing-docstring, too-few-public-methods, pointless-statement, useless-object-inheritance +# pylint: disable=missing-docstring, too-few-public-methods, pointless-statement -class Parent(object): +class Parent: def __init__(self): self._parent = 42 diff --git a/tests/functional/m/membership_protocol.py b/tests/functional/m/membership_protocol.py index 152c27704..10bec9603 100644 --- a/tests/functional/m/membership_protocol.py +++ b/tests/functional/m/membership_protocol.py @@ -1,4 +1,4 @@ -# pylint: disable=missing-docstring,pointless-statement,expression-not-assigned,too-few-public-methods,import-error,wrong-import-position,no-else-return, comparison-with-itself, useless-object-inheritance, redundant-u-string-prefix comparison-of-constants +# pylint: disable=missing-docstring,pointless-statement,expression-not-assigned,too-few-public-methods,import-error,wrong-import-position,no-else-return, comparison-with-itself, redundant-u-string-prefix comparison-of-constants # standard types 1 in [1, 2, 3] @@ -30,20 +30,20 @@ def count(upto=float("inf")): 10 in count(upto=10) # custom instance -class UniversalContainer(object): +class UniversalContainer: def __contains__(self, key): return True 42 in UniversalContainer() # custom iterable -class CustomIterable(object): +class CustomIterable: def __iter__(self): return iter((1, 2, 3)) 3 in CustomIterable() # old-style iterable -class OldStyleIterable(object): +class OldStyleIterable: def __getitem__(self, key): if key < 10: return 2 ** key @@ -60,7 +60,7 @@ class MaybeIterable(ImportedClass): 10 in MaybeIterable() # do not emit warning inside mixins/abstract/base classes -class UsefulMixin(object): +class UsefulMixin: stuff = None def get_stuff(self): @@ -71,7 +71,7 @@ class UsefulMixin(object): if thing in stuff: pass -class BaseThing(object): +class BaseThing: valid_values = None def validate(self, value): @@ -81,7 +81,7 @@ class BaseThing(object): # error should not be emitted here return value in self.valid_values -class AbstractThing(object): +class AbstractThing: valid_values = None def validate(self, value): @@ -93,7 +93,7 @@ class AbstractThing(object): # class is not named as abstract # but still is deduceably abstract -class Thing(object): +class Thing: valid_values = None def __init__(self): @@ -114,7 +114,7 @@ class Thing(object): 42 not in None # [unsupported-membership-test] 42 in 8.5 # [unsupported-membership-test] -class EmptyClass(object): +class EmptyClass: pass 42 not in EmptyClass() # [unsupported-membership-test] diff --git a/tests/functional/m/metaclass_attr_access.py b/tests/functional/m/metaclass_attr_access.py index 50f9712fa..7d1faa5f5 100644 --- a/tests/functional/m/metaclass_attr_access.py +++ b/tests/functional/m/metaclass_attr_access.py @@ -1,8 +1,6 @@ -# pylint: disable=too-few-public-methods, useless-object-inheritance +# pylint: disable=too-few-public-methods """test attribute access on metaclass""" -from __future__ import print_function - class Meta(type): """the meta class""" @@ -12,7 +10,7 @@ class Meta(type): delattr(cls, '_meta_args') -class Test(object): +class Test: """metaclassed class""" __metaclass__ = Meta _meta_args = ('foo', 'bar') diff --git a/tests/functional/m/method_hidden.py b/tests/functional/m/method_hidden.py index e31bc16c4..ea94b3ca2 100644 --- a/tests/functional/m/method_hidden.py +++ b/tests/functional/m/method_hidden.py @@ -1,11 +1,10 @@ -# pylint: disable=too-few-public-methods, useless-object-inheritance,missing-docstring +# pylint: disable=too-few-public-methods,missing-docstring # pylint: disable=unused-private-member """check method hiding ancestor attribute """ -from __future__ import print_function -class Abcd(object): +class Abcd: """dummy""" def __init__(self): diff --git a/tests/functional/m/method_hidden.txt b/tests/functional/m/method_hidden.txt index 23651bd4a..abce3cd40 100644 --- a/tests/functional/m/method_hidden.txt +++ b/tests/functional/m/method_hidden.txt @@ -1,3 +1,3 @@ -method-hidden:18:4:18:12:Cdef.abcd:An attribute defined in functional.m.method_hidden line 12 hides this method:UNDEFINED -method-hidden:86:4:86:11:One.one:An attribute defined in functional.m.method_hidden line 84 hides this method:UNDEFINED -method-hidden:113:4:113:18:Child._protected:An attribute defined in functional.m.method_hidden line 109 hides this method:UNDEFINED +method-hidden:17:4:17:12:Cdef.abcd:An attribute defined in functional.m.method_hidden line 11 hides this method:UNDEFINED +method-hidden:85:4:85:11:One.one:An attribute defined in functional.m.method_hidden line 83 hides this method:UNDEFINED +method-hidden:112:4:112:18:Child._protected:An attribute defined in functional.m.method_hidden line 108 hides this method:UNDEFINED diff --git a/tests/functional/m/misplaced_bare_raise.py b/tests/functional/m/misplaced_bare_raise.py index 2170e5f36..b1b399da3 100644 --- a/tests/functional/m/misplaced_bare_raise.py +++ b/tests/functional/m/misplaced_bare_raise.py @@ -1,5 +1,5 @@ # pylint: disable=missing-docstring, broad-except, unreachable, try-except-raise, raise-missing-from
-# pylint: disable=unused-variable, too-few-public-methods, invalid-name, useless-object-inheritance
+# pylint: disable=unused-variable, too-few-public-methods, invalid-name
# pylint: disable=comparison-of-constants
try:
@@ -49,7 +49,7 @@ finally: raise # [misplaced-bare-raise]
-class A(object):
+class A:
try:
pass
except Exception:
@@ -68,7 +68,7 @@ if exc: raise # [misplaced-bare-raise]
# Don't emit if we're in ``__exit__``.
-class ContextManager(object):
+class ContextManager:
def __enter__(self):
return self
def __exit__(self, *args):
diff --git a/tests/functional/m/missing/missing_docstring.py b/tests/functional/m/missing/missing_docstring.py index 72d6762aa..3b7a679df 100644 --- a/tests/functional/m/missing/missing_docstring.py +++ b/tests/functional/m/missing/missing_docstring.py @@ -1,5 +1,5 @@ # [missing-module-docstring]
-# pylint: disable=too-few-public-methods, useless-object-inheritance
+# pylint: disable=too-few-public-methods
def public_documented():
"""It has a docstring."""
@@ -14,11 +14,11 @@ def _private_documented(): """It has a docstring."""
-class ClassDocumented(object):
+class ClassDocumented:
"""It has a docstring."""
-class ClassUndocumented(object): # [missing-class-docstring]
+class ClassUndocumented: # [missing-class-docstring]
pass
@@ -35,7 +35,7 @@ def __mangled(): pass
-class Property(object):
+class Property:
"""Don't warn about setters and deleters."""
def __init__(self):
@@ -54,5 +54,5 @@ class Property(object): pass
-class DocumentedViaDunderDoc(object):
+class DocumentedViaDunderDoc:
__doc__ = "This one"
diff --git a/tests/functional/m/missing/missing_parentheses_for_call_in_test.py b/tests/functional/m/missing/missing_parentheses_for_call_in_test.py index aa1f8eefd..36c515ed9 100644 --- a/tests/functional/m/missing/missing_parentheses_for_call_in_test.py +++ b/tests/functional/m/missing/missing_parentheses_for_call_in_test.py @@ -1,5 +1,5 @@ """Verify if call to function or method inside tests are missing parentheses.""" -# pylint: disable=using-constant-test, missing-docstring, useless-object-inheritance +# pylint: disable=using-constant-test, missing-docstring # pylint: disable=invalid-name, expression-not-assigned, unnecessary-lambda-assignment import collections @@ -12,7 +12,7 @@ def nonbool_function(): return 42 -class Class(object): +class Class: @staticmethod def bool_method(): diff --git a/tests/functional/m/missing/missing_self_argument.py b/tests/functional/m/missing/missing_self_argument.py index 79ae34879..e3d3015dd 100644 --- a/tests/functional/m/missing/missing_self_argument.py +++ b/tests/functional/m/missing/missing_self_argument.py @@ -1,9 +1,8 @@ """Checks that missing self in method defs don't crash Pylint.""" -# pylint: disable=useless-object-inheritance -class MyClass(object): +class MyClass: """A class with some methods missing self args.""" def __init__(self): diff --git a/tests/functional/m/missing/missing_self_argument.txt b/tests/functional/m/missing/missing_self_argument.txt index 14a9a9863..4809022ec 100644 --- a/tests/functional/m/missing/missing_self_argument.txt +++ b/tests/functional/m/missing/missing_self_argument.txt @@ -1,3 +1,3 @@ -no-method-argument:12:4:12:14:MyClass.method:Method has no argument:UNDEFINED -no-method-argument:15:4:15:13:MyClass.setup:Method has no argument:UNDEFINED -undefined-variable:17:8:17:12:MyClass.setup:Undefined variable 'self':UNDEFINED +no-method-argument:11:4:11:14:MyClass.method:Method has no argument:UNDEFINED +no-method-argument:14:4:14:13:MyClass.setup:Method has no argument:UNDEFINED +undefined-variable:16:8:16:12:MyClass.setup:Undefined variable 'self':UNDEFINED diff --git a/tests/functional/m/module___dict__.py b/tests/functional/m/module___dict__.py index 8b2154c95..2b8aa041f 100644 --- a/tests/functional/m/module___dict__.py +++ b/tests/functional/m/module___dict__.py @@ -1,6 +1,5 @@ """https://www.logilab.org/ticket/6949.""" -from __future__ import print_function -__revision__ = None + print(__dict__ is not None) # [used-before-assignment] diff --git a/tests/functional/m/module___dict__.txt b/tests/functional/m/module___dict__.txt index a62def231..aacbf9c30 100644 --- a/tests/functional/m/module___dict__.txt +++ b/tests/functional/m/module___dict__.txt @@ -1 +1 @@ -used-before-assignment:5:6:5:14::Using variable '__dict__' before assignment:HIGH +used-before-assignment:4:6:4:14::Using variable '__dict__' before assignment:HIGH diff --git a/tests/functional/m/monkeypatch_method.py b/tests/functional/m/monkeypatch_method.py index e8bd03aa7..ab6d1c97f 100644 --- a/tests/functional/m/monkeypatch_method.py +++ b/tests/functional/m/monkeypatch_method.py @@ -1,7 +1,7 @@ -# pylint: disable=missing-docstring,too-few-public-methods, useless-object-inheritance +# pylint: disable=missing-docstring,too-few-public-methods '''Test that a function is considered a method when looked up through a class.''' -class Clazz(object): +class Clazz: 'test class' def __init__(self, value): diff --git a/tests/functional/n/name/name_styles.py b/tests/functional/n/name/name_styles.py index 86f395b52..8c71e7937 100644 --- a/tests/functional/n/name/name_styles.py +++ b/tests/functional/n/name/name_styles.py @@ -1,6 +1,6 @@ """Test for the invalid-name warning.""" -# pylint: disable=useless-object-inheritance, unnecessary-pass, unnecessary-comprehension, unused-private-member, unnecessary-lambda-assignment -from __future__ import print_function +# pylint: disable=unnecessary-pass, unnecessary-comprehension, unused-private-member +# pylint: disable=unnecessary-lambda-assignment import abc import collections import typing @@ -27,11 +27,11 @@ def no_nested_args(arg1, arg21, arg22): print(arg1, arg21, arg22) -class bad_class_name(object): # [invalid-name] +class bad_class_name: # [invalid-name] """Class with a bad name.""" -class CorrectClassName(object): +class CorrectClassName: """Class with a good name.""" def __init__(self): @@ -74,7 +74,7 @@ V = [WHAT_Ever_inListComp for WHAT_Ever_inListComp in GOOD_CONST_NAME] def class_builder(): """Function returning a class object.""" - class EmbeddedClass(object): + class EmbeddedClass: """Useless class.""" return EmbeddedClass @@ -99,7 +99,7 @@ def test_globals(): AlsoCorrect = 2 -class FooClass(object): +class FooClass: """A test case for property names. Since by default, the regex for attributes is the same as the one diff --git a/tests/functional/n/namedtuple_member_inference.py b/tests/functional/n/namedtuple_member_inference.py index 4488ceb0a..09dc6dd44 100644 --- a/tests/functional/n/namedtuple_member_inference.py +++ b/tests/functional/n/namedtuple_member_inference.py @@ -3,10 +3,8 @@ Regression test for: https://bitbucket.org/logilab/pylint/issue/93/pylint-crashes-on-namedtuple-attribute """ -from __future__ import absolute_import, print_function from collections import namedtuple -__revision__ = None Thing = namedtuple('Thing', ()) diff --git a/tests/functional/n/namedtuple_member_inference.txt b/tests/functional/n/namedtuple_member_inference.txt index c4e778359..9156eeeb7 100644 --- a/tests/functional/n/namedtuple_member_inference.txt +++ b/tests/functional/n/namedtuple_member_inference.txt @@ -1 +1 @@ -no-member:17:10:17:17:test:Class 'Thing' has no 'x' member:INFERENCE +no-member:15:10:15:17:test:Class 'Thing' has no 'x' member:INFERENCE diff --git a/tests/functional/n/names_in__all__.py b/tests/functional/n/names_in__all__.py index 52c44f7fa..38ed18a2e 100644 --- a/tests/functional/n/names_in__all__.py +++ b/tests/functional/n/names_in__all__.py @@ -1,4 +1,4 @@ -# pylint: disable=too-few-public-methods, import-error, useless-object-inheritance, unnecessary-pass +# pylint: disable=too-few-public-methods, import-error, unnecessary-pass """Test Pylint's use of __all__. * NonExistant is not defined in this module, and it is listed in @@ -7,7 +7,6 @@ * This module imports path and republished it in __all__. No errors are expected. """ -from __future__ import print_function from os import path from collections import deque from missing import Missing @@ -24,7 +23,7 @@ __all__ = [ 'InnerKlass', deque.__name__] # [undefined-all-variable] -class Dummy(object): +class Dummy: """A class defined in this module.""" pass @@ -37,13 +36,13 @@ def function(): function() -class Klass(object): +class Klass: """A klass which contains a function""" def func(self): """A klass method""" inner = None print(inner) - class InnerKlass(object): + class InnerKlass: """An inner klass""" pass diff --git a/tests/functional/n/names_in__all__.txt b/tests/functional/n/names_in__all__.txt index 72a11c50b..720942df3 100644 --- a/tests/functional/n/names_in__all__.txt +++ b/tests/functional/n/names_in__all__.txt @@ -1,6 +1,6 @@ -undefined-all-variable:17:4:17:6::Undefined variable name '' in __all__:UNDEFINED -undefined-variable:19:4:19:17::Undefined variable 'SomeUndefined':UNDEFINED -undefined-all-variable:20:4:20:17::Undefined variable name 'NonExistant' in __all__:UNDEFINED -undefined-all-variable:22:4:22:10::Undefined variable name 'func' in __all__:UNDEFINED -undefined-all-variable:23:4:23:11::Undefined variable name 'inner' in __all__:UNDEFINED -undefined-all-variable:24:4:24:16::Undefined variable name 'InnerKlass' in __all__:UNDEFINED +undefined-all-variable:16:4:16:6::Undefined variable name '' in __all__:UNDEFINED +undefined-variable:18:4:18:17::Undefined variable 'SomeUndefined':UNDEFINED +undefined-all-variable:19:4:19:17::Undefined variable name 'NonExistant' in __all__:UNDEFINED +undefined-all-variable:21:4:21:10::Undefined variable name 'func' in __all__:UNDEFINED +undefined-all-variable:22:4:22:11::Undefined variable name 'inner' in __all__:UNDEFINED +undefined-all-variable:23:4:23:16::Undefined variable name 'InnerKlass' in __all__:UNDEFINED diff --git a/tests/functional/n/new_style_class_py_30.py b/tests/functional/n/new_style_class_py_30.py index b70c6e097..888a6c4e4 100644 --- a/tests/functional/n/new_style_class_py_30.py +++ b/tests/functional/n/new_style_class_py_30.py @@ -2,8 +2,6 @@ bug notified by Pierre Rouleau on 2005-04-24 """ -from __future__ import print_function -__revision__ = None class File(file): # pylint: disable=undefined-variable diff --git a/tests/functional/n/new_style_class_py_30.txt b/tests/functional/n/new_style_class_py_30.txt index ad22100f3..cb65bc04d 100644 --- a/tests/functional/n/new_style_class_py_30.txt +++ b/tests/functional/n/new_style_class_py_30.txt @@ -1,4 +1,4 @@ -super-with-arguments:15:8:15:25:File.__init__:Consider using Python 3 style super() without arguments:UNDEFINED -super-with-arguments:21:8:21:25:File.write:Consider using Python 3 style super() without arguments:UNDEFINED -super-with-arguments:26:8:26:25:File.writelines:Consider using Python 3 style super() without arguments:UNDEFINED -super-with-arguments:33:8:33:25:File.close:Consider using Python 3 style super() without arguments:UNDEFINED +super-with-arguments:13:8:13:25:File.__init__:Consider using Python 3 style super() without arguments:UNDEFINED +super-with-arguments:19:8:19:25:File.write:Consider using Python 3 style super() without arguments:UNDEFINED +super-with-arguments:24:8:24:25:File.writelines:Consider using Python 3 style super() without arguments:UNDEFINED +super-with-arguments:31:8:31:25:File.close:Consider using Python 3 style super() without arguments:UNDEFINED diff --git a/tests/functional/n/no/no_classmethod_decorator.py b/tests/functional/n/no/no_classmethod_decorator.py index 66cc0b3c0..096faa708 100644 --- a/tests/functional/n/no/no_classmethod_decorator.py +++ b/tests/functional/n/no/no_classmethod_decorator.py @@ -2,9 +2,9 @@ scope and if classmethod's argument is a member of the class """ -# pylint: disable=too-few-public-methods, using-constant-test, no-self-argument, useless-object-inheritance +# pylint: disable=too-few-public-methods, using-constant-test, no-self-argument -class MyClass(object): +class MyClass: """Some class""" def __init__(self): pass @@ -30,6 +30,6 @@ def helloworld(): MyClass.new_class_method = classmethod(helloworld) -class MyOtherClass(object): +class MyOtherClass: """Some other class""" _make = classmethod(tuple.__new__) diff --git a/tests/functional/n/no/no_dummy_redefined.py b/tests/functional/n/no/no_dummy_redefined.py index c6b093dad..5a03ed5e4 100644 --- a/tests/functional/n/no/no_dummy_redefined.py +++ b/tests/functional/n/no/no_dummy_redefined.py @@ -1,5 +1,4 @@ """Make sure warnings about redefinitions do not trigger for dummy variables.""" -from __future__ import print_function _, INTERESTING = 'a=b'.split('=') diff --git a/tests/functional/n/no/no_dummy_redefined.txt b/tests/functional/n/no/no_dummy_redefined.txt index 1cf7c979b..467116c16 100644 --- a/tests/functional/n/no/no_dummy_redefined.txt +++ b/tests/functional/n/no/no_dummy_redefined.txt @@ -1,2 +1,2 @@ -invalid-name:7:0:7:5::"Constant name ""value"" doesn't conform to UPPER_CASE naming style":HIGH -redefined-outer-name:12:4:12:9:clobbering:Redefining name 'value' from outer scope (line 7):UNDEFINED +invalid-name:6:0:6:5::"Constant name ""value"" doesn't conform to UPPER_CASE naming style":HIGH +redefined-outer-name:11:4:11:9:clobbering:Redefining name 'value' from outer scope (line 6):UNDEFINED diff --git a/tests/functional/n/no/no_name_in_module.py b/tests/functional/n/no/no_name_in_module.py index d8e77a5b8..26c0079b6 100644 --- a/tests/functional/n/no/no_name_in_module.py +++ b/tests/functional/n/no/no_name_in_module.py @@ -1,7 +1,7 @@ # pylint: disable=wildcard-import,unused-import,invalid-name,import-error # pylint: disable=bare-except,broad-except,wrong-import-order,ungrouped-imports,wrong-import-position """check nonexistent names imported are reported""" -from __future__ import print_function + import collections.tutu # [no-name-in-module] from collections import toto # [no-name-in-module] toto.yo() diff --git a/tests/functional/n/no/no_self_argument_py37.py b/tests/functional/n/no/no_self_argument_py37.py index 8e6d6fc34..c1b195f07 100644 --- a/tests/functional/n/no/no_self_argument_py37.py +++ b/tests/functional/n/no/no_self_argument_py37.py @@ -1,9 +1,9 @@ """Test detection of self as argument of first method in Python 3.7 and above.""" -# pylint: disable=missing-docstring,too-few-public-methods,useless-object-inheritance +# pylint: disable=missing-docstring,too-few-public-methods -class Toto(object): +class Toto: def __class_getitem__(cls, params): # This is actually a special method which is always a class method. diff --git a/tests/functional/n/no/no_staticmethod_decorator.py b/tests/functional/n/no/no_staticmethod_decorator.py index d0e0effa4..ce14c839a 100644 --- a/tests/functional/n/no/no_staticmethod_decorator.py +++ b/tests/functional/n/no/no_staticmethod_decorator.py @@ -2,9 +2,9 @@ scope and if static method's argument is a member of the class """ -# pylint: disable=too-few-public-methods, using-constant-test, no-method-argument, useless-object-inheritance +# pylint: disable=too-few-public-methods, using-constant-test, no-method-argument -class MyClass(object): +class MyClass: """Some class""" def __init__(self): pass @@ -30,6 +30,6 @@ def helloworld(): MyClass.new_static_method = staticmethod(helloworld) -class MyOtherClass(object): +class MyOtherClass: """Some other class""" _make = staticmethod(tuple.__new__) diff --git a/tests/functional/n/no/no_warning_docstring.py b/tests/functional/n/no/no_warning_docstring.py index 315eeeaab..c0d63df3f 100644 --- a/tests/functional/n/no/no_warning_docstring.py +++ b/tests/functional/n/no/no_warning_docstring.py @@ -1,8 +1,8 @@ ''' Test for inheritance ''' -from __future__ import print_function + __revision__ = 1 -# pylint: disable=too-few-public-methods, using-constant-test, useless-object-inheritance -class AAAA(object): +# pylint: disable=too-few-public-methods, using-constant-test +class AAAA: ''' class AAAA ''' def __init__(self): diff --git a/tests/functional/n/non/non_init_parent_called.py b/tests/functional/n/non/non_init_parent_called.py index 0721703b2..7a6c94ead 100644 --- a/tests/functional/n/non/non_init_parent_called.py +++ b/tests/functional/n/non/non_init_parent_called.py @@ -1,20 +1,19 @@ # pylint: disable=protected-access,import-self,too-few-public-methods,line-too-long -# pylint: disable=wrong-import-order, useless-object-inheritance, unnecessary-dunder-call +# pylint: disable=wrong-import-order, unnecessary-dunder-call """test for call to __init__ from a non ancestor class """ -from __future__ import print_function from . import non_init_parent_called import nonexistant # [import-error] -__revision__ = '$Id: non_init_parent_called.py,v 1.2 2004-09-29 08:35:13 syt Exp $' -class AAAA(object): + +class AAAA: """ancestor 1""" def __init__(self): print('init', self) BBBBMixin.__init__(self) # [non-parent-init-called] -class BBBBMixin(object): +class BBBBMixin: """ancestor 2""" def __init__(self): diff --git a/tests/functional/n/non/non_init_parent_called.txt b/tests/functional/n/non/non_init_parent_called.txt index 0d9e227c2..d6ef10e9f 100644 --- a/tests/functional/n/non/non_init_parent_called.txt +++ b/tests/functional/n/non/non_init_parent_called.txt @@ -1,5 +1,5 @@ -import-error:7:0:7:18::Unable to import 'nonexistant':UNDEFINED -non-parent-init-called:15:8:15:26:AAAA.__init__:__init__ method from a non direct base class 'BBBBMixin' is called:UNDEFINED -no-member:23:50:23:77:CCC:Module 'functional.n.non.non_init_parent_called' has no 'BBBB' member:INFERENCE -no-member:28:8:28:35:CCC.__init__:Module 'functional.n.non.non_init_parent_called' has no 'BBBB' member:INFERENCE -no-member:51:8:51:23:Super2.__init__:Super of 'Super2' has no '__woohoo__' member:INFERENCE +import-error:6:0:6:18::Unable to import 'nonexistant':UNDEFINED +non-parent-init-called:14:8:14:26:AAAA.__init__:__init__ method from a non direct base class 'BBBBMixin' is called:UNDEFINED +no-member:22:50:22:77:CCC:Module 'functional.n.non.non_init_parent_called' has no 'BBBB' member:INFERENCE +no-member:27:8:27:35:CCC.__init__:Module 'functional.n.non.non_init_parent_called' has no 'BBBB' member:INFERENCE +no-member:50:8:50:23:Super2.__init__:Super of 'Super2' has no '__woohoo__' member:INFERENCE diff --git a/tests/functional/n/non/non_iterator_returned.py b/tests/functional/n/non/non_iterator_returned.py index de83f68a2..85c869329 100644 --- a/tests/functional/n/non/non_iterator_returned.py +++ b/tests/functional/n/non/non_iterator_returned.py @@ -1,9 +1,9 @@ """Check non-iterators returned by __iter__ """ -# pylint: disable=too-few-public-methods, missing-docstring, useless-object-inheritance, consider-using-with +# pylint: disable=too-few-public-methods, missing-docstring, consider-using-with -class FirstGoodIterator(object): +class FirstGoodIterator: """ yields in iterator. """ def __iter__(self): @@ -11,7 +11,7 @@ class FirstGoodIterator(object): yield index -class SecondGoodIterator(object): +class SecondGoodIterator: """ __iter__ and next """ def __iter__(self): @@ -26,14 +26,14 @@ class SecondGoodIterator(object): return 1 -class ThirdGoodIterator(object): +class ThirdGoodIterator: """ Returns other iterator, not the current instance """ def __iter__(self): return SecondGoodIterator() -class FourthGoodIterator(object): +class FourthGoodIterator: """ __iter__ returns iter(...) """ def __iter__(self): @@ -48,18 +48,18 @@ class IteratorMetaclass(type): return 2 -class IteratorClass(object, metaclass=IteratorMetaclass): +class IteratorClass(metaclass=IteratorMetaclass): """Iterable through the metaclass.""" -class FifthGoodIterator(object): +class FifthGoodIterator: """__iter__ returns a class which uses an iterator-metaclass.""" def __iter__(self): return IteratorClass -class FileBasedIterator(object): +class FileBasedIterator: def __init__(self, path): self.path = path self.file = None @@ -73,28 +73,28 @@ class FileBasedIterator(object): return self.file -class FirstBadIterator(object): +class FirstBadIterator: """ __iter__ returns a list """ def __iter__(self): # [non-iterator-returned] return [] -class SecondBadIterator(object): +class SecondBadIterator: """ __iter__ without next """ def __iter__(self): # [non-iterator-returned] return self -class ThirdBadIterator(object): +class ThirdBadIterator: """ __iter__ returns an instance of another non-iterator """ def __iter__(self): # [non-iterator-returned] return SecondBadIterator() -class FourthBadIterator(object): +class FourthBadIterator: """__iter__ returns a class.""" def __iter__(self): # [non-iterator-returned] diff --git a/tests/functional/n/nonlocal_without_binding.py b/tests/functional/n/nonlocal_without_binding.py index 2b10db1a3..c05a012b1 100644 --- a/tests/functional/n/nonlocal_without_binding.py +++ b/tests/functional/n/nonlocal_without_binding.py @@ -1,5 +1,5 @@ """ Checks that reversed() receive proper argument """ -# pylint: disable=missing-docstring,invalid-name,unused-variable, useless-object-inheritance +# pylint: disable=missing-docstring,invalid-name,unused-variable # pylint: disable=too-few-public-methods @@ -36,7 +36,7 @@ def func(): c = 1 -class SomeClass(object): +class SomeClass: nonlocal x # [nonlocal-without-binding] def func(self): diff --git a/tests/functional/n/not_async_context_manager.py b/tests/functional/n/not_async_context_manager.py index 138d76dfa..5fb6d6a0d 100644 --- a/tests/functional/n/not_async_context_manager.py +++ b/tests/functional/n/not_async_context_manager.py @@ -1,5 +1,5 @@ """Test that an async context manager receives a proper object."""
-# pylint: disable=missing-docstring, import-error, too-few-public-methods, useless-object-inheritance
+# pylint: disable=missing-docstring, import-error, too-few-public-methods
import contextlib
from ala import Portocala
@@ -10,17 +10,17 @@ def ctx_manager(): yield
-class ContextManager(object):
+class ContextManager:
def __enter__(self):
pass
def __exit__(self, *args):
pass
-class PartialAsyncContextManager(object):
+class PartialAsyncContextManager:
def __aenter__(self):
pass
-class SecondPartialAsyncContextManager(object):
+class SecondPartialAsyncContextManager:
def __aexit__(self, *args):
pass
@@ -29,16 +29,16 @@ class UnknownBases(Portocala): pass
-class AsyncManagerMixin(object):
+class AsyncManagerMixin:
pass
-class GoodAsyncManager(object):
+class GoodAsyncManager:
def __aenter__(self):
pass
def __aexit__(self, *args):
pass
-class InheritExit(object):
+class InheritExit:
def __aexit__(self, *args):
pass
diff --git a/tests/functional/n/not_callable.py b/tests/functional/n/not_callable.py index bd90fc999..f781150a2 100644 --- a/tests/functional/n/not_callable.py +++ b/tests/functional/n/not_callable.py @@ -1,4 +1,4 @@ -# pylint: disable=missing-docstring,too-few-public-methods,wrong-import-position,useless-object-inheritance,use-dict-literal +# pylint: disable=missing-docstring,too-few-public-methods,wrong-import-position,use-dict-literal # pylint: disable=wrong-import-order, undefined-variable REVISION = None @@ -10,10 +10,10 @@ def correct(): REVISION = correct() -class Correct(object): +class Correct: """callable object""" -class MetaCorrect(object): +class MetaCorrect: """callable object""" def __call__(self): return self @@ -37,7 +37,7 @@ INCORRECT = INT() # [not-callable] class MyProperty(property): """ test subclasses """ -class PropertyTest(object): +class PropertyTest: """ class """ def __init__(self): @@ -69,7 +69,7 @@ PROP.custom() # [not-callable] # Safe from not-callable when using properties. -class SafeProperty(object): +class SafeProperty: @property def static(self): return staticmethod @@ -98,7 +98,7 @@ class SafeProperty(object): @property def instance(self): - class Empty(object): + class Empty: def __call__(self): return 42 return Empty() diff --git a/tests/functional/n/not_context_manager.py b/tests/functional/n/not_context_manager.py index 2678f265e..b7d0c5a7a 100644 --- a/tests/functional/n/not_context_manager.py +++ b/tests/functional/n/not_context_manager.py @@ -1,9 +1,9 @@ """Tests that onjects used in a with statement implement context manager protocol""" # pylint: disable=too-few-public-methods, invalid-name, import-error, missing-docstring -# pylint: disable=wrong-import-position, useless-object-inheritance +# pylint: disable=wrong-import-position # Tests no messages for objects that implement the protocol -class Manager(object): +class Manager: def __enter__(self): pass def __exit__(self, type_, value, traceback): @@ -18,7 +18,7 @@ with AnotherManager(): # Tests message for class that doesn't implement the protocol -class NotAManager(object): +class NotAManager: pass with NotAManager(): #[not-context-manager] pass @@ -70,7 +70,7 @@ with wrapper(): # Tests for properties returning managers. -class Property(object): +class Property: @property def ctx(self): @@ -98,7 +98,7 @@ with TestKnownBases(): pass # Ignore mixins. -class ManagerMixin(object): +class ManagerMixin: def test(self): with self: pass diff --git a/tests/functional/n/not_in_loop.py b/tests/functional/n/not_in_loop.py index f7319eef7..7fffba279 100644 --- a/tests/functional/n/not_in_loop.py +++ b/tests/functional/n/not_in_loop.py @@ -1,6 +1,6 @@ """Test that not-in-loop is detected properly.""" # pylint: disable=missing-docstring, invalid-name, too-few-public-methods -# pylint: disable=useless-else-on-loop, using-constant-test, useless-object-inheritance +# pylint: disable=useless-else-on-loop, using-constant-test # pylint: disable=no-else-continue while True: @@ -16,7 +16,7 @@ def lala(): continue # [not-in-loop] while True: - class A(object): + class A: continue # [not-in-loop] for _ in range(10): diff --git a/tests/functional/o/object_as_class_attribute.py b/tests/functional/o/object_as_class_attribute.py index 2ac729b36..8e44abcb9 100644 --- a/tests/functional/o/object_as_class_attribute.py +++ b/tests/functional/o/object_as_class_attribute.py @@ -1,4 +1,4 @@ -# pylint: disable=too-few-public-methods,useless-object-inheritance +# pylint: disable=too-few-public-methods """Test case for the problem described below : - A class extends 'object' - This class defines its own __init__() @@ -9,9 +9,8 @@ object.__init__() """ -__revision__ = None -class Statement(object): +class Statement: """ ... """ def __init__(self): pass diff --git a/tests/functional/o/overloaded_operator.py b/tests/functional/o/overloaded_operator.py index c14fb651f..d375238dd 100644 --- a/tests/functional/o/overloaded_operator.py +++ b/tests/functional/o/overloaded_operator.py @@ -1,8 +1,8 @@ -# pylint: disable=missing-docstring,too-few-public-methods,useless-object-inheritance +# pylint: disable=missing-docstring,too-few-public-methods """#3291""" -from __future__ import print_function -class Myarray(object): + +class Myarray: def __init__(self, array): self.array = array diff --git a/tests/functional/o/overridden_final_method_py38.py b/tests/functional/o/overridden_final_method_py38.py index 26498e777..252ea3c01 100644 --- a/tests/functional/o/overridden_final_method_py38.py +++ b/tests/functional/o/overridden_final_method_py38.py @@ -1,7 +1,7 @@ """Since Python version 3.8, a method decorated with typing.final cannot be overridden""" -# pylint: disable=useless-object-inheritance, missing-docstring, too-few-public-methods +# pylint: disable=missing-docstring, too-few-public-methods from typing import final diff --git a/tests/functional/p/property_affectation_py26.py b/tests/functional/p/property_affectation_py26.py index 323cf2d05..ce13eb207 100644 --- a/tests/functional/p/property_affectation_py26.py +++ b/tests/functional/p/property_affectation_py26.py @@ -1,11 +1,10 @@ -# pylint: disable=too-few-public-methods, useless-object-inheritance +# pylint: disable=too-few-public-methods """ Simple test case for an annoying behavior in pylint. """ -__revision__ = 'pouet' -class Test(object): +class Test: """Smallest test case for reported issue.""" def __init__(self): diff --git a/tests/functional/r/raising/raising_non_exception.py b/tests/functional/r/raising/raising_non_exception.py index 1b9156528..e3040cdf4 100644 --- a/tests/functional/r/raising/raising_non_exception.py +++ b/tests/functional/r/raising/raising_non_exception.py @@ -3,11 +3,11 @@ Previously, it didn't, due to a bug in the check for bad-exception-cause, which prevented further checking on the Raise node. """ -# pylint: disable=import-error, too-few-public-methods, useless-object-inheritance +# pylint: disable=import-error, too-few-public-methods from missing_module import missing -class Exc(object): +class Exc: """Not an actual exception.""" raise Exc from missing # [raising-non-exception] diff --git a/tests/functional/r/recursion/recursion_error_940.py b/tests/functional/r/recursion/recursion_error_940.py index 4a9f346cb..cffbe24dc 100644 --- a/tests/functional/r/recursion/recursion_error_940.py +++ b/tests/functional/r/recursion/recursion_error_940.py @@ -1,4 +1,4 @@ -# pylint: disable=missing-docstring, too-few-public-methods, useless-object-inheritance +# pylint: disable=missing-docstring, too-few-public-methods import datetime @@ -8,6 +8,6 @@ class NewDate(datetime.date): return cls(2010, 1, 1) -class Next(object): +class Next: def __init__(self): datetime.date = NewDate diff --git a/tests/functional/r/redefined/redefined_builtin.py b/tests/functional/r/redefined/redefined_builtin.py index 47d4e35ba..9cb454dd0 100644 --- a/tests/functional/r/redefined/redefined_builtin.py +++ b/tests/functional/r/redefined/redefined_builtin.py @@ -1,7 +1,6 @@ """Tests for redefining builtins.""" # pylint: disable=unused-import, wrong-import-position, reimported, import-error # pylint: disable=redefined-outer-name, import-outside-toplevel, wrong-import-order -from __future__ import print_function def function(): diff --git a/tests/functional/r/redefined/redefined_builtin.txt b/tests/functional/r/redefined/redefined_builtin.txt index eb4b14101..f37135c66 100644 --- a/tests/functional/r/redefined/redefined_builtin.txt +++ b/tests/functional/r/redefined/redefined_builtin.txt @@ -1,3 +1,3 @@ -redefined-builtin:9:4:9:8:function:Redefining built-in 'type':UNDEFINED -redefined-builtin:14:0:14:3::Redefining built-in 'map':UNDEFINED -redefined-builtin:19:0:19:22::Redefining built-in 'open':UNDEFINED +redefined-builtin:8:4:8:8:function:Redefining built-in 'type':UNDEFINED +redefined-builtin:13:0:13:3::Redefining built-in 'map':UNDEFINED +redefined-builtin:18:0:18:22::Redefining built-in 'open':UNDEFINED diff --git a/tests/functional/r/regression/regression___file___global.py b/tests/functional/r/regression/regression___file___global.py index 9ad2eed02..192ce7153 100644 --- a/tests/functional/r/regression/regression___file___global.py +++ b/tests/functional/r/regression/regression___file___global.py @@ -4,5 +4,3 @@ def func(): """override __file__""" global __file__ # [global-statement, redefined-builtin] __file__ = 'hop' - -__revision__ = 'pouet' diff --git a/tests/functional/r/reimport.py b/tests/functional/r/reimport.py index defe51959..86f273d3b 100644 --- a/tests/functional/r/reimport.py +++ b/tests/functional/r/reimport.py @@ -1,6 +1,5 @@ """check reimport """ -from __future__ import absolute_import, print_function # pylint: disable=using-constant-test,ungrouped-imports,wrong-import-position,import-outside-toplevel import os diff --git a/tests/functional/r/reimport.txt b/tests/functional/r/reimport.txt index 7825858d2..27db45a99 100644 --- a/tests/functional/r/reimport.txt +++ b/tests/functional/r/reimport.txt @@ -1,4 +1,4 @@ -reimported:8:0:8:9::Reimport 'os' (imported line 6):UNDEFINED -reimported:16:4:16:30::Reimport 'exists' (imported line 7):UNDEFINED -reimported:21:4:21:20:func:Reimport 'os' (imported line 6):UNDEFINED -reimported:23:4:23:13:func:Reimport 're' (imported line 9):UNDEFINED +reimported:7:0:7:9::Reimport 'os' (imported line 5):UNDEFINED +reimported:15:4:15:30::Reimport 'exists' (imported line 6):UNDEFINED +reimported:20:4:20:20:func:Reimport 'os' (imported line 5):UNDEFINED +reimported:22:4:22:13:func:Reimport 're' (imported line 8):UNDEFINED diff --git a/tests/functional/r/reimported.py b/tests/functional/r/reimported.py index 03b07c4d6..5584ff039 100644 --- a/tests/functional/r/reimported.py +++ b/tests/functional/r/reimported.py @@ -15,9 +15,6 @@ from itertools import OrderedDict as NotOrderedDict from itertools import *
from os import *
-# pylint: disable=misplaced-future
-from __future__ import absolute_import, print_function
-
import sys
import xml.etree.ElementTree
@@ -27,7 +24,6 @@ from email import encoders import email.encoders # [reimported]
import sys # [reimported] #pylint: disable=ungrouped-imports,wrong-import-order
-__revision__ = 0
def no_reimport():
"""docstring"""
diff --git a/tests/functional/r/reimported.txt b/tests/functional/r/reimported.txt index 41b06eba3..96d8c4ffb 100644 --- a/tests/functional/r/reimported.txt +++ b/tests/functional/r/reimported.txt @@ -2,8 +2,8 @@ reimported:3:0:3:29::Reimport 'sleep' (imported line 3):UNDEFINED reimported:4:0:4:33::Reimport 'missing' (imported line 4):UNDEFINED reimported:7:0:7:15::Reimport 'missing1' (imported line 6):UNDEFINED reimported:10:0:10:27::Reimport 'deque' (imported line 9):UNDEFINED -reimported:24:0:24:33::Reimport 'ElementTree' (imported line 23):UNDEFINED -reimported:27:0:27:21::Reimport 'email.encoders' (imported line 26):UNDEFINED -reimported:29:0:29:10::Reimport 'sys' (imported line 21):UNDEFINED -redefined-outer-name:40:4:40:14:reimport:Redefining name 'sys' from outer scope (line 16):UNDEFINED -reimported:40:4:40:14:reimport:Reimport 'sys' (imported line 21):UNDEFINED +reimported:21:0:21:33::Reimport 'ElementTree' (imported line 20):UNDEFINED +reimported:24:0:24:21::Reimport 'email.encoders' (imported line 23):UNDEFINED +reimported:26:0:26:10::Reimport 'sys' (imported line 18):UNDEFINED +redefined-outer-name:36:4:36:14:reimport:Redefining name 'sys' from outer scope (line 16):UNDEFINED +reimported:36:4:36:14:reimport:Reimport 'sys' (imported line 18):UNDEFINED diff --git a/tests/functional/r/return_in_init.py b/tests/functional/r/return_in_init.py index bf0aa064f..886ae73cc 100644 --- a/tests/functional/r/return_in_init.py +++ b/tests/functional/r/return_in_init.py @@ -1,24 +1,24 @@ -# pylint: disable=missing-docstring,too-few-public-methods,useless-return, useless-object-inheritance +# pylint: disable=missing-docstring,too-few-public-methods,useless-return -class MyClass(object): +class MyClass: def __init__(self): # [return-in-init] return 1 -class MyClass2(object): +class MyClass2: """dummy class""" def __init__(self): return -class MyClass3(object): +class MyClass3: """dummy class""" def __init__(self): return None -class MyClass5(object): +class MyClass5: """dummy class""" def __init__(self): diff --git a/tests/functional/s/self/self_cls_assignment.py b/tests/functional/s/self/self_cls_assignment.py index a9da8767c..820531c61 100644 --- a/tests/functional/s/self/self_cls_assignment.py +++ b/tests/functional/s/self/self_cls_assignment.py @@ -1,8 +1,7 @@ """Warning about assigning self/cls variable.""" -from __future__ import print_function -# pylint: disable=too-few-public-methods, useless-object-inheritance +# pylint: disable=too-few-public-methods -class Foo(object): +class Foo: """Class with methods that check for self/cls assignment""" # pylint: disable=no-self-argument diff --git a/tests/functional/s/self/self_cls_assignment.txt b/tests/functional/s/self/self_cls_assignment.txt index efc6b5f95..dd3383e38 100644 --- a/tests/functional/s/self/self_cls_assignment.txt +++ b/tests/functional/s/self/self_cls_assignment.txt @@ -1,5 +1,5 @@ -self-cls-assignment:11:8:11:17:Foo.self_foo:Invalid assignment to bar_ in method:UNDEFINED -self-cls-assignment:15:8:15:19:Foo.self_foofoo:Invalid assignment to self in method:UNDEFINED -self-cls-assignment:16:8:16:27:Foo.self_foofoo:Invalid assignment to self in method:UNDEFINED -self-cls-assignment:22:8:22:20:Foo.cls_foo:Invalid assignment to cls in method:UNDEFINED -self-cls-assignment:45:12:45:24:TestNonLocal.function._set_param:Invalid assignment to self in method:UNDEFINED +self-cls-assignment:10:8:10:17:Foo.self_foo:Invalid assignment to bar_ in method:UNDEFINED +self-cls-assignment:14:8:14:19:Foo.self_foofoo:Invalid assignment to self in method:UNDEFINED +self-cls-assignment:15:8:15:27:Foo.self_foofoo:Invalid assignment to self in method:UNDEFINED +self-cls-assignment:21:8:21:20:Foo.cls_foo:Invalid assignment to cls in method:UNDEFINED +self-cls-assignment:44:12:44:24:TestNonLocal.function._set_param:Invalid assignment to self in method:UNDEFINED diff --git a/tests/functional/s/signature_differs.py b/tests/functional/s/signature_differs.py index 45631bbd6..929921cf3 100644 --- a/tests/functional/s/signature_differs.py +++ b/tests/functional/s/signature_differs.py @@ -1,6 +1,6 @@ -# pylint: disable=too-few-public-methods, missing-docstring, useless-object-inheritance +# pylint: disable=too-few-public-methods, missing-docstring -class Abcd(object): +class Abcd: def __init__(self): self.aarg = False diff --git a/tests/functional/s/singledispatch_functions.py b/tests/functional/s/singledispatch_functions.py index cfd4d873c..931bfd30d 100644 --- a/tests/functional/s/singledispatch_functions.py +++ b/tests/functional/s/singledispatch_functions.py @@ -1,6 +1,5 @@ # pylint: disable=missing-docstring,import-error,unused-import,assignment-from-no-return -# pylint: disable=invalid-name, too-few-public-methods, useless-object-inheritance -from __future__ import print_function +# pylint: disable=invalid-name, too-few-public-methods from UNINFERABLE import uninferable_func try: @@ -11,7 +10,7 @@ except ImportError: my_single_dispatch = singledispatch -class FakeSingleDispatch(object): +class FakeSingleDispatch: @staticmethod def register(function): diff --git a/tests/functional/s/singledispatch_functions.txt b/tests/functional/s/singledispatch_functions.txt index 88973375f..93fc30496 100644 --- a/tests/functional/s/singledispatch_functions.txt +++ b/tests/functional/s/singledispatch_functions.txt @@ -1,5 +1,5 @@ -unused-variable:60:4:60:10:_:Unused variable 'unused':UNDEFINED -unused-argument:65:24:65:27:not_single_dispatch:Unused argument 'arg':HIGH -unused-argument:70:24:70:27:bad_single_dispatch:Unused argument 'arg':HIGH -function-redefined:75:0:75:23:bad_single_dispatch:function already defined line 70:UNDEFINED -unused-argument:75:24:75:27:bad_single_dispatch:Unused argument 'arg':HIGH +unused-variable:59:4:59:10:_:Unused variable 'unused':UNDEFINED +unused-argument:64:24:64:27:not_single_dispatch:Unused argument 'arg':HIGH +unused-argument:69:24:69:27:bad_single_dispatch:Unused argument 'arg':HIGH +function-redefined:74:0:74:23:bad_single_dispatch:function already defined line 69:UNDEFINED +unused-argument:74:24:74:27:bad_single_dispatch:Unused argument 'arg':HIGH diff --git a/tests/functional/s/slots_checks.py b/tests/functional/s/slots_checks.py index 2cae34acd..e8d55d967 100644 --- a/tests/functional/s/slots_checks.py +++ b/tests/functional/s/slots_checks.py @@ -1,6 +1,6 @@ """ Checks that classes uses valid __slots__ """ -# pylint: disable=too-few-public-methods, missing-docstring, useless-object-inheritance +# pylint: disable=too-few-public-methods, missing-docstring # pylint: disable=using-constant-test, wrong-import-position, no-else-return, line-too-long, unused-private-member from collections import deque @@ -11,26 +11,26 @@ def func(): return [str(var) for var in range(3)] -class NotIterable(object): +class NotIterable: def __iter_(self): """ do nothing """ -class Good(object): +class Good: __slots__ = () -class SecondGood(object): +class SecondGood: __slots__ = [] -class ThirdGood(object): +class ThirdGood: __slots__ = ['a'] -class FourthGood(object): +class FourthGood: __slots__ = (f'a{i}' for i in range(10)) -class FifthGood(object): +class FifthGood: __slots__ = deque(["a", "b", "c"]) -class SixthGood(object): +class SixthGood: __slots__ = {"a": "b", "c": "d"} class SeventhGood: @@ -45,34 +45,34 @@ class EigthGood: else: __slots__ = ("y",) -class Bad(object): # [invalid-slots] +class Bad: # [invalid-slots] __slots__ = list -class SecondBad(object): # [invalid-slots] +class SecondBad: # [invalid-slots] __slots__ = 1 -class ThirdBad(object): +class ThirdBad: __slots__ = ('a', 2) # [invalid-slots-object] -class FourthBad(object): # [invalid-slots] +class FourthBad: # [invalid-slots] __slots__ = NotIterable() -class FifthBad(object): +class FifthBad: __slots__ = ("a", "b", "") # [invalid-slots-object] -class SixthBad(object): # [single-string-used-for-slots] +class SixthBad: # [single-string-used-for-slots] __slots__ = "a" -class SeventhBad(object): # [single-string-used-for-slots] +class SeventhBad: # [single-string-used-for-slots] __slots__ = ('foo') -class EighthBad(object): # [single-string-used-for-slots] +class EighthBad: # [single-string-used-for-slots] __slots__ = deque.__name__ -class NinthBad(object): +class NinthBad: __slots__ = [str] # [invalid-slots-object] -class TenthBad(object): +class TenthBad: __slots__ = [1 + 2 + 3] # [invalid-slots-object] class EleventhBad: # [invalid-slots] @@ -86,10 +86,10 @@ class TwelfthBad: # [invalid-slots] else: __slots__ = None -class PotentiallyGood(object): +class PotentiallyGood: __slots__ = func() -class PotentiallySecondGood(object): +class PotentiallySecondGood: __slots__ = ('a', deque.__name__) @@ -100,17 +100,17 @@ class Metaclass(type): yield str(value) -class IterableClass(object, metaclass=Metaclass): +class IterableClass(metaclass=Metaclass): pass -class PotentiallyThirdGood(object): +class PotentiallyThirdGood: __slots__ = IterableClass -class PotentiallyFourthGood(object): +class PotentiallyFourthGood: __slots__ = Good.__slots__ -class ValueInSlotConflict(object): +class ValueInSlotConflict: __slots__ = ('first', 'second', 'third', 'fourth') # [class-variable-slots-conflict, class-variable-slots-conflict, class-variable-slots-conflict] first = None @@ -122,7 +122,7 @@ class ValueInSlotConflict(object): return self.third -class Parent(object): +class Parent: first = 42 diff --git a/tests/functional/s/socketerror_import.py b/tests/functional/s/socketerror_import.py index df5de2957..f9403d966 100644 --- a/tests/functional/s/socketerror_import.py +++ b/tests/functional/s/socketerror_import.py @@ -1,6 +1,6 @@ """ds""" -from __future__ import absolute_import, print_function + from socket import error -__revision__ = '$Id: socketerror_import.py,v 1.2 2005-12-28 14:58:22 syt Exp $' + print(error) diff --git a/tests/functional/s/statement_without_effect.py b/tests/functional/s/statement_without_effect.py index 31fc7250f..60694ff96 100644 --- a/tests/functional/s/statement_without_effect.py +++ b/tests/functional/s/statement_without_effect.py @@ -1,5 +1,5 @@ """Test for statements without effects.""" -# pylint: disable=too-few-public-methods, useless-object-inheritance, unnecessary-comprehension, unnecessary-ellipsis, use-list-literal +# pylint: disable=too-few-public-methods, unnecessary-comprehension, unnecessary-ellipsis, use-list-literal # +1:[pointless-string-statement] """inline doc string should use a separated message""" @@ -35,7 +35,7 @@ to_be().title # [expression-not-assigned] GOOD_ATTRIBUTE_DOCSTRING = 42 """Module level attribute docstring is fine. """ -class ClassLevelAttributeTest(object): +class ClassLevelAttributeTest: """ test attribute docstrings. """ good_attribute_docstring = 24 diff --git a/tests/functional/s/statement_without_effect_py36.py b/tests/functional/s/statement_without_effect_py36.py index 59745ce2b..841ed5bd9 100644 --- a/tests/functional/s/statement_without_effect_py36.py +++ b/tests/functional/s/statement_without_effect_py36.py @@ -1,8 +1,8 @@ """Test for statements without effects.""" -# pylint: disable=too-few-public-methods, useless-object-inheritance +# pylint: disable=too-few-public-methods -class ClassLevelAttributeTest(object): +class ClassLevelAttributeTest: """ test attribute docstrings. """ some_variable: int = 42 diff --git a/tests/functional/s/string/string_formatting.py b/tests/functional/s/string/string_formatting.py index b72e9f676..cb88680e1 100644 --- a/tests/functional/s/string/string_formatting.py +++ b/tests/functional/s/string/string_formatting.py @@ -1,32 +1,32 @@ """Test for Python 3 string formatting error"""
# pylint: disable=too-few-public-methods, import-error, unused-argument, line-too-long,
-# pylint: disable=useless-object-inheritance, consider-using-f-string
+# pylint: disable=consider-using-f-string
import os
import sys
import logging
from missing import Missing
-class Custom(object):
+class Custom:
""" Has a __getattr__ """
def __getattr__(self, _):
return self
-class Test(object):
+class Test:
""" test format attribute access """
custom = Custom()
ids = [1, 2, 3, [4, 5, 6]]
-class Getitem(object):
+class Getitem:
""" test custom getitem for lookup access """
def __getitem__(self, index):
return 42
-class ReturnYes(object):
+class ReturnYes:
""" can't be properly inferred """
missing = Missing()
@@ -181,7 +181,7 @@ def issue373(): """
Ignore any object coming from an argument.
"""
- class SomeClass(object):
+ class SomeClass:
""" empty docstring. """
def __init__(self, opts=None):
self.opts = opts
diff --git a/tests/functional/s/string/string_formatting_error.py b/tests/functional/s/string/string_formatting_error.py index 681fedd56..0e57946ee 100644 --- a/tests/functional/s/string/string_formatting_error.py +++ b/tests/functional/s/string/string_formatting_error.py @@ -1,6 +1,5 @@ """test string format error""" # pylint: disable=unsupported-binary-operation,line-too-long, consider-using-f-string -from __future__ import print_function PARG_1 = PARG_2 = PARG_3 = 1 diff --git a/tests/functional/s/string/string_formatting_error.txt b/tests/functional/s/string/string_formatting_error.txt index fec5246d1..19653c617 100644 --- a/tests/functional/s/string/string_formatting_error.txt +++ b/tests/functional/s/string/string_formatting_error.txt @@ -1,15 +1,15 @@ -too-few-format-args:10:10:10:46:pprint:Not enough arguments for format string:UNDEFINED -too-many-format-args:11:10:11:33:pprint:Too many arguments for format string:UNDEFINED -mixed-format-string:12:10:12:54:pprint:Mixing named and unnamed conversion specifiers in format string:UNDEFINED -missing-format-string-key:13:10:13:49:pprint:Missing key 'PARG_2' in format string dictionary:UNDEFINED -unused-format-string-key:14:10:14:73:pprint:Unused key 'PARG_3' in format string dictionary:UNDEFINED -bad-format-string-key:15:10:15:54:pprint:Format string dictionary key should be a string, not 2:UNDEFINED -missing-format-string-key:15:10:15:54:pprint:Missing key 'PARG_2' in format string dictionary:UNDEFINED -format-needs-mapping:16:10:16:42:pprint:Expected mapping for format string, not Tuple:UNDEFINED -format-needs-mapping:17:10:17:42:pprint:Expected mapping for format string, not List:UNDEFINED -bad-format-character:18:10:18:24:pprint:Unsupported format character 'z' (0x7a) at index 2:UNDEFINED -truncated-format-string:19:10:19:38:pprint:Format string ends in middle of conversion specifier:UNDEFINED -format-string-without-interpolation:21:10:21:27:pprint:Using formatting for a string that does not have any interpolated variables:UNDEFINED +too-few-format-args:9:10:9:46:pprint:Not enough arguments for format string:UNDEFINED +too-many-format-args:10:10:10:33:pprint:Too many arguments for format string:UNDEFINED +mixed-format-string:11:10:11:54:pprint:Mixing named and unnamed conversion specifiers in format string:UNDEFINED +missing-format-string-key:12:10:12:49:pprint:Missing key 'PARG_2' in format string dictionary:UNDEFINED +unused-format-string-key:13:10:13:73:pprint:Unused key 'PARG_3' in format string dictionary:UNDEFINED +bad-format-string-key:14:10:14:54:pprint:Format string dictionary key should be a string, not 2:UNDEFINED +missing-format-string-key:14:10:14:54:pprint:Missing key 'PARG_2' in format string dictionary:UNDEFINED +format-needs-mapping:15:10:15:42:pprint:Expected mapping for format string, not Tuple:UNDEFINED +format-needs-mapping:16:10:16:42:pprint:Expected mapping for format string, not List:UNDEFINED +bad-format-character:17:10:17:24:pprint:Unsupported format character 'z' (0x7a) at index 2:UNDEFINED +truncated-format-string:18:10:18:38:pprint:Format string ends in middle of conversion specifier:UNDEFINED +format-string-without-interpolation:20:10:20:27:pprint:Using formatting for a string that does not have any interpolated variables:UNDEFINED +format-string-without-interpolation:21:10:21:23:pprint:Using formatting for a string that does not have any interpolated variables:UNDEFINED format-string-without-interpolation:22:10:22:23:pprint:Using formatting for a string that does not have any interpolated variables:UNDEFINED -format-string-without-interpolation:23:10:23:23:pprint:Using formatting for a string that does not have any interpolated variables:UNDEFINED -format-string-without-interpolation:24:10:24:25:pprint:Using formatting for a string that does not have any interpolated variables:UNDEFINED +format-string-without-interpolation:23:10:23:25:pprint:Using formatting for a string that does not have any interpolated variables:UNDEFINED diff --git a/tests/functional/s/subclassed_final_class_py38.py b/tests/functional/s/subclassed_final_class_py38.py index 6aca83352..60e9a7625 100644 --- a/tests/functional/s/subclassed_final_class_py38.py +++ b/tests/functional/s/subclassed_final_class_py38.py @@ -1,7 +1,7 @@ """Since Python version 3.8, a class decorated with typing.final cannot be subclassed """ -# pylint: disable=useless-object-inheritance, missing-docstring, too-few-public-methods +# pylint: disable=missing-docstring, too-few-public-methods from typing import final diff --git a/tests/functional/s/super/super_checks.py b/tests/functional/s/super/super_checks.py index ca35d52ae..050fd3c81 100644 --- a/tests/functional/s/super/super_checks.py +++ b/tests/functional/s/super/super_checks.py @@ -1,4 +1,4 @@ -# pylint: disable=too-few-public-methods,import-error, missing-docstring, useless-object-inheritance +# pylint: disable=too-few-public-methods,import-error, missing-docstring # pylint: disable=useless-super-delegation,wrong-import-position,invalid-name, wrong-import-order # pylint: disable=super-with-arguments from unknown import Missing @@ -12,7 +12,7 @@ class Aaaa: def __init__(self): super(Aaaa, self).__init__() -class NewAaaa(object): +class NewAaaa: """old style""" def hop(self): """hop""" @@ -36,19 +36,19 @@ class WrongNameRegression(Py3kAaaa): def __init__(self): super(Missing, self).__init__() # [bad-super-call] -class Getattr(object): +class Getattr: """ crash """ name = NewAaaa -class CrashSuper(object): +class CrashSuper: """ test a crash with this checker """ def __init__(self): super(Getattr.name, self).__init__() # [bad-super-call] -class Empty(object): +class Empty: """Just an empty class.""" -class SuperDifferentScope(object): +class SuperDifferentScope: """Don'emit bad-super-call when the super call is in another scope. For reference, see https://bitbucket.org/logilab/pylint/issue/403. """ @@ -72,7 +72,7 @@ class UnknownBases(Missing): # Test that we are detecting proper super errors. -class BaseClass(object): +class BaseClass: not_a_method = 42 @@ -114,12 +114,12 @@ except AttributeError: super(TimeoutExpired, self).__init__("", returncode) -class SuperWithType(object): +class SuperWithType: """type(self) may lead to recursion loop in derived classes""" def __init__(self): super(type(self), self).__init__() # [bad-super-call] -class SuperWithSelfClass(object): +class SuperWithSelfClass: """self.__class__ may lead to recursion loop in derived classes""" def __init__(self): super(self.__class__, self).__init__() # [bad-super-call] diff --git a/tests/functional/s/suspicious_str_strip_call.py b/tests/functional/s/suspicious_str_strip_call.py index 40684cc1d..1c49ca534 100644 --- a/tests/functional/s/suspicious_str_strip_call.py +++ b/tests/functional/s/suspicious_str_strip_call.py @@ -1,6 +1,6 @@ """Suspicious str.strip calls.""" # pylint: disable=redundant-u-string-prefix -__revision__ = 1 + ''.strip('yo') ''.strip() diff --git a/tests/functional/t/test_compile.py b/tests/functional/t/test_compile.py index d4a4ac2aa..78f087011 100644 --- a/tests/functional/t/test_compile.py +++ b/tests/functional/t/test_compile.py @@ -1,6 +1,6 @@ -# pylint: disable=missing-docstring, unused-variable, pointless-statement, too-few-public-methods, useless-object-inheritance +# pylint: disable=missing-docstring, unused-variable, pointless-statement, too-few-public-methods -class WrapperClass(object): +class WrapperClass: def method(self): var = +4294967296 self.method.__code__.co_consts diff --git a/tests/functional/t/too/too_few_public_methods.py b/tests/functional/t/too/too_few_public_methods.py index 5ba528f79..0a822231a 100644 --- a/tests/functional/t/too/too_few_public_methods.py +++ b/tests/functional/t/too/too_few_public_methods.py @@ -1,11 +1,10 @@ -# pylint: disable=missing-docstring, useless-object-inheritance -from __future__ import print_function +# pylint: disable=missing-docstring from enum import Enum -class Aaaa(object): # [too-few-public-methods] +class Aaaa: # [too-few-public-methods] def __init__(self): pass @@ -18,7 +17,7 @@ class Aaaa(object): # [too-few-public-methods] # Don't emit for these cases. -class Klass(object): +class Klass: """docstring""" def meth1(self): diff --git a/tests/functional/t/too/too_few_public_methods.txt b/tests/functional/t/too/too_few_public_methods.txt index 24f46d08f..fc355abf7 100644 --- a/tests/functional/t/too/too_few_public_methods.txt +++ b/tests/functional/t/too/too_few_public_methods.txt @@ -1 +1 @@ -too-few-public-methods:8:0:8:10:Aaaa:Too few public methods (1/2):UNDEFINED +too-few-public-methods:7:0:7:10:Aaaa:Too few public methods (1/2):UNDEFINED diff --git a/tests/functional/t/too/too_many_ancestors.py b/tests/functional/t/too/too_many_ancestors.py index 2c105ba28..a460e4f16 100644 --- a/tests/functional/t/too/too_many_ancestors.py +++ b/tests/functional/t/too/too_many_ancestors.py @@ -1,21 +1,21 @@ -# pylint: disable=missing-docstring, too-few-public-methods, useless-object-inheritance, arguments-differ +# pylint: disable=missing-docstring, too-few-public-methods, arguments-differ from collections.abc import MutableSequence -class Aaaa(object): +class Aaaa: pass -class Bbbb(object): +class Bbbb: pass -class Cccc(object): +class Cccc: pass -class Dddd(object): +class Dddd: pass -class Eeee(object): +class Eeee: pass -class Ffff(object): +class Ffff: pass -class Gggg(object): +class Gggg: pass -class Hhhh(object): +class Hhhh: pass class Iiii(Aaaa, Bbbb, Cccc, Dddd, Eeee, Ffff, Gggg, Hhhh): # [too-many-ancestors] diff --git a/tests/functional/t/too/too_many_instance_attributes.py b/tests/functional/t/too/too_many_instance_attributes.py index 565b8ec10..73cbd736b 100644 --- a/tests/functional/t/too/too_many_instance_attributes.py +++ b/tests/functional/t/too/too_many_instance_attributes.py @@ -1,7 +1,7 @@ -# pylint: disable=missing-docstring, too-few-public-methods, useless-object-inheritance +# pylint: disable=missing-docstring, too-few-public-methods -class Aaaa(object): # [too-many-instance-attributes] +class Aaaa: # [too-many-instance-attributes] def __init__(self): self.aaaa = 1 diff --git a/tests/functional/t/too/too_many_instance_attributes_py37.py b/tests/functional/t/too/too_many_instance_attributes_py37.py index 904475783..68e101892 100644 --- a/tests/functional/t/too/too_many_instance_attributes_py37.py +++ b/tests/functional/t/too/too_many_instance_attributes_py37.py @@ -1,4 +1,4 @@ -# pylint: disable=missing-docstring, too-few-public-methods, useless-object-inheritance +# pylint: disable=missing-docstring, too-few-public-methods from dataclasses import dataclass, InitVar # InitVars should not count as instance attributes (see issue #3754) diff --git a/tests/functional/t/too/too_many_lines.py b/tests/functional/t/too/too_many_lines.py index 78e568c23..79d657775 100644 --- a/tests/functional/t/too/too_many_lines.py +++ b/tests/functional/t/too/too_many_lines.py @@ -1,6 +1,6 @@ # pylint: disable=missing-docstring # -1: [too-many-lines] -__revision__ = 0 + diff --git a/tests/functional/t/too/too_many_lines_disabled.py b/tests/functional/t/too/too_many_lines_disabled.py index 1b0866db2..b338c0c87 100644 --- a/tests/functional/t/too/too_many_lines_disabled.py +++ b/tests/functional/t/too/too_many_lines_disabled.py @@ -3,7 +3,7 @@ # pylint: disable=too-many-lines -__revision__ = 0 + diff --git a/tests/functional/t/too/too_many_locals.py b/tests/functional/t/too/too_many_locals.py index 332019a1c..cd37e53cb 100644 --- a/tests/functional/t/too/too_many_locals.py +++ b/tests/functional/t/too/too_many_locals.py @@ -1,5 +1,5 @@ # pylint: disable=missing-docstring -from __future__ import print_function + def function(arg1, arg2, arg3, arg4, arg5): # [too-many-locals] arg6, arg7, arg8, arg9 = arg1, arg2, arg3, arg4 diff --git a/tests/functional/t/too/too_many_public_methods.py b/tests/functional/t/too/too_many_public_methods.py index 11b4b367d..5f994a553 100644 --- a/tests/functional/t/too/too_many_public_methods.py +++ b/tests/functional/t/too/too_many_public_methods.py @@ -1,6 +1,6 @@ -# pylint: disable=missing-docstring, useless-object-inheritance +# pylint: disable=missing-docstring -class Aaaa(object): # [too-many-public-methods] +class Aaaa: # [too-many-public-methods] def __init__(self): pass diff --git a/tests/functional/t/too/too_many_statements.py b/tests/functional/t/too/too_many_statements.py index 7de72bc2c..c71f5a3d0 100644 --- a/tests/functional/t/too/too_many_statements.py +++ b/tests/functional/t/too/too_many_statements.py @@ -1,6 +1,5 @@ # pylint: disable=missing-docstring, invalid-name -from __future__ import print_function def stupid_function(arg): # [too-many-statements] if arg == 1: diff --git a/tests/functional/t/too/too_many_statements.txt b/tests/functional/t/too/too_many_statements.txt index b78c4b9a5..fc2fc1aba 100644 --- a/tests/functional/t/too/too_many_statements.txt +++ b/tests/functional/t/too/too_many_statements.txt @@ -1,3 +1,3 @@ -too-many-statements:5:0:5:19:stupid_function:Too many statements (55/5):UNDEFINED -too-many-statements:62:0:62:33:long_function_with_inline_def:Too many statements (62/5):UNDEFINED -too-many-statements:128:0:128:20:exmaple_function:Too many statements (6/5):UNDEFINED +too-many-statements:4:0:4:19:stupid_function:Too many statements (55/5):UNDEFINED +too-many-statements:61:0:61:33:long_function_with_inline_def:Too many statements (62/5):UNDEFINED +too-many-statements:127:0:127:20:exmaple_function:Too many statements (6/5):UNDEFINED diff --git a/tests/functional/t/trailing_whitespaces.py b/tests/functional/t/trailing_whitespaces.py index 48de809c6..8deaca78d 100644 --- a/tests/functional/t/trailing_whitespaces.py +++ b/tests/functional/t/trailing_whitespaces.py @@ -1,6 +1,5 @@ """Regression test for trailing-whitespace (C0303).""" # pylint: disable=mixed-line-endings -from __future__ import print_function # +1: [trailing-whitespace] print('some trailing whitespace') diff --git a/tests/functional/t/trailing_whitespaces.txt b/tests/functional/t/trailing_whitespaces.txt index 766a65951..45990737f 100644 --- a/tests/functional/t/trailing_whitespaces.txt +++ b/tests/functional/t/trailing_whitespaces.txt @@ -1,3 +1,3 @@ -trailing-whitespace:6:33:None:None::Trailing whitespace:UNDEFINED -trailing-whitespace:8:73:None:None::Trailing whitespace:UNDEFINED -trailing-whitespace:11:46:None:None::Trailing whitespace:UNDEFINED +trailing-whitespace:5:33:None:None::Trailing whitespace:UNDEFINED +trailing-whitespace:7:73:None:None::Trailing whitespace:UNDEFINED +trailing-whitespace:10:46:None:None::Trailing whitespace:UNDEFINED diff --git a/tests/functional/u/unbalanced_tuple_unpacking.py b/tests/functional/u/unbalanced_tuple_unpacking.py index a4b72f8a8..226748933 100644 --- a/tests/functional/u/unbalanced_tuple_unpacking.py +++ b/tests/functional/u/unbalanced_tuple_unpacking.py @@ -3,7 +3,7 @@ from __future__ import absolute_import from typing import NamedTuple from functional.u.unpacking.unpacking import unpack -# pylint: disable=missing-class-docstring, missing-function-docstring, using-constant-test, useless-object-inheritance,import-outside-toplevel +# pylint: disable=missing-class-docstring, missing-function-docstring, using-constant-test, import-outside-toplevel def do_stuff(): @@ -83,7 +83,7 @@ def do_stuff9(): return first + second -class UnbalancedUnpacking(object): +class UnbalancedUnpacking: """Test unbalanced tuple unpacking in instance attributes.""" # pylint: disable=attribute-defined-outside-init, invalid-name, too-few-public-methods diff --git a/tests/functional/u/unbalanced_tuple_unpacking_py30.py b/tests/functional/u/unbalanced_tuple_unpacking_py30.py index 68f5fb79a..dd3e4b6d3 100644 --- a/tests/functional/u/unbalanced_tuple_unpacking_py30.py +++ b/tests/functional/u/unbalanced_tuple_unpacking_py30.py @@ -2,7 +2,6 @@ does not trigger a false positive on Python 3. """ -__revision__ = 1 def test(): """ Test that starred expressions don't give false positives. """ diff --git a/tests/functional/u/undefined/undefined_variable.py b/tests/functional/u/undefined/undefined_variable.py index c8fb54110..8c85b8582 100644 --- a/tests/functional/u/undefined/undefined_variable.py +++ b/tests/functional/u/undefined/undefined_variable.py @@ -1,11 +1,9 @@ -# pylint: disable=missing-docstring, multiple-statements, useless-object-inheritance, import-outside-toplevel +# pylint: disable=missing-docstring, multiple-statements, import-outside-toplevel # pylint: disable=too-few-public-methods, bare-except, broad-except # pylint: disable=using-constant-test, import-error, global-variable-not-assigned, unnecessary-comprehension # pylint: disable=unnecessary-lambda-assignment -from __future__ import print_function -# pylint: disable=wrong-import-position from typing import TYPE_CHECKING DEFINED = 1 @@ -106,7 +104,7 @@ class TestClass(Ancestor): # [used-before-assignment] """ class UsingBeforeDefinition(Empty): # [used-before-assignment] """ uses Empty before definition """ - class Empty(object): + class Empty: """ no op """ return UsingBeforeDefinition @@ -116,11 +114,11 @@ class TestClass(Ancestor): # [used-before-assignment] """ no op """ return MissingAncestor1 -class Self(object): +class Self: """ Detect when using the same name inside the class scope. """ obj = Self # [undefined-variable] -class Self1(object): +class Self1: """ No error should be raised here. """ def test(self): @@ -128,17 +126,17 @@ class Self1(object): return Self1 -class Ancestor(object): +class Ancestor: """ No op """ -class Ancestor1(object): +class Ancestor1: """ No op """ NANA = BAT # [undefined-variable] del BAT # [undefined-variable] -class KeywordArgument(object): +class KeywordArgument: """Test keyword arguments.""" enable = True @@ -186,11 +184,11 @@ def test_conditional_comprehension(): return my_methods -class MyError(object): +class MyError: pass -class MyClass(object): +class MyClass: class MyError(MyError): pass diff --git a/tests/functional/u/undefined/undefined_variable.txt b/tests/functional/u/undefined/undefined_variable.txt index 1066dbda2..85df23035 100644 --- a/tests/functional/u/undefined/undefined_variable.txt +++ b/tests/functional/u/undefined/undefined_variable.txt @@ -1,39 +1,39 @@ -undefined-variable:14:19:14:26::Undefined variable 'unknown':UNDEFINED -undefined-variable:20:10:20:21:in_method:Undefined variable 'nomoreknown':UNDEFINED -undefined-variable:23:19:23:31::Undefined variable '__revision__':UNDEFINED -undefined-variable:25:8:25:20::Undefined variable '__revision__':UNDEFINED -undefined-variable:29:29:29:37:bad_default:Undefined variable 'unknown2':UNDEFINED -undefined-variable:32:10:32:14:bad_default:Undefined variable 'xxxx':UNDEFINED -undefined-variable:33:4:33:10:bad_default:Undefined variable 'augvar':UNDEFINED -undefined-variable:34:8:34:14:bad_default:Undefined variable 'vardel':UNDEFINED -undefined-variable:36:19:36:31:<lambda>:Undefined variable 'doesnotexist':UNDEFINED -undefined-variable:37:23:37:24:<lambda>:Undefined variable 'z':UNDEFINED -used-before-assignment:40:4:40:9::Using variable 'POUET' before assignment:CONTROL_FLOW -used-before-assignment:45:4:45:10::Using variable 'POUETT' before assignment:CONTROL_FLOW -used-before-assignment:50:4:50:11::Using variable 'POUETTT' before assignment:CONTROL_FLOW -used-before-assignment:58:4:58:9::Using variable 'PLOUF' before assignment:CONTROL_FLOW -used-before-assignment:67:11:67:14:if_branch_test:Using variable 'xxx' before assignment:HIGH -used-before-assignment:93:23:93:32:test_arguments:Using variable 'TestClass' before assignment:HIGH -used-before-assignment:97:16:97:24:TestClass:Using variable 'Ancestor' before assignment:HIGH -used-before-assignment:100:26:100:35:TestClass.MissingAncestor:Using variable 'Ancestor1' before assignment:HIGH -used-before-assignment:107:36:107:41:TestClass.test1.UsingBeforeDefinition:Using variable 'Empty' before assignment:HIGH -undefined-variable:121:10:121:14:Self:Undefined variable 'Self':UNDEFINED -undefined-variable:137:7:137:10::Undefined variable 'BAT':UNDEFINED -undefined-variable:138:4:138:7::Undefined variable 'BAT':UNDEFINED -used-before-assignment:148:31:148:38:KeywordArgument.test1:Using variable 'enabled' before assignment:HIGH -undefined-variable:151:32:151:40:KeywordArgument.test2:Undefined variable 'disabled':UNDEFINED -undefined-variable:156:22:156:25:KeywordArgument.<lambda>:Undefined variable 'arg':UNDEFINED -undefined-variable:168:4:168:13::Undefined variable 'unicode_2':UNDEFINED -undefined-variable:173:4:173:13::Undefined variable 'unicode_3':UNDEFINED -undefined-variable:228:25:228:37:LambdaClass4.<lambda>:Undefined variable 'LambdaClass4':UNDEFINED -undefined-variable:236:25:236:37:LambdaClass5.<lambda>:Undefined variable 'LambdaClass5':UNDEFINED -used-before-assignment:257:26:257:34:func_should_fail:Using variable 'datetime' before assignment:HIGH -undefined-variable:284:18:284:24:not_using_loop_variable_accordingly:Undefined variable 'iteree':UNDEFINED -undefined-variable:301:27:301:28:undefined_annotation:Undefined variable 'x':UNDEFINED -used-before-assignment:302:7:302:8:undefined_annotation:Using variable 'x' before assignment:HIGH -undefined-variable:332:11:332:12:decorated3:Undefined variable 'x':UNDEFINED -undefined-variable:337:19:337:20:decorated4:Undefined variable 'y':UNDEFINED -undefined-variable:358:10:358:20:global_var_mixed_assignment:Undefined variable 'GLOBAL_VAR':HIGH -undefined-variable:370:19:370:44:RepeatedReturnAnnotations.x:Undefined variable 'RepeatedReturnAnnotations':UNDEFINED -undefined-variable:372:19:372:44:RepeatedReturnAnnotations.y:Undefined variable 'RepeatedReturnAnnotations':UNDEFINED -undefined-variable:374:19:374:44:RepeatedReturnAnnotations.z:Undefined variable 'RepeatedReturnAnnotations':UNDEFINED +undefined-variable:12:19:12:26::Undefined variable 'unknown':UNDEFINED +undefined-variable:18:10:18:21:in_method:Undefined variable 'nomoreknown':UNDEFINED +undefined-variable:21:19:21:31::Undefined variable '__revision__':UNDEFINED +undefined-variable:23:8:23:20::Undefined variable '__revision__':UNDEFINED +undefined-variable:27:29:27:37:bad_default:Undefined variable 'unknown2':UNDEFINED +undefined-variable:30:10:30:14:bad_default:Undefined variable 'xxxx':UNDEFINED +undefined-variable:31:4:31:10:bad_default:Undefined variable 'augvar':UNDEFINED +undefined-variable:32:8:32:14:bad_default:Undefined variable 'vardel':UNDEFINED +undefined-variable:34:19:34:31:<lambda>:Undefined variable 'doesnotexist':UNDEFINED +undefined-variable:35:23:35:24:<lambda>:Undefined variable 'z':UNDEFINED +used-before-assignment:38:4:38:9::Using variable 'POUET' before assignment:CONTROL_FLOW +used-before-assignment:43:4:43:10::Using variable 'POUETT' before assignment:CONTROL_FLOW +used-before-assignment:48:4:48:11::Using variable 'POUETTT' before assignment:CONTROL_FLOW +used-before-assignment:56:4:56:9::Using variable 'PLOUF' before assignment:CONTROL_FLOW +used-before-assignment:65:11:65:14:if_branch_test:Using variable 'xxx' before assignment:HIGH +used-before-assignment:91:23:91:32:test_arguments:Using variable 'TestClass' before assignment:HIGH +used-before-assignment:95:16:95:24:TestClass:Using variable 'Ancestor' before assignment:HIGH +used-before-assignment:98:26:98:35:TestClass.MissingAncestor:Using variable 'Ancestor1' before assignment:HIGH +used-before-assignment:105:36:105:41:TestClass.test1.UsingBeforeDefinition:Using variable 'Empty' before assignment:HIGH +undefined-variable:119:10:119:14:Self:Undefined variable 'Self':UNDEFINED +undefined-variable:135:7:135:10::Undefined variable 'BAT':UNDEFINED +undefined-variable:136:4:136:7::Undefined variable 'BAT':UNDEFINED +used-before-assignment:146:31:146:38:KeywordArgument.test1:Using variable 'enabled' before assignment:HIGH +undefined-variable:149:32:149:40:KeywordArgument.test2:Undefined variable 'disabled':UNDEFINED +undefined-variable:154:22:154:25:KeywordArgument.<lambda>:Undefined variable 'arg':UNDEFINED +undefined-variable:166:4:166:13::Undefined variable 'unicode_2':UNDEFINED +undefined-variable:171:4:171:13::Undefined variable 'unicode_3':UNDEFINED +undefined-variable:226:25:226:37:LambdaClass4.<lambda>:Undefined variable 'LambdaClass4':UNDEFINED +undefined-variable:234:25:234:37:LambdaClass5.<lambda>:Undefined variable 'LambdaClass5':UNDEFINED +used-before-assignment:255:26:255:34:func_should_fail:Using variable 'datetime' before assignment:HIGH +undefined-variable:282:18:282:24:not_using_loop_variable_accordingly:Undefined variable 'iteree':UNDEFINED +undefined-variable:299:27:299:28:undefined_annotation:Undefined variable 'x':UNDEFINED +used-before-assignment:300:7:300:8:undefined_annotation:Using variable 'x' before assignment:HIGH +undefined-variable:330:11:330:12:decorated3:Undefined variable 'x':UNDEFINED +undefined-variable:335:19:335:20:decorated4:Undefined variable 'y':UNDEFINED +undefined-variable:356:10:356:20:global_var_mixed_assignment:Undefined variable 'GLOBAL_VAR':HIGH +undefined-variable:368:19:368:44:RepeatedReturnAnnotations.x:Undefined variable 'RepeatedReturnAnnotations':UNDEFINED +undefined-variable:370:19:370:44:RepeatedReturnAnnotations.y:Undefined variable 'RepeatedReturnAnnotations':UNDEFINED +undefined-variable:372:19:372:44:RepeatedReturnAnnotations.z:Undefined variable 'RepeatedReturnAnnotations':UNDEFINED diff --git a/tests/functional/u/undefined/undefined_variable_py30.py b/tests/functional/u/undefined/undefined_variable_py30.py index a0beef00e..0b5aa0422 100644 --- a/tests/functional/u/undefined/undefined_variable_py30.py +++ b/tests/functional/u/undefined/undefined_variable_py30.py @@ -1,7 +1,7 @@ """Test warnings about access to undefined variables for various Python 3 constructs. """ # pylint: disable=too-few-public-methods, import-error -# pylint: disable=wrong-import-position, invalid-metaclass, useless-object-inheritance +# pylint: disable=wrong-import-position, invalid-metaclass class Undefined: """ test various annotation problems. """ @@ -37,7 +37,7 @@ class Undefined1: """ Triggers undefined-variable. """ -class FalsePositive342(object): +class FalsePositive342: # pylint: disable=line-too-long """ Fix some false positives found in https://bitbucket.org/logilab/pylint/issue/342/spurious-undefined-variable-for-class diff --git a/tests/functional/u/unexpected_special_method_signature.py b/tests/functional/u/unexpected_special_method_signature.py index a731e8f31..e2ae33857 100644 --- a/tests/functional/u/unexpected_special_method_signature.py +++ b/tests/functional/u/unexpected_special_method_signature.py @@ -1,9 +1,9 @@ """Test for special methods implemented incorrectly."""
# pylint: disable=missing-docstring, unused-argument, too-few-public-methods
-# pylint: disable=invalid-name,too-many-arguments,bad-staticmethod-argument, useless-object-inheritance
+# pylint: disable=invalid-name,too-many-arguments,bad-staticmethod-argument
-class Invalid(object):
+class Invalid:
def __enter__(self, other): # [unexpected-special-method-signature]
pass
@@ -34,19 +34,19 @@ class Invalid(object): pass
-class FirstBadContextManager(object):
+class FirstBadContextManager:
def __enter__(self):
return self
def __exit__(self, exc_type): # [unexpected-special-method-signature]
pass
-class SecondBadContextManager(object):
+class SecondBadContextManager:
def __enter__(self):
return self
def __exit__(self, exc_type, value, tb, stack): # [unexpected-special-method-signature]
pass
-class ThirdBadContextManager(object):
+class ThirdBadContextManager:
def __enter__(self):
return self
@@ -55,7 +55,7 @@ class ThirdBadContextManager(object): pass
-class Async(object):
+class Async:
def __aiter__(self, extra): # [unexpected-special-method-signature]
pass
@@ -69,7 +69,7 @@ class Async(object): pass
-class Valid(object):
+class Valid:
def __new__(cls, test, multiple, args):
pass
@@ -108,19 +108,19 @@ class Valid(object): pass
-class FirstGoodContextManager(object):
+class FirstGoodContextManager:
def __enter__(self):
return self
def __exit__(self, exc_type, value, tb):
pass
-class SecondGoodContextManager(object):
+class SecondGoodContextManager:
def __enter__(self):
return self
def __exit__(self, exc_type=None, value=None, tb=None):
pass
-class ThirdGoodContextManager(object):
+class ThirdGoodContextManager:
def __enter__(self):
return self
def __exit__(self, exc_type, *args):
diff --git a/tests/functional/u/unhashable_member.py b/tests/functional/u/unhashable_member.py index 779aef743..122554375 100644 --- a/tests/functional/u/unhashable_member.py +++ b/tests/functional/u/unhashable_member.py @@ -1,7 +1,7 @@ -# pylint: disable=missing-docstring,expression-not-assigned,too-few-public-methods,pointless-statement, useless-object-inheritance +# pylint: disable=missing-docstring,expression-not-assigned,too-few-public-methods,pointless-statement -class Unhashable(object): +class Unhashable: __hash__ = list.__hash__ # Subscripts diff --git a/tests/functional/u/unnecessary/unnecessary_dunder_call.py b/tests/functional/u/unnecessary/unnecessary_dunder_call.py index e1986a937..cd1f21286 100644 --- a/tests/functional/u/unnecessary/unnecessary_dunder_call.py +++ b/tests/functional/u/unnecessary/unnecessary_dunder_call.py @@ -1,5 +1,5 @@ """Checks for unnecessary-dunder-call.""" -# pylint: disable=too-few-public-methods, undefined-variable, useless-object-inheritance +# pylint: disable=too-few-public-methods, undefined-variable # pylint: disable=missing-class-docstring, missing-function-docstring from collections import OrderedDict from typing import Any @@ -26,19 +26,19 @@ def is_bigger_than_two(val): # Test dunder methods don't raise lint # if within a dunder method definition. -class Foo1(object): +class Foo1: def __init__(self): object.__init__(self) -class Foo2(object): +class Foo2: def __init__(self): super().__init__(self) -class Bar1(object): +class Bar1: def __new__(cls): object.__new__(cls) -class Bar2(object): +class Bar2: def __new__(cls): super().__new__(cls) @@ -77,7 +77,7 @@ class MyClass(list): print("do some special checks") return super().__contains__(item) -class PluginBase(object): +class PluginBase: subclasses = [] def __init_subclass__(cls, **kwargs): diff --git a/tests/functional/u/unnecessary/unnecessary_lambda.py b/tests/functional/u/unnecessary/unnecessary_lambda.py index 8484f6398..c12e30bc7 100644 --- a/tests/functional/u/unnecessary/unnecessary_lambda.py +++ b/tests/functional/u/unnecessary/unnecessary_lambda.py @@ -2,7 +2,6 @@ """test suspicious lambda expressions
"""
-__revision__ = ''
# Some simple examples of the most commonly encountered forms.
# +1: [unnecessary-lambda]
diff --git a/tests/functional/u/unnecessary/unnecessary_lambda.txt b/tests/functional/u/unnecessary/unnecessary_lambda.txt index 68b675ae4..1cfb149df 100644 --- a/tests/functional/u/unnecessary/unnecessary_lambda.txt +++ b/tests/functional/u/unnecessary/unnecessary_lambda.txt @@ -1,7 +1,7 @@ -unnecessary-lambda:9:4:9:18:<lambda>:Lambda may not be necessary:UNDEFINED -unnecessary-lambda:11:4:11:21:<lambda>:Lambda may not be necessary:UNDEFINED -unnecessary-lambda:13:4:13:26:<lambda>:Lambda may not be necessary:UNDEFINED -unnecessary-lambda:20:4:20:33:<lambda>:Lambda may not be necessary:UNDEFINED -unnecessary-lambda:22:4:22:39:<lambda>:Lambda may not be necessary:UNDEFINED -unnecessary-lambda:24:4:24:53:<lambda>:Lambda may not be necessary:UNDEFINED -unnecessary-lambda:26:4:26:71:<lambda>:Lambda may not be necessary:UNDEFINED +unnecessary-lambda:8:4:8:18:<lambda>:Lambda may not be necessary:UNDEFINED +unnecessary-lambda:10:4:10:21:<lambda>:Lambda may not be necessary:UNDEFINED +unnecessary-lambda:12:4:12:26:<lambda>:Lambda may not be necessary:UNDEFINED +unnecessary-lambda:19:4:19:33:<lambda>:Lambda may not be necessary:UNDEFINED +unnecessary-lambda:21:4:21:39:<lambda>:Lambda may not be necessary:UNDEFINED +unnecessary-lambda:23:4:23:53:<lambda>:Lambda may not be necessary:UNDEFINED +unnecessary-lambda:25:4:25:71:<lambda>:Lambda may not be necessary:UNDEFINED diff --git a/tests/functional/u/unnecessary/unnecessary_not.py b/tests/functional/u/unnecessary/unnecessary_not.py index 6b6b51369..52c1f0045 100644 --- a/tests/functional/u/unnecessary/unnecessary_not.py +++ b/tests/functional/u/unnecessary/unnecessary_not.py @@ -1,7 +1,7 @@ """Check exceeding negations in boolean expressions trigger warnings""" # pylint: disable=singleton-comparison,too-many-branches,too-few-public-methods,undefined-variable -# pylint: disable=literal-comparison, comparison-with-itself, useless-object-inheritance, comparison-of-constants +# pylint: disable=literal-comparison, comparison-with-itself, comparison-of-constants def unneeded_not(): """This is not ok """ @@ -57,7 +57,7 @@ def tolerated_statements(): pass -class Klass(object): +class Klass: """This is also ok""" def __ne__(self, other): return not self == other diff --git a/tests/functional/u/unpacking/unpacking_non_sequence.py b/tests/functional/u/unpacking/unpacking_non_sequence.py index a201a75cb..feb465ecb 100644 --- a/tests/functional/u/unpacking/unpacking_non_sequence.py +++ b/tests/functional/u/unpacking/unpacking_non_sequence.py @@ -1,16 +1,15 @@ """Check unpacking non-sequences in assignments. """ # pylint: disable=too-few-public-methods, invalid-name, attribute-defined-outside-init, unused-variable -# pylint: disable=using-constant-test, missing-docstring, wrong-import-order,wrong-import-position,no-else-return, useless-object-inheritance +# pylint: disable=using-constant-test, missing-docstring, wrong-import-order,wrong-import-position,no-else-return from os import rename as nonseq_func from functional.u.unpacking.unpacking import nonseq from typing import NamedTuple -__revision__ = 0 # Working -class Seq(object): +class Seq: """ sequence """ def __init__(self): self.items = range(2) @@ -21,7 +20,7 @@ class Seq(object): def __len__(self): return len(self.items) -class Iter(object): +class Iter: """ Iterator """ def __iter__(self): for number in range(2): @@ -46,7 +45,7 @@ class MetaIter(type): class IterClass(metaclass=MetaIter): "class that is iterable (and unpackable)" -class AbstrClass(object): +class AbstrClass: "abstract class" pair = None @@ -72,7 +71,7 @@ a, b = good_unpacking2() a, b = IterClass # Not working -class NonSeq(object): +class NonSeq: """ does nothing """ a, b = NonSeq() # [unpacking-non-sequence] @@ -83,7 +82,7 @@ a, b = nonseq # [unpacking-non-sequence] a, b = nonseq() # [unpacking-non-sequence] a, b = nonseq_func # [unpacking-non-sequence] -class ClassUnpacking(object): +class ClassUnpacking: """ Check unpacking as instance attributes. """ def test(self): @@ -100,7 +99,7 @@ class ClassUnpacking(object): self.a, self.b = ValueError # [unpacking-non-sequence] self.a, c = nonseq_func # [unpacking-non-sequence] -class TestBase(object): +class TestBase: 'base class with `test` method implementation' @staticmethod def test(data): diff --git a/tests/functional/u/unpacking/unpacking_non_sequence.txt b/tests/functional/u/unpacking/unpacking_non_sequence.txt index c3c65050c..3023bfc6b 100644 --- a/tests/functional/u/unpacking/unpacking_non_sequence.txt +++ b/tests/functional/u/unpacking/unpacking_non_sequence.txt @@ -1,10 +1,10 @@ -unpacking-non-sequence:78:0:78:15::Attempting to unpack a non-sequence defined at line 75:UNDEFINED -unpacking-non-sequence:79:0:79:17::Attempting to unpack a non-sequence:UNDEFINED -unpacking-non-sequence:80:0:80:11::Attempting to unpack a non-sequence None:UNDEFINED -unpacking-non-sequence:81:0:81:8::Attempting to unpack a non-sequence 1:UNDEFINED -unpacking-non-sequence:82:0:82:13::Attempting to unpack a non-sequence defined at line 9 of functional.u.unpacking.unpacking:UNDEFINED -unpacking-non-sequence:83:0:83:15::Attempting to unpack a non-sequence defined at line 11 of functional.u.unpacking.unpacking:UNDEFINED -unpacking-non-sequence:84:0:84:18::Attempting to unpack a non-sequence:UNDEFINED -unpacking-non-sequence:99:8:99:33:ClassUnpacking.test:Attempting to unpack a non-sequence defined at line 75:UNDEFINED -unpacking-non-sequence:100:8:100:35:ClassUnpacking.test:Attempting to unpack a non-sequence:UNDEFINED -unpacking-non-sequence:101:8:101:31:ClassUnpacking.test:Attempting to unpack a non-sequence:UNDEFINED +unpacking-non-sequence:77:0:77:15::Attempting to unpack a non-sequence defined at line 74:UNDEFINED +unpacking-non-sequence:78:0:78:17::Attempting to unpack a non-sequence:UNDEFINED +unpacking-non-sequence:79:0:79:11::Attempting to unpack a non-sequence None:UNDEFINED +unpacking-non-sequence:80:0:80:8::Attempting to unpack a non-sequence 1:UNDEFINED +unpacking-non-sequence:81:0:81:13::Attempting to unpack a non-sequence defined at line 9 of functional.u.unpacking.unpacking:UNDEFINED +unpacking-non-sequence:82:0:82:15::Attempting to unpack a non-sequence defined at line 11 of functional.u.unpacking.unpacking:UNDEFINED +unpacking-non-sequence:83:0:83:18::Attempting to unpack a non-sequence:UNDEFINED +unpacking-non-sequence:98:8:98:33:ClassUnpacking.test:Attempting to unpack a non-sequence defined at line 74:UNDEFINED +unpacking-non-sequence:99:8:99:35:ClassUnpacking.test:Attempting to unpack a non-sequence:UNDEFINED +unpacking-non-sequence:100:8:100:31:ClassUnpacking.test:Attempting to unpack a non-sequence:UNDEFINED diff --git a/tests/functional/u/unreachable.py b/tests/functional/u/unreachable.py index 2c71f6cf4..fa40e88f6 100644 --- a/tests/functional/u/unreachable.py +++ b/tests/functional/u/unreachable.py @@ -1,6 +1,5 @@ # pylint: disable=missing-docstring -from __future__ import print_function def func1(): return 1 diff --git a/tests/functional/u/unreachable.txt b/tests/functional/u/unreachable.txt index 35d3866a4..491912d99 100644 --- a/tests/functional/u/unreachable.txt +++ b/tests/functional/u/unreachable.txt @@ -1,5 +1,5 @@ -unreachable:7:4:7:24:func1:Unreachable code:HIGH -unreachable:12:8:12:28:func2:Unreachable code:HIGH -unreachable:18:8:18:28:func3:Unreachable code:HIGH -unreachable:22:4:22:16:func4:Unreachable code:HIGH -unreachable:35:4:35:24:func6:Unreachable code:HIGH +unreachable:6:4:6:24:func1:Unreachable code:HIGH +unreachable:11:8:11:28:func2:Unreachable code:HIGH +unreachable:17:8:17:28:func3:Unreachable code:HIGH +unreachable:21:4:21:16:func4:Unreachable code:HIGH +unreachable:34:4:34:24:func6:Unreachable code:HIGH diff --git a/tests/functional/u/unsubscriptable_value.py b/tests/functional/u/unsubscriptable_value.py index 6a97cc4c8..2a40d647f 100644 --- a/tests/functional/u/unsubscriptable_value.py +++ b/tests/functional/u/unsubscriptable_value.py @@ -3,8 +3,7 @@ Checks that value used in a subscript supports subscription (i.e. defines __getitem__ method). """ # pylint: disable=missing-docstring,pointless-statement,expression-not-assigned,wrong-import-position, unnecessary-comprehension -# pylint: disable=too-few-public-methods,import-error,invalid-name,wrong-import-order, useless-object-inheritance, redundant-u-string-prefix -import six +# pylint: disable=too-few-public-methods,import-error,invalid-name,wrong-import-order, redundant-u-string-prefix # primitives numbers = [1, 2, 3] @@ -22,10 +21,10 @@ dict(a=1, b=2)['a'] # instances -class NonSubscriptable(object): +class NonSubscriptable: pass -class Subscriptable(object): +class Subscriptable: def __getitem__(self, key): return key + key @@ -70,7 +69,7 @@ class MetaSubscriptable(type): def __getitem__(cls, key): return key + key -class SubscriptableClass(six.with_metaclass(MetaSubscriptable, object)): +class SubscriptableClass(metaclass=MetaSubscriptable): pass SubscriptableClass[0] @@ -90,7 +89,7 @@ deq.append(42) deq[0] -class AbstractClass(object): +class AbstractClass: def __init__(self): self.ala = {i for i in range(10)} @@ -102,7 +101,7 @@ class AbstractClass(object): self.portocala[0] -class ClassMixin(object): +class ClassMixin: def __init__(self): self.ala = {i for i in range(10)} diff --git a/tests/functional/u/unsubscriptable_value.txt b/tests/functional/u/unsubscriptable_value.txt index d0833b600..24209a64a 100644 --- a/tests/functional/u/unsubscriptable_value.txt +++ b/tests/functional/u/unsubscriptable_value.txt @@ -1,15 +1,15 @@ -unsubscriptable-object:32:0:32:18::Value 'NonSubscriptable()' is unsubscriptable:UNDEFINED -unsubscriptable-object:33:0:33:16::Value 'NonSubscriptable' is unsubscriptable:UNDEFINED -unsubscriptable-object:35:0:35:13::Value 'Subscriptable' is unsubscriptable:UNDEFINED -unsubscriptable-object:44:0:44:15::Value 'powers_of_two()' is unsubscriptable:UNDEFINED -unsubscriptable-object:45:0:45:13::Value 'powers_of_two' is unsubscriptable:UNDEFINED -unsubscriptable-object:49:0:49:4::Value 'True' is unsubscriptable:UNDEFINED -unsubscriptable-object:50:0:50:4::Value 'None' is unsubscriptable:UNDEFINED -unsubscriptable-object:51:0:51:3::Value '8.5' is unsubscriptable:UNDEFINED -unsubscriptable-object:52:0:52:2::Value '10' is unsubscriptable:UNDEFINED -unsubscriptable-object:55:0:55:27::Value '{x**2 for x in range(10)}' is unsubscriptable:UNDEFINED -unsubscriptable-object:56:0:56:12::Value 'set(numbers)' is unsubscriptable:UNDEFINED -unsubscriptable-object:57:0:57:18::Value 'frozenset(numbers)' is unsubscriptable:UNDEFINED -unsubscriptable-object:77:0:77:20::Value 'SubscriptableClass()' is unsubscriptable:UNDEFINED -unsubscriptable-object:84:0:84:4::Value 'test' is unsubscriptable:UNDEFINED -unsubscriptable-object:127:11:127:18:test_one:Value 'var_one' is unsubscriptable:UNDEFINED +unsubscriptable-object:31:0:31:18::Value 'NonSubscriptable()' is unsubscriptable:UNDEFINED +unsubscriptable-object:32:0:32:16::Value 'NonSubscriptable' is unsubscriptable:UNDEFINED +unsubscriptable-object:34:0:34:13::Value 'Subscriptable' is unsubscriptable:UNDEFINED +unsubscriptable-object:43:0:43:15::Value 'powers_of_two()' is unsubscriptable:UNDEFINED +unsubscriptable-object:44:0:44:13::Value 'powers_of_two' is unsubscriptable:UNDEFINED +unsubscriptable-object:48:0:48:4::Value 'True' is unsubscriptable:UNDEFINED +unsubscriptable-object:49:0:49:4::Value 'None' is unsubscriptable:UNDEFINED +unsubscriptable-object:50:0:50:3::Value '8.5' is unsubscriptable:UNDEFINED +unsubscriptable-object:51:0:51:2::Value '10' is unsubscriptable:UNDEFINED +unsubscriptable-object:54:0:54:27::Value '{x**2 for x in range(10)}' is unsubscriptable:UNDEFINED +unsubscriptable-object:55:0:55:12::Value 'set(numbers)' is unsubscriptable:UNDEFINED +unsubscriptable-object:56:0:56:18::Value 'frozenset(numbers)' is unsubscriptable:UNDEFINED +unsubscriptable-object:76:0:76:20::Value 'SubscriptableClass()' is unsubscriptable:UNDEFINED +unsubscriptable-object:83:0:83:4::Value 'test' is unsubscriptable:UNDEFINED +unsubscriptable-object:126:11:126:18:test_one:Value 'var_one' is unsubscriptable:UNDEFINED diff --git a/tests/functional/u/unsupported/unsupported_assignment_operation.py b/tests/functional/u/unsupported/unsupported_assignment_operation.py index c0b58668a..2cac693dd 100644 --- a/tests/functional/u/unsupported/unsupported_assignment_operation.py +++ b/tests/functional/u/unsupported/unsupported_assignment_operation.py @@ -3,8 +3,7 @@ Checks that value used in a subscript support assignments (i.e. defines __setitem__ method). """ # pylint: disable=missing-docstring,pointless-statement,expression-not-assigned,wrong-import-position,unnecessary-comprehension -# pylint: disable=too-few-public-methods,import-error,invalid-name,wrong-import-order, useless-object-inheritance -import six +# pylint: disable=too-few-public-methods,import-error,invalid-name,wrong-import-order # primitives numbers = [1, 2, 3] @@ -21,10 +20,10 @@ dict(a=1, b=2)['a'] = 42 # instances -class NonSubscriptable(object): +class NonSubscriptable: pass -class Subscriptable(object): +class Subscriptable: def __setitem__(self, key, value): return key + value @@ -69,7 +68,7 @@ class MetaSubscriptable(type): def __setitem__(cls, key, value): return key + value -class SubscriptableClass(six.with_metaclass(MetaSubscriptable, object)): +class SubscriptableClass(metaclass=MetaSubscriptable): pass SubscriptableClass[0] = 24 diff --git a/tests/functional/u/unsupported/unsupported_assignment_operation.txt b/tests/functional/u/unsupported/unsupported_assignment_operation.txt index de3fb3f1b..3177fa199 100644 --- a/tests/functional/u/unsupported/unsupported_assignment_operation.txt +++ b/tests/functional/u/unsupported/unsupported_assignment_operation.txt @@ -1,17 +1,17 @@ -unsupported-assignment-operation:16:0:16:9::'(1, 2, 3)' does not support item assignment:UNDEFINED -unsupported-assignment-operation:31:0:31:18::'NonSubscriptable()' does not support item assignment:UNDEFINED -unsupported-assignment-operation:32:0:32:16::'NonSubscriptable' does not support item assignment:UNDEFINED -unsupported-assignment-operation:34:0:34:13::'Subscriptable' does not support item assignment:UNDEFINED -unsupported-assignment-operation:43:0:43:15::'powers_of_two()' does not support item assignment:UNDEFINED -unsupported-assignment-operation:44:0:44:13::'powers_of_two' does not support item assignment:UNDEFINED -unsupported-assignment-operation:48:0:48:4::'True' does not support item assignment:UNDEFINED -unsupported-assignment-operation:49:0:49:4::'None' does not support item assignment:UNDEFINED -unsupported-assignment-operation:50:0:50:3::'8.5' does not support item assignment:UNDEFINED -unsupported-assignment-operation:51:0:51:2::'10' does not support item assignment:UNDEFINED -unsupported-assignment-operation:54:0:54:27::'{x**2 for x in range(10)}' does not support item assignment:UNDEFINED -unsupported-assignment-operation:55:0:55:12::'set(numbers)' does not support item assignment:UNDEFINED -unsupported-assignment-operation:56:0:56:18::'frozenset(numbers)' does not support item assignment:UNDEFINED -unsupported-assignment-operation:76:0:76:20::'SubscriptableClass()' does not support item assignment:UNDEFINED -unsupported-assignment-operation:82:0:82:6::'test()' does not support item assignment:UNDEFINED -unsupported-assignment-operation:83:0:83:4::'test' does not support item assignment:UNDEFINED -unsupported-assignment-operation:94:12:94:32::'SubscriptableClass()' does not support item assignment:UNDEFINED +unsupported-assignment-operation:15:0:15:9::'(1, 2, 3)' does not support item assignment:UNDEFINED +unsupported-assignment-operation:30:0:30:18::'NonSubscriptable()' does not support item assignment:UNDEFINED +unsupported-assignment-operation:31:0:31:16::'NonSubscriptable' does not support item assignment:UNDEFINED +unsupported-assignment-operation:33:0:33:13::'Subscriptable' does not support item assignment:UNDEFINED +unsupported-assignment-operation:42:0:42:15::'powers_of_two()' does not support item assignment:UNDEFINED +unsupported-assignment-operation:43:0:43:13::'powers_of_two' does not support item assignment:UNDEFINED +unsupported-assignment-operation:47:0:47:4::'True' does not support item assignment:UNDEFINED +unsupported-assignment-operation:48:0:48:4::'None' does not support item assignment:UNDEFINED +unsupported-assignment-operation:49:0:49:3::'8.5' does not support item assignment:UNDEFINED +unsupported-assignment-operation:50:0:50:2::'10' does not support item assignment:UNDEFINED +unsupported-assignment-operation:53:0:53:27::'{x**2 for x in range(10)}' does not support item assignment:UNDEFINED +unsupported-assignment-operation:54:0:54:12::'set(numbers)' does not support item assignment:UNDEFINED +unsupported-assignment-operation:55:0:55:18::'frozenset(numbers)' does not support item assignment:UNDEFINED +unsupported-assignment-operation:75:0:75:20::'SubscriptableClass()' does not support item assignment:UNDEFINED +unsupported-assignment-operation:81:0:81:6::'test()' does not support item assignment:UNDEFINED +unsupported-assignment-operation:82:0:82:4::'test' does not support item assignment:UNDEFINED +unsupported-assignment-operation:93:12:93:32::'SubscriptableClass()' does not support item assignment:UNDEFINED diff --git a/tests/functional/u/unsupported/unsupported_binary_operation.py b/tests/functional/u/unsupported/unsupported_binary_operation.py index 0bfe1d16a..00db8cdfe 100644 --- a/tests/functional/u/unsupported/unsupported_binary_operation.py +++ b/tests/functional/u/unsupported/unsupported_binary_operation.py @@ -1,6 +1,6 @@ """Test for unsupported-binary-operation."""
# pylint: disable=missing-docstring,too-few-public-methods,pointless-statement
-# pylint: disable=expression-not-assigned, invalid-name, useless-object-inheritance
+# pylint: disable=expression-not-assigned, invalid-name
import collections
@@ -20,32 +20,32 @@ import collections [] * 2.0 # [unsupported-binary-operation]
() * 2.0 # [unsupported-binary-operation]
2.0 >> 2.0 # [unsupported-binary-operation]
-class A(object):
+class A:
pass
-class B(object):
+class B:
pass
A() + B() # [unsupported-binary-operation]
-class A1(object):
+class A1:
def __add__(self, other):
return NotImplemented
A1() + A1() # [unsupported-binary-operation]
-class A2(object):
+class A2:
def __add__(self, other):
return NotImplemented
-class B2(object):
+class B2:
def __radd__(self, other):
return NotImplemented
A2() + B2() # [unsupported-binary-operation]
-class Parent(object):
+class Parent:
pass
class Child(Parent):
def __add__(self, other):
return NotImplemented
Child() + Parent() # [unsupported-binary-operation]
-class A3(object):
+class A3:
def __add__(self, other):
return NotImplemented
class B3(A3):
diff --git a/tests/functional/u/unsupported/unsupported_delete_operation.py b/tests/functional/u/unsupported/unsupported_delete_operation.py index 3c2882a64..56a457324 100644 --- a/tests/functional/u/unsupported/unsupported_delete_operation.py +++ b/tests/functional/u/unsupported/unsupported_delete_operation.py @@ -3,8 +3,7 @@ Checks that value used in a subscript support deletion (i.e. defines __delitem__ method). """ # pylint: disable=missing-docstring,pointless-statement,expression-not-assigned,wrong-import-position,unnecessary-comprehension -# pylint: disable=too-few-public-methods,import-error,invalid-name,wrong-import-order, useless-object-inheritance -import six +# pylint: disable=too-few-public-methods,import-error,invalid-name,wrong-import-order # primitives numbers = [1, 2, 3] @@ -21,10 +20,10 @@ del {x: 10 - x for x in range(10)}[0] # instances -class NonSubscriptable(object): +class NonSubscriptable: pass -class Subscriptable(object): +class Subscriptable: def __delitem__(self, key): pass @@ -69,7 +68,7 @@ class MetaSubscriptable(type): def __delitem__(cls, key): pass -class SubscriptableClass(six.with_metaclass(MetaSubscriptable, object)): +class SubscriptableClass(metaclass=MetaSubscriptable): pass del SubscriptableClass[0] diff --git a/tests/functional/u/unsupported/unsupported_delete_operation.txt b/tests/functional/u/unsupported/unsupported_delete_operation.txt index d3363f6b8..4ee05ab20 100644 --- a/tests/functional/u/unsupported/unsupported_delete_operation.txt +++ b/tests/functional/u/unsupported/unsupported_delete_operation.txt @@ -1,17 +1,17 @@ -unsupported-delete-operation:16:4:16:13::'(1, 2, 3)' does not support item deletion:UNDEFINED -unsupported-delete-operation:31:4:31:22::'NonSubscriptable()' does not support item deletion:UNDEFINED -unsupported-delete-operation:32:4:32:20::'NonSubscriptable' does not support item deletion:UNDEFINED -unsupported-delete-operation:34:4:34:17::'Subscriptable' does not support item deletion:UNDEFINED -unsupported-delete-operation:43:4:43:19::'powers_of_two()' does not support item deletion:UNDEFINED -unsupported-delete-operation:44:4:44:17::'powers_of_two' does not support item deletion:UNDEFINED -unsupported-delete-operation:48:4:48:8::'True' does not support item deletion:UNDEFINED -unsupported-delete-operation:49:4:49:8::'None' does not support item deletion:UNDEFINED -unsupported-delete-operation:50:4:50:7::'8.5' does not support item deletion:UNDEFINED -unsupported-delete-operation:51:4:51:6::'10' does not support item deletion:UNDEFINED -unsupported-delete-operation:54:4:54:31::'{x**2 for x in range(10)}' does not support item deletion:UNDEFINED -unsupported-delete-operation:55:4:55:16::'set(numbers)' does not support item deletion:UNDEFINED -unsupported-delete-operation:56:4:56:22::'frozenset(numbers)' does not support item deletion:UNDEFINED -unsupported-delete-operation:76:4:76:24::'SubscriptableClass()' does not support item deletion:UNDEFINED -unsupported-delete-operation:82:4:82:10::'test()' does not support item deletion:UNDEFINED -unsupported-delete-operation:83:4:83:8::'test' does not support item deletion:UNDEFINED -unsupported-delete-operation:94:16:94:36::'SubscriptableClass()' does not support item deletion:UNDEFINED +unsupported-delete-operation:15:4:15:13::'(1, 2, 3)' does not support item deletion:UNDEFINED +unsupported-delete-operation:30:4:30:22::'NonSubscriptable()' does not support item deletion:UNDEFINED +unsupported-delete-operation:31:4:31:20::'NonSubscriptable' does not support item deletion:UNDEFINED +unsupported-delete-operation:33:4:33:17::'Subscriptable' does not support item deletion:UNDEFINED +unsupported-delete-operation:42:4:42:19::'powers_of_two()' does not support item deletion:UNDEFINED +unsupported-delete-operation:43:4:43:17::'powers_of_two' does not support item deletion:UNDEFINED +unsupported-delete-operation:47:4:47:8::'True' does not support item deletion:UNDEFINED +unsupported-delete-operation:48:4:48:8::'None' does not support item deletion:UNDEFINED +unsupported-delete-operation:49:4:49:7::'8.5' does not support item deletion:UNDEFINED +unsupported-delete-operation:50:4:50:6::'10' does not support item deletion:UNDEFINED +unsupported-delete-operation:53:4:53:31::'{x**2 for x in range(10)}' does not support item deletion:UNDEFINED +unsupported-delete-operation:54:4:54:16::'set(numbers)' does not support item deletion:UNDEFINED +unsupported-delete-operation:55:4:55:22::'frozenset(numbers)' does not support item deletion:UNDEFINED +unsupported-delete-operation:75:4:75:24::'SubscriptableClass()' does not support item deletion:UNDEFINED +unsupported-delete-operation:81:4:81:10::'test()' does not support item deletion:UNDEFINED +unsupported-delete-operation:82:4:82:8::'test' does not support item deletion:UNDEFINED +unsupported-delete-operation:93:16:93:36::'SubscriptableClass()' does not support item deletion:UNDEFINED diff --git a/tests/functional/u/unused/unused_argument.py b/tests/functional/u/unused/unused_argument.py index 8ce9bd7d4..b46c1e4d7 100644 --- a/tests/functional/u/unused/unused_argument.py +++ b/tests/functional/u/unused/unused_argument.py @@ -1,4 +1,4 @@ -# pylint: disable=missing-docstring,too-few-public-methods, useless-object-inheritance +# pylint: disable=missing-docstring,too-few-public-methods def test_unused(first, second, _not_used): # [unused-argument, unused-argument] pass @@ -17,7 +17,7 @@ def test_prefixed_with_unused(first, unused_second): # use the arguments (e.g. Sub2) -class Base(object): +class Base: "parent" def inherited(self, aaa, aab, aac): "abstract method" @@ -53,15 +53,14 @@ def metadata_from_dict_2(key): return {key: (a, b) for key, (a, b) in key.items()} -# pylint: disable=too-few-public-methods, misplaced-future,wrong-import-position -from __future__ import print_function +# pylint: disable=too-few-public-methods, wrong-import-position def function(arg=1): # [unused-argument] """ignore arg""" -class AAAA(object): +class AAAA: """dummy class""" def method(self, arg): # [unused-argument] @@ -87,7 +86,7 @@ class AAAA(object): # pylint: disable = attribute-defined-outside-init rset.get_entity = inner -class BBBB(object): +class BBBB: """dummy class""" def __init__(self, arg): # [unused-argument] diff --git a/tests/functional/u/unused/unused_argument.txt b/tests/functional/u/unused/unused_argument.txt index 92795058e..19c439304 100644 --- a/tests/functional/u/unused/unused_argument.txt +++ b/tests/functional/u/unused/unused_argument.txt @@ -1,9 +1,9 @@ unused-argument:3:16:3:21:test_unused:Unused argument 'first':HIGH unused-argument:3:23:3:29:test_unused:Unused argument 'second':HIGH unused-argument:32:29:32:32:Sub.newmethod:Unused argument 'aay':INFERENCE -unused-argument:60:13:60:16:function:Unused argument 'arg':HIGH -unused-argument:67:21:67:24:AAAA.method:Unused argument 'arg':INFERENCE -unused-argument:74:0:None:None:AAAA.selected:Unused argument 'args':INFERENCE -unused-argument:74:0:None:None:AAAA.selected:Unused argument 'kwargs':INFERENCE -unused-argument:93:23:93:26:BBBB.__init__:Unused argument 'arg':INFERENCE -unused-argument:104:34:104:39:Ancestor.set_thing:Unused argument 'other':INFERENCE +unused-argument:59:13:59:16:function:Unused argument 'arg':HIGH +unused-argument:66:21:66:24:AAAA.method:Unused argument 'arg':INFERENCE +unused-argument:73:0:None:None:AAAA.selected:Unused argument 'args':INFERENCE +unused-argument:73:0:None:None:AAAA.selected:Unused argument 'kwargs':INFERENCE +unused-argument:92:23:92:26:BBBB.__init__:Unused argument 'arg':INFERENCE +unused-argument:103:34:103:39:Ancestor.set_thing:Unused argument 'other':INFERENCE diff --git a/tests/functional/u/unused/unused_import.py b/tests/functional/u/unused/unused_import.py index 46907b47c..20a900fb5 100644 --- a/tests/functional/u/unused/unused_import.py +++ b/tests/functional/u/unused/unused_import.py @@ -1,5 +1,5 @@ """unused import""" -# pylint: disable=undefined-all-variable, import-error, too-few-public-methods, missing-docstring,wrong-import-position, useless-object-inheritance, multiple-imports +# pylint: disable=undefined-all-variable, import-error, too-few-public-methods, missing-docstring,wrong-import-position, multiple-imports import xml.etree # [unused-import] import xml.sax # [unused-import] import os.path as test # [unused-import] @@ -11,9 +11,8 @@ from collections import deque, OrderedDict, Counter import re, html.parser # [unused-import] DATA = Counter() # pylint: disable=self-assigning-variable -import six from fake import SomeName, SomeOtherName # [unused-import] -class SomeClass(object): +class SomeClass: SomeName = SomeName # https://bitbucket.org/logilab/pylint/issue/475 SomeOtherName = 1 SomeOtherName = SomeOtherName @@ -43,14 +42,11 @@ def get_itertools_obj() -> 'itertools.count': def use_html_parser() -> 'html.parser.HTMLParser': return html.parser.HTMLParser -# pylint: disable=misplaced-future - -from __future__ import print_function import os # [unused-import] import sys -class NonRegr(object): +class NonRegr: """???""" def __init__(self): print('initialized') @@ -90,5 +86,5 @@ TYPE_CHECKING = False if TYPE_CHECKING: import zoneinfo -class WithMetaclass(six.with_metaclass(ABCMeta, object)): +class WithMetaclass(metaclass=ABCMeta): pass diff --git a/tests/functional/u/unused/unused_import.txt b/tests/functional/u/unused/unused_import.txt index cad621a59..857ba6a0d 100644 --- a/tests/functional/u/unused/unused_import.txt +++ b/tests/functional/u/unused/unused_import.txt @@ -6,9 +6,9 @@ unused-import:8:0:8:21::Unused flags imported from sys:UNDEFINED unused-import:10:0:10:51::Unused OrderedDict imported from collections:UNDEFINED unused-import:10:0:10:51::Unused deque imported from collections:UNDEFINED unused-import:11:0:11:22::Unused import re:UNDEFINED -unused-import:15:0:15:40::Unused SomeOtherName imported from fake:UNDEFINED -unused-import:50:0:50:9::Unused import os:UNDEFINED -unused-import:81:4:81:19::Unused import unittest:UNDEFINED -unused-import:83:4:83:15::Unused import uuid:UNDEFINED -unused-import:85:4:85:19::Unused import warnings:UNDEFINED -unused-import:87:4:87:21::Unused import compileall:UNDEFINED +unused-import:14:0:14:40::Unused SomeOtherName imported from fake:UNDEFINED +unused-import:46:0:46:9::Unused import os:UNDEFINED +unused-import:77:4:77:19::Unused import unittest:UNDEFINED +unused-import:79:4:79:15::Unused import uuid:UNDEFINED +unused-import:81:4:81:19::Unused import warnings:UNDEFINED +unused-import:83:4:83:21::Unused import compileall:UNDEFINED diff --git a/tests/functional/u/unused/unused_import_assigned_to.py b/tests/functional/u/unused/unused_import_assigned_to.py index fb339bce7..21b8e97c9 100644 --- a/tests/functional/u/unused/unused_import_assigned_to.py +++ b/tests/functional/u/unused/unused_import_assigned_to.py @@ -1,5 +1,5 @@ # pylint: disable=missing-docstring, import-error, invalid-name -# pylint: disable=too-few-public-methods, disallowed-name, no-member, useless-object-inheritance +# pylint: disable=too-few-public-methods, disallowed-name, no-member import uuid @@ -9,7 +9,7 @@ import foo from .a import x -class Y(object): +class Y: x = x[0] @@ -17,9 +17,9 @@ def test(default=None): return default -class BaseModel(object): +class BaseModel: uuid = test(default=uuid.uuid4) -class bar(object): +class bar: foo = foo.baz diff --git a/tests/functional/u/unused/unused_import_py30.py b/tests/functional/u/unused/unused_import_py30.py index 95fed2055..2e79b5795 100644 --- a/tests/functional/u/unused/unused_import_py30.py +++ b/tests/functional/u/unused/unused_import_py30.py @@ -1,6 +1,6 @@ """check unused import for metaclasses""" # pylint: disable=too-few-public-methods,wrong-import-position,ungrouped-imports -__revision__ = 1 + import abc import sys from abc import ABCMeta diff --git a/tests/functional/u/unused/unused_variable.py b/tests/functional/u/unused/unused_variable.py index d59043e22..c811d00b1 100644 --- a/tests/functional/u/unused/unused_variable.py +++ b/tests/functional/u/unused/unused_variable.py @@ -1,4 +1,4 @@ -# pylint: disable=missing-docstring, invalid-name, too-few-public-methods, useless-object-inheritance,import-outside-toplevel, fixme, line-too-long +# pylint: disable=missing-docstring, invalid-name, too-few-public-methods, import-outside-toplevel, fixme, line-too-long def test_regression_737(): import xml # [unused-import] @@ -22,7 +22,7 @@ def test_local_field_prefixed_with_unused_or_ignored(): ignored_local_field = 42 -class HasUnusedDunderClass(object): +class HasUnusedDunderClass: def test(self): __class__ = 42 # [unused-variable] @@ -66,8 +66,7 @@ def hello(arg): return True raise Exception -# pylint: disable=wrong-import-position,misplaced-future -from __future__ import print_function +# pylint: disable=wrong-import-position PATH = OS = collections = deque = None diff --git a/tests/functional/u/unused/unused_variable.txt b/tests/functional/u/unused/unused_variable.txt index ee9798e67..1bea13977 100644 --- a/tests/functional/u/unused/unused_variable.txt +++ b/tests/functional/u/unused/unused_variable.txt @@ -12,18 +12,18 @@ unused-import:54:4:54:38:unused_import_from:Unused wraps imported from functools unused-import:55:4:55:38:unused_import_from:Unused namedtuple imported from collections:UNDEFINED unused-import:59:4:59:40:unused_import_in_function:Unused hexdigits imported from string:UNDEFINED unused-variable:64:4:64:10:hello:Unused variable 'my_var':UNDEFINED -unused-variable:76:4:76:8:function:Unused variable 'aaaa':UNDEFINED -global-variable-not-assigned:98:4:98:39:test_global:Using global for 'PATH' but no assignment is done:UNDEFINED -global-variable-not-assigned:98:4:98:39:test_global:Using global for 'deque' but no assignment is done:UNDEFINED -unused-import:104:4:104:28:test_global:Unused platform imported from sys:UNDEFINED -unused-import:105:4:105:38:test_global:Unused version imported from sys as VERSION:UNDEFINED -unused-import:106:4:106:15:test_global:Unused import this:UNDEFINED -unused-import:107:4:107:19:test_global:Unused re imported as RE:UNDEFINED -unused-variable:111:4:111:10:function2:Unused variable 'unused':UNDEFINED -redefined-outer-name:117:8:118:42:function2:Redefining name 'error' from outer scope (line 114):UNDEFINED -redefined-outer-name:145:8:146:28:func3:Redefining name 'error' from outer scope (line 141):UNDEFINED -unused-variable:145:8:146:28:func3:Unused variable 'error':UNDEFINED -unused-variable:151:4:155:26:func4:Unused variable 'error':UNDEFINED -redefined-outer-name:154:8:155:26:func4:Redefining name 'error' from outer scope (line 151):UNDEFINED -unused-variable:162:4:163:12:main:Unused variable 'e':UNDEFINED -undefined-loop-variable:169:10:169:11:main:Using possibly undefined loop variable 'e':UNDEFINED +unused-variable:75:4:75:8:function:Unused variable 'aaaa':UNDEFINED +global-variable-not-assigned:97:4:97:39:test_global:Using global for 'PATH' but no assignment is done:UNDEFINED +global-variable-not-assigned:97:4:97:39:test_global:Using global for 'deque' but no assignment is done:UNDEFINED +unused-import:103:4:103:28:test_global:Unused platform imported from sys:UNDEFINED +unused-import:104:4:104:38:test_global:Unused version imported from sys as VERSION:UNDEFINED +unused-import:105:4:105:15:test_global:Unused import this:UNDEFINED +unused-import:106:4:106:19:test_global:Unused re imported as RE:UNDEFINED +unused-variable:110:4:110:10:function2:Unused variable 'unused':UNDEFINED +redefined-outer-name:116:8:117:42:function2:Redefining name 'error' from outer scope (line 113):UNDEFINED +redefined-outer-name:144:8:145:28:func3:Redefining name 'error' from outer scope (line 140):UNDEFINED +unused-variable:144:8:145:28:func3:Unused variable 'error':UNDEFINED +unused-variable:150:4:154:26:func4:Unused variable 'error':UNDEFINED +redefined-outer-name:153:8:154:26:func4:Redefining name 'error' from outer scope (line 150):UNDEFINED +unused-variable:161:4:162:12:main:Unused variable 'e':UNDEFINED +undefined-loop-variable:168:10:168:11:main:Using possibly undefined loop variable 'e':UNDEFINED diff --git a/tests/functional/u/used/used_before_assignment.py b/tests/functional/u/used/used_before_assignment.py index ca615c399..473af2b34 100644 --- a/tests/functional/u/used/used_before_assignment.py +++ b/tests/functional/u/used/used_before_assignment.py @@ -1,6 +1,5 @@ """Miscellaneous used-before-assignment cases""" # pylint: disable=consider-using-f-string, missing-function-docstring -__revision__ = None MSG = "hello %s" % MSG # [used-before-assignment] diff --git a/tests/functional/u/used/used_before_assignment.txt b/tests/functional/u/used/used_before_assignment.txt index 4a55d68ed..c48b3ed7c 100644 --- a/tests/functional/u/used/used_before_assignment.txt +++ b/tests/functional/u/used/used_before_assignment.txt @@ -1,4 +1,4 @@ -used-before-assignment:6:19:6:22::Using variable 'MSG' before assignment:HIGH -used-before-assignment:8:20:8:24::Using variable 'MSG2' before assignment:HIGH -used-before-assignment:11:4:11:9:outer:Using variable 'inner' before assignment:HIGH -used-before-assignment:21:10:21:14:redefine_time_import:Using variable 'time' before assignment:HIGH +used-before-assignment:5:19:5:22::Using variable 'MSG' before assignment:HIGH +used-before-assignment:7:20:7:24::Using variable 'MSG2' before assignment:HIGH +used-before-assignment:10:4:10:9:outer:Using variable 'inner' before assignment:HIGH +used-before-assignment:20:10:20:14:redefine_time_import:Using variable 'time' before assignment:HIGH diff --git a/tests/functional/u/used/used_before_assignment_issue1081.py b/tests/functional/u/used/used_before_assignment_issue1081.py index 0c59ccebe..d478bdeec 100644 --- a/tests/functional/u/used/used_before_assignment_issue1081.py +++ b/tests/functional/u/used/used_before_assignment_issue1081.py @@ -1,4 +1,4 @@ -# pylint: disable=missing-docstring,invalid-name,too-few-public-methods, useless-object-inheritance +# pylint: disable=missing-docstring,invalid-name,too-few-public-methods x = 24 @@ -36,5 +36,5 @@ def func(something): return something ** 3 -class FalsePositive(object): +class FalsePositive: x = func(x) diff --git a/tests/functional/u/used/used_before_assignment_nonlocal.py b/tests/functional/u/used/used_before_assignment_nonlocal.py index d651bcf11..270b72d22 100644 --- a/tests/functional/u/used/used_before_assignment_nonlocal.py +++ b/tests/functional/u/used/used_before_assignment_nonlocal.py @@ -1,7 +1,6 @@ """Check for nonlocal and used-before-assignment"""
# pylint: disable=missing-docstring, unused-variable, too-few-public-methods
-__revision__ = 0
def test_ok():
""" uses nonlocal """
diff --git a/tests/functional/u/used/used_before_assignment_nonlocal.txt b/tests/functional/u/used/used_before_assignment_nonlocal.txt index f3e873315..3e5045f27 100644 --- a/tests/functional/u/used/used_before_assignment_nonlocal.txt +++ b/tests/functional/u/used/used_before_assignment_nonlocal.txt @@ -1,7 +1,7 @@ -used-before-assignment:18:14:18:17:test_fail.wrap:Using variable 'cnt' before assignment:HIGH -used-before-assignment:27:14:27:17:test_fail2.wrap:Using variable 'cnt' before assignment:HIGH -used-before-assignment:30:20:30:30:test_fail3:Using variable 'test_fail4' before assignment:HIGH -used-before-assignment:34:22:34:32:test_fail4:Using variable 'test_fail5' before assignment:HIGH -used-before-assignment:34:44:34:53:test_fail4:Using variable 'undefined' before assignment:HIGH -used-before-assignment:40:18:40:28:test_fail5:Using variable 'undefined1' before assignment:HIGH -used-before-assignment:91:10:91:18:type_annotation_never_gets_value_despite_nonlocal:Using variable 'some_num' before assignment:HIGH +used-before-assignment:17:14:17:17:test_fail.wrap:Using variable 'cnt' before assignment:HIGH +used-before-assignment:26:14:26:17:test_fail2.wrap:Using variable 'cnt' before assignment:HIGH +used-before-assignment:29:20:29:30:test_fail3:Using variable 'test_fail4' before assignment:HIGH +used-before-assignment:33:22:33:32:test_fail4:Using variable 'test_fail5' before assignment:HIGH +used-before-assignment:33:44:33:53:test_fail4:Using variable 'undefined' before assignment:HIGH +used-before-assignment:39:18:39:28:test_fail5:Using variable 'undefined1' before assignment:HIGH +used-before-assignment:90:10:90:18:type_annotation_never_gets_value_despite_nonlocal:Using variable 'some_num' before assignment:HIGH diff --git a/tests/functional/u/useless/useless_else_on_loop.py b/tests/functional/u/useless/useless_else_on_loop.py index 3431513cd..20354cad0 100644 --- a/tests/functional/u/useless/useless_else_on_loop.py +++ b/tests/functional/u/useless/useless_else_on_loop.py @@ -1,6 +1,5 @@ """Check for else branches on loops with break and return only.""" -from __future__ import print_function -__revision__ = 0 + def test_return_for(): """else + return is not acceptable.""" diff --git a/tests/functional/u/useless/useless_else_on_loop.txt b/tests/functional/u/useless/useless_else_on_loop.txt index 938f24cc5..067b6435d 100644 --- a/tests/functional/u/useless/useless_else_on_loop.txt +++ b/tests/functional/u/useless/useless_else_on_loop.txt @@ -1,6 +1,6 @@ -useless-else-on-loop:10:4:11:31:test_return_for:Else clause on loop without a break statement, remove the else and de-indent all the code inside it:UNDEFINED -useless-else-on-loop:18:4:19:31:test_return_while:Else clause on loop without a break statement, remove the else and de-indent all the code inside it:UNDEFINED -useless-else-on-loop:28:0:29:21::Else clause on loop without a break statement, remove the else and de-indent all the code inside it:UNDEFINED -useless-else-on-loop:35:0:36:21::Else clause on loop without a break statement, remove the else and de-indent all the code inside it:UNDEFINED -useless-else-on-loop:40:0:43:13::Else clause on loop without a break statement, remove the else and de-indent all the code inside it:UNDEFINED -useless-else-on-loop:87:4:88:19:test_break_in_orelse_deep2:Else clause on loop without a break statement, remove the else and de-indent all the code inside it:UNDEFINED +useless-else-on-loop:9:4:10:31:test_return_for:Else clause on loop without a break statement, remove the else and de-indent all the code inside it:UNDEFINED +useless-else-on-loop:17:4:18:31:test_return_while:Else clause on loop without a break statement, remove the else and de-indent all the code inside it:UNDEFINED +useless-else-on-loop:27:0:28:21::Else clause on loop without a break statement, remove the else and de-indent all the code inside it:UNDEFINED +useless-else-on-loop:34:0:35:21::Else clause on loop without a break statement, remove the else and de-indent all the code inside it:UNDEFINED +useless-else-on-loop:39:0:42:13::Else clause on loop without a break statement, remove the else and de-indent all the code inside it:UNDEFINED +useless-else-on-loop:86:4:87:19:test_break_in_orelse_deep2:Else clause on loop without a break statement, remove the else and de-indent all the code inside it:UNDEFINED diff --git a/tests/functional/u/useless/useless_parent_delegation.py b/tests/functional/u/useless/useless_parent_delegation.py index 5f8179c27..20675e524 100644 --- a/tests/functional/u/useless/useless_parent_delegation.py +++ b/tests/functional/u/useless/useless_parent_delegation.py @@ -1,6 +1,6 @@ # pylint: disable=missing-docstring, no-member, bad-super-call # pylint: disable=too-few-public-methods, unused-argument, invalid-name, too-many-public-methods -# pylint: disable=line-too-long, useless-object-inheritance, arguments-out-of-order +# pylint: disable=line-too-long, arguments-out-of-order # pylint: disable=super-with-arguments, dangerous-default-value import random @@ -13,7 +13,7 @@ def not_a_method(param, param2): return super(None, None).not_a_method(param, param2) -class SuperBase(object): +class SuperBase: def with_default_arg(self, first, default_arg="only_in_super_base"): pass @@ -342,7 +342,7 @@ class SubTwoTwo(SuperTwo): super().__init__(a, b, *args) -class NotUselessSuperPy3(object): +class NotUselessSuperPy3: def not_passing_keyword_only(self, first, *, second): return super().not_passing_keyword_only(first) @@ -355,7 +355,7 @@ class AlsoNotUselessSuperPy3(NotUselessSuperPy3): return super().not_passing_keyword_only(first, second=second) -class UselessSuperPy3(object): +class UselessSuperPy3: def useless(self, *, first): # [useless-parent-delegation] super().useless(first=first) diff --git a/tests/functional/u/useless/useless_return.py b/tests/functional/u/useless/useless_return.py index c0cffaf5a..e7537353e 100644 --- a/tests/functional/u/useless/useless_return.py +++ b/tests/functional/u/useless/useless_return.py @@ -1,11 +1,11 @@ -# pylint: disable=missing-docstring,too-few-public-methods,bad-option-value,useless-object-inheritance -from __future__ import print_function +# pylint: disable=missing-docstring,too-few-public-methods,bad-option-value + def myfunc(): # [useless-return] print('---- testing ---') return -class SomeClass(object): +class SomeClass: def mymethod(self): # [useless-return] print('---- testing ---') return None diff --git a/tests/functional/u/using_constant_test.py b/tests/functional/u/using_constant_test.py index a3b35b355..4586150b1 100644 --- a/tests/functional/u/using_constant_test.py +++ b/tests/functional/u/using_constant_test.py @@ -1,6 +1,6 @@ """Verify if constant tests are used inside if statements.""" # pylint: disable=invalid-name, missing-docstring,too-few-public-methods -# pylint: disable=expression-not-assigned, useless-object-inheritance +# pylint: disable=expression-not-assigned # pylint: disable=missing-parentheses-for-call-in-test, unnecessary-comprehension, condition-evals-to-constant # pylint: disable=use-list-literal, use-dict-literal @@ -11,7 +11,7 @@ def function(): yield -class Class(object): +class Class: def method(self): pass diff --git a/tests/functional/w/with_using_generator.py b/tests/functional/w/with_using_generator.py index 187bdcfea..9f557363f 100644 --- a/tests/functional/w/with_using_generator.py +++ b/tests/functional/w/with_using_generator.py @@ -1,7 +1,6 @@ """ Testing with statements that use generators. This should not crash. """ -# pylint: disable=useless-object-inheritance -class Base(object): +class Base: """ Base class. """ val = 0 diff --git a/tests/functional/w/with_using_generator.txt b/tests/functional/w/with_using_generator.txt index f8d80d02d..12e3ad06a 100644 --- a/tests/functional/w/with_using_generator.txt +++ b/tests/functional/w/with_using_generator.txt @@ -1 +1 @@ -not-context-manager:14:8:15:16:Base.fun:Context manager 'generator' doesn't implement __enter__ and __exit__.:UNDEFINED +not-context-manager:13:8:14:16:Base.fun:Context manager 'generator' doesn't implement __enter__ and __exit__.:UNDEFINED diff --git a/tests/functional/w/wrong_import_position.py b/tests/functional/w/wrong_import_position.py index c06f9da1f..7d1fddfa3 100644 --- a/tests/functional/w/wrong_import_position.py +++ b/tests/functional/w/wrong_import_position.py @@ -1,6 +1,6 @@ """Checks import order rule""" # pylint: disable=unused-import,ungrouped-imports,wrong-import-order -# pylint: disable=import-error, too-few-public-methods, missing-docstring,using-constant-test, useless-object-inheritance +# pylint: disable=import-error, too-few-public-methods, missing-docstring,using-constant-test import os.path if True: @@ -8,13 +8,13 @@ if True: try: import sys except ImportError: - class Myclass(object): + class Myclass: """docstring""" if sys.version_info[0] >= 3: from collections import OrderedDict else: - class OrderedDict(object): + class OrderedDict: """Nothing to see here.""" def some_func(self): pass diff --git a/tests/functional/y/yield_assign.py b/tests/functional/y/yield_assign.py index 6a5ae00b2..e7a938c69 100644 --- a/tests/functional/y/yield_assign.py +++ b/tests/functional/y/yield_assign.py @@ -1,6 +1,5 @@ """https://www.logilab.org/ticket/8771""" -from __future__ import print_function def generator(): """yield as assignment""" diff --git a/tests/functional/y/yield_return_mix.py b/tests/functional/y/yield_return_mix.py index 8e050f0f0..a69a669d6 100644 --- a/tests/functional/y/yield_return_mix.py +++ b/tests/functional/y/yield_return_mix.py @@ -1,6 +1,6 @@ """ module doc """ # pylint: disable=useless-return -__revision__ = None + def somegen(): """this kind of mix is OK""" diff --git a/tests/regrtest_data/classdoc_usage.py b/tests/regrtest_data/classdoc_usage.py index 2d9df51cd..b12bafa72 100644 --- a/tests/regrtest_data/classdoc_usage.py +++ b/tests/regrtest_data/classdoc_usage.py @@ -1,9 +1,8 @@ """ds""" __revision__ = None -# pylint: disable=useless-object-inheritance -class SomeClass(object): +class SomeClass: """cds""" doc = __doc__ diff --git a/tests/regrtest_data/func_block_disable_msg.py b/tests/regrtest_data/func_block_disable_msg.py index 8a94ab4f3..a1dd9a627 100644 --- a/tests/regrtest_data/func_block_disable_msg.py +++ b/tests/regrtest_data/func_block_disable_msg.py @@ -1,8 +1,8 @@ -# pylint: disable=C0302,bare-except, useless-object-inheritance +# pylint: disable=C0302,bare-except """pylint option block-disable""" from __future__ import print_function -class Foo(object): +class Foo: """block-disable test""" def __init__(self): @@ -110,7 +110,7 @@ class Foo(object): print(self.blu) -class ClassLevelMessage(object): +class ClassLevelMessage: """shouldn't display to much attributes/not enough methods messages """ # pylint: disable=R0902,R0903 |