| 1 |
from __future__ import print_function |
| 2 |
from data.module import YO, YOUPI |
| 3 |
import data |
| 4 |
|
| 5 |
|
| 6 |
class Specialization(YOUPI, YO): |
| 7 |
pass |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
class Metaclass(type): |
| 12 |
pass |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
class Interface: |
| 17 |
pass |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
class MyIFace(Interface): |
| 22 |
pass |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
class AnotherIFace(Interface): |
| 27 |
pass |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
class MyException(Exception): |
| 32 |
pass |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
class MyError(MyException): |
| 37 |
pass |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
class AbstractClass(object): |
| 42 |
|
| 43 |
def to_override(self, whatever): |
| 44 |
raise NotImplementedError() |
| 45 |
|
| 46 |
def return_something(self, param): |
| 47 |
if param: |
| 48 |
return 'toto' |
| 49 |
return |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
class Concrete0: |
| 54 |
__implements__ = MyIFace |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
class Concrete1: |
| 59 |
__implements__ = (MyIFace, AnotherIFace) |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
class Concrete2: |
| 64 |
__implements__ = (MyIFace, AnotherIFace) |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
class Concrete23(Concrete1): |
| 69 |
pass |
| 70 |
|
| 71 |
del YO.member |
| 72 |
del YO |
| 73 |
[SYN1, SYN2] = (Concrete0, Concrete1) |
| 74 |
assert repr(1) |
| 75 |
b = (1 | 2) & (3 ^ 8) |
| 76 |
bb = 1 | (two | 6) |
| 77 |
ccc = one & two & three |
| 78 |
dddd = x ^ (o ^ r) |
| 79 |
exec('c = 3') |
| 80 |
exec('c = 3', {}, {}) |
| 81 |
|
| 82 |
def raise_string(a=2, *args, **kwargs): |
| 83 |
raise Exception('yo') |
| 84 |
yield 'coucou' |
| 85 |
yield |
| 86 |
a = 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 >> 2 |
| 95 |
c = ~b |
| 96 |
c = not b |
| 97 |
d = [c] |
| 98 |
e = d[:] |
| 99 |
e = d[a:b:c] |
| 100 |
raise_string(*args, **kwargs) |
| 101 |
print('bonjour', file=stream) |
| 102 |
print('salut', end=' ', file=stream) |
| 103 |
|
| 104 |
def make_class(any, base=data.module.YO, *args, **kwargs): |
| 105 |
"""check base is correctly resolved to Concrete0""" |
| 106 |
|
| 107 |
|
| 108 |
class Aaaa(base): |
| 109 |
"""dynamic class""" |
| 110 |
|
| 111 |
|
| 112 |
return Aaaa |
| 113 |
from os.path import abspath |
| 114 |
import os as myos |
| 115 |
|
| 116 |
|
| 117 |
class A: |
| 118 |
pass |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
class A(A): |
| 123 |
pass |
| 124 |
|
| 125 |
|
| 126 |
def generator(): |
| 127 |
"""A generator.""" |
| 128 |
yield |
| 129 |
|
| 130 |
def not_a_generator(): |
| 131 |
"""A function that contains generator, but is not one.""" |
| 132 |
|
| 133 |
def generator(): |
| 134 |
yield |
| 135 |
genl = lambda: (yield) |
| 136 |
|
| 137 |
def with_metaclass(meta, *bases): |
| 138 |
return meta('NewBase', bases, {}) |
| 139 |
|
| 140 |
|
| 141 |
class NotMetaclass(with_metaclass(Metaclass)): |
| 142 |
pass |
| 143 |
|
| 144 |
|