Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

module2.py 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. from data.module import YO, YOUPI
  2. import data
  3. class Specialization(YOUPI, YO):
  4. pass
  5. class Metaclass(type):
  6. pass
  7. class Interface:
  8. pass
  9. class MyIFace(Interface):
  10. pass
  11. class AnotherIFace(Interface):
  12. pass
  13. class MyException(Exception):
  14. pass
  15. class MyError(MyException):
  16. pass
  17. class AbstractClass(object):
  18. def to_override(self, whatever):
  19. raise NotImplementedError()
  20. def return_something(self, param):
  21. if param:
  22. return 'toto'
  23. return
  24. class Concrete0:
  25. __implements__ = MyIFace
  26. class Concrete1:
  27. __implements__ = (MyIFace, AnotherIFace)
  28. class Concrete2:
  29. __implements__ = (MyIFace, AnotherIFace)
  30. class Concrete23(Concrete1):
  31. pass
  32. del YO.member
  33. del YO
  34. [SYN1, SYN2] = (Concrete0, Concrete1)
  35. assert '1'
  36. b = (1) | (((2) & (3)) ^ (8))
  37. bb = ((1) | (two)) | (6)
  38. ccc = ((one) & (two)) & (three)
  39. dddd = ((x) ^ (o)) ^ (r)
  40. exec 'c = 3'
  41. exec 'c = 3' in {}, {}
  42. def raise_string(a=2, *args, **kwargs):
  43. raise Exception, 'yo'
  44. yield 'coucou'
  45. yield
  46. a = (b) + (2)
  47. c = (b) * (2)
  48. c = (b) / (2)
  49. c = (b) // (2)
  50. c = (b) - (2)
  51. c = (b) % (2)
  52. c = (b) ** (2)
  53. c = (b) << (2)
  54. c = (b) >> (2)
  55. c = ~b
  56. c = not b
  57. d = [c]
  58. e = d[:]
  59. e = d[a:b:c]
  60. raise_string(*args, **kwargs)
  61. print >> stream, 'bonjour'
  62. print >> stream, 'salut',
  63. def make_class(any, base=data.module.YO, *args, **kwargs):
  64. """check base is correctly resolved to Concrete0"""
  65. class Aaaa(base):
  66. """dynamic class"""
  67. return Aaaa
  68. from os.path import abspath
  69. import os as myos
  70. class A:
  71. pass
  72. class A(A):
  73. pass
  74. def generator():
  75. """A generator."""
  76. yield
  77. def not_a_generator():
  78. """A function that contains generator, but is not one."""
  79. def generator():
  80. yield
  81. genl = lambda : (yield)
  82. def with_metaclass(meta, *bases):
  83. return meta('NewBase', bases, {})
  84. class NotMetaclass(with_metaclass(Metaclass)):
  85. pass