Coverage for /usr/local/lib/python3.12/site-packages/prefect/server/api/__init__.py: 60%

16 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 02:04 +0000

1from __future__ import annotations 

2 

3import importlib 

4from typing import TYPE_CHECKING 

5 

6if TYPE_CHECKING: 6 ↛ 7line 6 didn't jump to line 7 because the condition on line 6 was never true

7 from prefect.server.api import ( 

8 admin, 

9 artifacts, 

10 automations, 

11 block_capabilities, 

12 block_documents, 

13 block_schemas, 

14 block_types, 

15 collections, 

16 concurrency_limits, 

17 concurrency_limits_v2, 

18 csrf_token, 

19 dependencies, 

20 deployments, 

21 events, 

22 flow_run_states, 

23 flow_runs, 

24 flows, 

25 logs, 

26 middleware, 

27 root, 

28 run_history, 

29 saved_searches, 

30 server, 

31 task_run_states, 

32 task_runs, 

33 task_workers, 

34 templates, 

35 ui, 

36 variables, 

37 work_queues, 

38 workers, 

39 ) 

40 

41__all__ = [ 

42 "admin", 

43 "artifacts", 

44 "automations", 

45 "block_capabilities", 

46 "block_documents", 

47 "block_schemas", 

48 "block_types", 

49 "collections", 

50 "concurrency_limits", 

51 "concurrency_limits_v2", 

52 "csrf_token", 

53 "dependencies", 

54 "deployments", 

55 "events", 

56 "flow_run_states", 

57 "flow_runs", 

58 "flows", 

59 "logs", 

60 "middleware", 

61 "root", 

62 "run_history", 

63 "saved_searches", 

64 "server", 

65 "task_run_states", 

66 "task_runs", 

67 "task_workers", 

68 "templates", 

69 "ui", 

70 "variables", 

71 "work_queues", 

72 "workers", 

73] 

74 

75 

76def __getattr__(name: str) -> object: 

77 module_name = f"{__name__}.{name}" 

78 try: 

79 module = importlib.import_module(module_name) 

80 except ModuleNotFoundError as exc: 

81 if exc.name != module_name: 

82 raise 

83 raise AttributeError(f"module {__name__!r} has no attribute {name!r}") from None 

84 

85 globals()[name] = module 

86 return module