Statistics
| Revision:

gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / lib / astroid / tests / testdata / python2 / data / module2.py @ 745

History | View | Annotate | Download (1.91 KB)

1
from data.module import YO, YOUPI
2
import data
3

    
4

    
5
class Specialization(YOUPI, YO):
6
    pass
7

    
8

    
9

    
10
class Metaclass(type):
11
    pass
12

    
13

    
14

    
15
class Interface:
16
    pass
17

    
18

    
19

    
20
class MyIFace(Interface):
21
    pass
22

    
23

    
24

    
25
class AnotherIFace(Interface):
26
    pass
27

    
28

    
29

    
30
class MyException(Exception):
31
    pass
32

    
33

    
34

    
35
class MyError(MyException):
36
    pass
37

    
38

    
39

    
40
class AbstractClass(object):
41
    
42
    def to_override(self, whatever):
43
        raise NotImplementedError()
44
    
45
    def return_something(self, param):
46
        if param:
47
            return 'toto'
48
        return
49

    
50

    
51

    
52
class Concrete0:
53
    __implements__ = MyIFace
54

    
55

    
56

    
57
class Concrete1:
58
    __implements__ = (MyIFace, AnotherIFace)
59

    
60

    
61

    
62
class Concrete2:
63
    __implements__ = (MyIFace, AnotherIFace)
64

    
65

    
66

    
67
class Concrete23(Concrete1):
68
    pass
69

    
70
del YO.member
71
del YO
72
[SYN1, SYN2] = (Concrete0, Concrete1)
73
assert '1'
74
b = (1) | (((2) & (3)) ^ (8))
75
bb = ((1) | (two)) | (6)
76
ccc = ((one) & (two)) & (three)
77
dddd = ((x) ^ (o)) ^ (r)
78
exec 'c = 3'
79
exec 'c = 3' in {}, {}
80

    
81
def raise_string(a=2, *args, **kwargs):
82
    raise Exception, 'yo'
83
    yield 'coucou'
84
    yield
85
a = (b) + (2)
86
c = (b) * (2)
87
c = (b) / (2)
88
c = (b) // (2)
89
c = (b) - (2)
90
c = (b) % (2)
91
c = (b) ** (2)
92
c = (b) << (2)
93
c = (b) >> (2)
94
c = ~b
95
c = not b
96
d = [c]
97
e = d[:]
98
e = d[a:b:c]
99
raise_string(*args, **kwargs)
100
print >> stream, 'bonjour'
101
print >> stream, 'salut',
102

    
103
def make_class(any, base=data.module.YO, *args, **kwargs):
104
    """check base is correctly resolved to Concrete0"""
105
    
106
    
107
    class Aaaa(base):
108
        """dynamic class"""
109
        
110
    
111
    return Aaaa
112
from os.path import abspath
113
import os as myos
114

    
115

    
116
class A:
117
    pass
118

    
119

    
120

    
121
class A(A):
122
    pass
123

    
124

    
125
def generator():
126
    """A generator."""
127
    yield
128

    
129
def not_a_generator():
130
    """A function that contains generator, but is not one."""
131
    
132
    def generator():
133
        yield
134
    genl = lambda : (yield)
135

    
136
def with_metaclass(meta, *bases):
137
    return meta('NewBase', bases, {})
138

    
139

    
140
class NotMetaclass(with_metaclass(Metaclass)):
141
    pass
142

    
143