File: inheritance.py

package info (click to toggle)
python-jedi 0.19.1%2Bds1-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,680 kB
  • sloc: python: 28,783; makefile: 172; ansic: 13
file content (76 lines) | stat: -rw-r--r-- 1,357 bytes parent folder | download | duplicates (3)
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

class Super(object):
    attribute = 3

    def func(self):
        return 1

    class Inner():
        pass


class Sub(Super):
    #? 13 Sub.attribute
    def attribute(self):
        pass

    #! 8 ['attribute = 3']
    def attribute(self):
        pass

    #! 4 ['def func']
    func = 3
    #! 12 ['def func']
    class func(): pass

    #! 8 ['class Inner']
    def Inner(self): pass

# -----------------
# Finding self
# -----------------

class Test1:
    class Test2:
        def __init__(self):
            self.foo_nested = 0
            #? ['foo_nested']
            self.foo_
            #?
            self.foo_here

    def __init__(self, self2):
        self.foo_here = 3
        #? ['foo_here', 'foo_in_func']
        self.foo_
        #? int()
        self.foo_here
        #?
        self.foo_nested
        #?
        self.foo_not_on_self
        #? float()
        self.foo_in_func
        self2.foo_on_second = ''

        def closure():
            self.foo_in_func = 4.

    def bar(self):
        self = 3
        self.foo_not_on_self = 3


class SubTest(Test1):
    def __init__(self):
        self.foo_sub_class = list

    def bar(self):
        #? ['foo_here', 'foo_in_func', 'foo_sub_class']
        self.foo_
        #? int()
        self.foo_here
        #?
        self.foo_nested
        #?
        self.foo_not_on_self