t510.trans 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. Module(body=[Assign(targets=[Name(id='l',
  2. ctx=Store())],
  3. value=List(elts=[Num(n=1),
  4. Num(n=2),
  5. Num(n=3),
  6. Num(n=4)],
  7. ctx=Load())),
  8. For(target=Name(id='i',
  9. ctx=Store()),
  10. iter=Call(func=Attribute(value=Name(id='l',
  11. ctx=Load()),
  12. attr='__iter__',
  13. ctx=Load()),
  14. args=[],
  15. keywords=[],
  16. starargs=None,
  17. kwargs=None),
  18. body=[Print(dest=None,
  19. values=[Name(id='i',
  20. ctx=Load())],
  21. nl=True)],
  22. orelse=[]),
  23. ClassDef(name='MyIterable',
  24. bases=[],
  25. body=[FunctionDef(name='__init__',
  26. args=arguments(args=[Name(id='self',
  27. ctx=Param()),
  28. Name(id='lst',
  29. ctx=Param())],
  30. vararg=None,
  31. kwarg=None,
  32. defaults=[]),
  33. body=[Assign(targets=[Attribute(value=Name(id='self',
  34. ctx=Load()),
  35. attr='x',
  36. ctx=Store())],
  37. value=Num(n=3)),
  38. Assign(targets=[Attribute(value=Name(id='self',
  39. ctx=Load()),
  40. attr='iter',
  41. ctx=Store())],
  42. value=Name(id='lst',
  43. ctx=Load()))],
  44. decorator_list=[]),
  45. FunctionDef(name='__iter__',
  46. args=arguments(args=[Name(id='self',
  47. ctx=Param())],
  48. vararg=None,
  49. kwarg=None,
  50. defaults=[]),
  51. body=[Return(value=Call(func=Attribute(value=Attribute(value=Name(id='self',
  52. ctx=Load()),
  53. attr='iter',
  54. ctx=Load()),
  55. attr='__iter__',
  56. ctx=Load()),
  57. args=[],
  58. keywords=[],
  59. starargs=None,
  60. kwargs=None))],
  61. decorator_list=[])],
  62. decorator_list=[]),
  63. Assign(targets=[Name(id='mi',
  64. ctx=Store())],
  65. value=Call(func=Name(id='MyIterable',
  66. ctx=Load()),
  67. args=[List(elts=[Num(n=5),
  68. Num(n=6),
  69. Num(n=7)],
  70. ctx=Load())],
  71. keywords=[],
  72. starargs=None,
  73. kwargs=None)),
  74. For(target=Name(id='i',
  75. ctx=Store()),
  76. iter=Call(func=Attribute(value=Name(id='mi',
  77. ctx=Load()),
  78. attr='__iter__',
  79. ctx=Load()),
  80. args=[],
  81. keywords=[],
  82. starargs=None,
  83. kwargs=None),
  84. body=[Print(dest=None,
  85. values=[Name(id='i',
  86. ctx=Load())],
  87. nl=True)],
  88. orelse=[]),
  89. For(target=Name(id='i',
  90. ctx=Store()),
  91. iter=Name(id='mi',
  92. ctx=Load()),
  93. body=[Print(dest=None,
  94. values=[Name(id='i',
  95. ctx=Load())],
  96. nl=True)],
  97. orelse=[]),
  98. ClassDef(name='Counter',
  99. bases=[],
  100. body=[FunctionDef(name='__init__',
  101. args=arguments(args=[Name(id='self',
  102. ctx=Param()),
  103. Name(id='low',
  104. ctx=Param()),
  105. Name(id='high',
  106. ctx=Param())],
  107. vararg=None,
  108. kwarg=None,
  109. defaults=[]),
  110. body=[Assign(targets=[Attribute(value=Name(id='self',
  111. ctx=Load()),
  112. attr='current',
  113. ctx=Store())],
  114. value=Name(id='low',
  115. ctx=Load())),
  116. Assign(targets=[Attribute(value=Name(id='self',
  117. ctx=Load()),
  118. attr='high',
  119. ctx=Store())],
  120. value=Name(id='high',
  121. ctx=Load()))],
  122. decorator_list=[]),
  123. FunctionDef(name='__iter__',
  124. args=arguments(args=[Name(id='self',
  125. ctx=Param())],
  126. vararg=None,
  127. kwarg=None,
  128. defaults=[]),
  129. body=[Return(value=Name(id='self',
  130. ctx=Load()))],
  131. decorator_list=[]),
  132. FunctionDef(name='next',
  133. args=arguments(args=[Name(id='self',
  134. ctx=Param())],
  135. vararg=None,
  136. kwarg=None,
  137. defaults=[]),
  138. body=[If(test=Compare(left=Attribute(value=Name(id='self',
  139. ctx=Load()),
  140. attr='current',
  141. ctx=Load()),
  142. ops=[Gt()],
  143. comparators=[Attribute(value=Name(id='self',
  144. ctx=Load()),
  145. attr='high',
  146. ctx=Load())]),
  147. body=[Raise(type=Name(id='StopIteration',
  148. ctx=Load()),
  149. inst=None,
  150. tback=None)],
  151. orelse=[AugAssign(target=Attribute(value=Name(id='self',
  152. ctx=Load()),
  153. attr='current',
  154. ctx=Store()),
  155. op=Add(),
  156. value=Num(n=1)),
  157. Return(value=BinOp(left=Attribute(value=Name(id='self',
  158. ctx=Load()),
  159. attr='current',
  160. ctx=Load()),
  161. op=Sub(),
  162. right=Num(n=1)))])],
  163. decorator_list=[])],
  164. decorator_list=[]),
  165. For(target=Name(id='c',
  166. ctx=Store()),
  167. iter=Call(func=Name(id='Counter',
  168. ctx=Load()),
  169. args=[Num(n=9),
  170. Num(n=12)],
  171. keywords=[],
  172. starargs=None,
  173. kwargs=None),
  174. body=[Print(dest=None,
  175. values=[Name(id='c',
  176. ctx=Load())],
  177. nl=True)],
  178. orelse=[]),
  179. ClassDef(name='SillyTupleIter',
  180. bases=[],
  181. body=[FunctionDef(name='__init__',
  182. args=arguments(args=[Name(id='self',
  183. ctx=Param()),
  184. Name(id='s',
  185. ctx=Param())],
  186. vararg=None,
  187. kwarg=None,
  188. defaults=[]),
  189. body=[Assign(targets=[Attribute(value=Name(id='self',
  190. ctx=Load()),
  191. attr='w',
  192. ctx=Store())],
  193. value=Call(func=Name(id='tuple',
  194. ctx=Load()),
  195. args=[Name(id='s',
  196. ctx=Load())],
  197. keywords=[],
  198. starargs=None,
  199. kwargs=None))],
  200. decorator_list=[]),
  201. FunctionDef(name='__iter__',
  202. args=arguments(args=[Name(id='self',
  203. ctx=Param())],
  204. vararg=None,
  205. kwarg=None,
  206. defaults=[]),
  207. body=[Return(value=Call(func=Attribute(value=Attribute(value=Name(id='self',
  208. ctx=Load()),
  209. attr='w',
  210. ctx=Load()),
  211. attr='__iter__',
  212. ctx=Load()),
  213. args=[],
  214. keywords=[],
  215. starargs=None,
  216. kwargs=None))],
  217. decorator_list=[])],
  218. decorator_list=[]),
  219. Assign(targets=[Name(id='x',
  220. ctx=Store())],
  221. value=Call(func=Name(id='SillyTupleIter',
  222. ctx=Load()),
  223. args=[Str(s='foo')],
  224. keywords=[],
  225. starargs=None,
  226. kwargs=None)),
  227. For(target=Name(id='i',
  228. ctx=Store()),
  229. iter=Name(id='x',
  230. ctx=Load()),
  231. body=[Print(dest=None,
  232. values=[Name(id='i',
  233. ctx=Load())],
  234. nl=True)],
  235. orelse=[])])