t530.trans 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. Module(body=[ClassDef(name='GeneratorClass',
  2. bases=[],
  3. body=[Assign(targets=[Name(id='test',
  4. ctx=Store())],
  5. value=Str(s='hi')),
  6. FunctionDef(name='__init__',
  7. args=arguments(args=[Name(id='self',
  8. ctx=Param())],
  9. vararg=None,
  10. kwarg=None,
  11. defaults=[]),
  12. body=[Pass()],
  13. decorator_list=[]),
  14. FunctionDef(name='generator',
  15. args=arguments(args=[Name(id='self',
  16. ctx=Param())],
  17. vararg=None,
  18. kwarg=None,
  19. defaults=[]),
  20. body=[Print(dest=None,
  21. values=[Attribute(value=Name(id='self',
  22. ctx=Load()),
  23. attr='test',
  24. ctx=Load())],
  25. nl=True),
  26. For(target=Name(id='i',
  27. ctx=Store()),
  28. iter=Call(func=Name(id='range',
  29. ctx=Load()),
  30. args=[Num(n=10)],
  31. keywords=[],
  32. starargs=None,
  33. kwargs=None),
  34. body=[Expr(value=Yield(value=Name(id='i',
  35. ctx=Load())))],
  36. orelse=[])],
  37. decorator_list=[])],
  38. decorator_list=[]),
  39. Assign(targets=[Name(id='gen',
  40. ctx=Store())],
  41. value=Call(func=Name(id='GeneratorClass',
  42. ctx=Load()),
  43. args=[],
  44. keywords=[],
  45. starargs=None,
  46. kwargs=None)),
  47. For(target=Name(id='g',
  48. ctx=Store()),
  49. iter=Call(func=Attribute(value=Name(id='gen',
  50. ctx=Load()),
  51. attr='generator',
  52. ctx=Load()),
  53. args=[],
  54. keywords=[],
  55. starargs=None,
  56. kwargs=None),
  57. body=[Print(dest=None,
  58. values=[Name(id='g',
  59. ctx=Load())],
  60. nl=True)],
  61. orelse=[])])