t545.trans 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. Module(body=[ImportFrom(module='time',
  2. names=[alias(name='sleep',
  3. asname=None)],
  4. level=0),
  5. FunctionDef(name='sleepFiveTimes',
  6. args=arguments(args=[Name(id='param',
  7. ctx=Param())],
  8. vararg=None,
  9. kwarg=None,
  10. defaults=[]),
  11. body=[Assign(targets=[Name(id='v',
  12. ctx=Store())],
  13. value=Num(n=0)),
  14. For(target=Name(id='i',
  15. ctx=Store()),
  16. iter=Call(func=Name(id='range',
  17. ctx=Load()),
  18. args=[Num(n=5)],
  19. keywords=[],
  20. starargs=None,
  21. kwargs=None),
  22. body=[Expr(value=Call(func=Name(id='sleep',
  23. ctx=Load()),
  24. args=[Num(n=0.01)],
  25. keywords=[],
  26. starargs=None,
  27. kwargs=None)),
  28. Expr(value=Yield(value=Name(id='v',
  29. ctx=Load()))),
  30. AugAssign(target=Name(id='v',
  31. ctx=Store()),
  32. op=Add(),
  33. value=Name(id='param',
  34. ctx=Load()))],
  35. orelse=[])],
  36. decorator_list=[]),
  37. Assign(targets=[Name(id='gen',
  38. ctx=Store())],
  39. value=Call(func=Name(id='sleepFiveTimes',
  40. ctx=Load()),
  41. args=[Num(n=5)],
  42. keywords=[],
  43. starargs=None,
  44. kwargs=None)),
  45. Print(dest=None,
  46. values=[Call(func=Attribute(value=Name(id='gen',
  47. ctx=Load()),
  48. attr='next',
  49. ctx=Load()),
  50. args=[],
  51. keywords=[],
  52. starargs=None,
  53. kwargs=None)],
  54. nl=True),
  55. For(target=Name(id='v',
  56. ctx=Store()),
  57. iter=Name(id='gen',
  58. ctx=Load()),
  59. body=[Print(dest=None,
  60. values=[Name(id='v',
  61. ctx=Load())],
  62. nl=True)],
  63. orelse=[])])