1
0

torture.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. """Python torture fixture — decorators, self fn-refs, imports, shadowing."""
  2. import os, sys
  3. import os.path as osp
  4. from collections import OrderedDict, defaultdict
  5. from .relative import thing
  6. from mypkg.handlers import target_cb
  7. RETRY_LIMITS = {"a": 1}
  8. API_BASE = "https://example.test"
  9. x = compute(RETRY_LIMITS)
  10. class Service(BaseService, mixins.LoggerMixin):
  11. """Class docs."""
  12. def __init__(self, registry):
  13. self.registry = registry
  14. register(self.on_event)
  15. queue(target_cb)
  16. @staticmethod
  17. def helper(arg):
  18. return transform(arg)
  19. async def run(self):
  20. cfg = self.registry.lookup("x")
  21. limit = RETRY_LIMITS
  22. obj.method_chain().deep(cfg)
  23. ", ".join(cfg)
  24. return await fetch(API_BASE)
  25. def on_event(self):
  26. pass
  27. @app.route("/x")
  28. def view():
  29. def inner():
  30. return API_BASE
  31. return inner()
  32. def shadowed():
  33. API_BASE = "local"
  34. return API_BASE
  35. handlers = {"recv": target_cb}
  36. callbacks = [target_cb, view]