1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
# pylint: disable=too-few-public-methods, useless-object-inheritance,missing-docstring
# pylint: disable=unused-private-member
"""check method hidding ancestor attribute
"""
from __future__ import print_function
class Abcd(object):
"""dummy"""
def __init__(self):
self.abcd = 1
class Cdef(Abcd):
"""dummy"""
def abcd(self): # [method-hidden]
"""test"""
print(self)
class AbcdMixin:
def abcd(self):
pass
class Dabc(AbcdMixin, Abcd):
def abcd(self):
pass
class CustomProperty:
"""dummy"""
def __init__(self, _):
pass
def __get__(self, obj, __):
if not obj:
return self
return 5
def __set__(self, _, __):
pass
class Ddef:
"""dummy"""
def __init__(self):
self.five = "five"
@CustomProperty
def five(self):
"""Always 5."""
return self
def my_decorator(*args, **kwargs):
return CustomProperty(*args, **kwargs)
class Foo:
def __init__(self):
self._bar = 42
self._baz = 84
@my_decorator
def method(self): # E0202
return self._baz
@method.setter
def method(self, value):
self._baz = value
def do_something_with_baz(self, value):
self.method = value
class One:
def __init__(self, one=None):
if one is not None:
self.one = one
def one(self): # [method-hidden]
pass
class Two(One):
def one(self):
pass
try:
import unknown as js
except ImportError:
import json as js
class JsonEncoder(js.JSONEncoder):
# pylint: disable=useless-super-delegation,super-with-arguments
def default(self, o):
return super(JsonEncoder, self).default(o)
class Parent:
def __init__(self):
self._protected = None
class Child(Parent):
def _protected(self): # [method-hidden]
pass
class ParentTwo:
def __init__(self):
self.__private = None
class ChildTwo(ParentTwo):
def __private(self):
pass
|