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
|
from datetime import datetime
from datetime import date
class MainParent(object):
pass
class SubParent1(MainParent):
def foo(self):
pass
pass
class SubParent2(MainParent):
pass
class Child(SubParent1, SubParent2):
def spam(self):
pass
pass
class NoParentsAllowed(datetime, object):
def foo(self):
pass
pass
class NoMembers(object):
pass
class BadMro(MainParent, object, SubParent1, SubParent2):
pass
class HugeChild(SubParent1, date): #SubParent1 is disabled
__metaclass__ = None # Anyway, this field should be ignored and processed separately as "metaclass", not "class field"
def __init__(self):
self.instance_field_1 = 42
self.instance_field_2 = 100500
CLASS_FIELD = 42
(CLASS_FIELD_A,CLASS_FIELD_B) = (42,100500) #We do not support tuples in class assignments for now (see ClassFieldsManager)
def _set(self, val): # Should not be treated as method (part of property)
pass
def _get(self): # Should not be treated as method (part of property)
return None
name = property(fget=_get, fset=_set)
@property
def some_property(self): # Should not be treated as method (part of property)
return None
@some_property.setter
def some_property(self, val): # Should not be treated as method (part of property)
pass
def foo(self): #should be disabled
self.some_property = 12
def bar(self):
pass
@classmethod
def static_1(cls): # Could be abstract in Py3K
pass
@staticmethod
def static_2(): # Could be abstract in Py3K
pass
@staticmethod
def bad_method(): #Code has errors, so method should be not be marked as static
pass
class Bar(object):
C = 1
class Foo(Bar):
def __init__(self):
self.foo = 12
class ParentWithConflicts(Bar):
CLASS_FIELD = 42
def __init__(self):
self.instance_field = 12
def my_func(self):
pass
class ChildWithConflicts(ParentWithConflicts, Bar): # Bar -> conflict
CLASS_FIELD = 42 # Conflict
GOOD_FIELD = 32
def __init__(self):
self.instance_field = 12 # Conflict
self.good_instance_field = "egg"
def my_func(self): # Conflict
pass
|