prefect-client 3.1.10__tar.gz → 3.1.11__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. {prefect-client-3.1.10/src/prefect_client.egg-info → prefect-client-3.1.11}/PKG-INFO +1 -1
  2. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_experimental/lineage.py +7 -8
  3. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/_logging.py +15 -3
  4. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/compatibility/async_dispatch.py +22 -16
  5. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/compatibility/deprecated.py +42 -18
  6. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/compatibility/migration.py +2 -2
  7. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/concurrency/inspection.py +12 -14
  8. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/concurrency/primitives.py +2 -2
  9. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/concurrency/services.py +154 -80
  10. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/concurrency/waiters.py +13 -9
  11. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/pydantic/annotations/pendulum.py +7 -7
  12. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/pytz.py +4 -3
  13. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/retries.py +10 -5
  14. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/schemas/bases.py +19 -10
  15. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/schemas/validators.py +227 -388
  16. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_version.py +3 -3
  17. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/blocks/core.py +3 -3
  18. prefect-client-3.1.10/src/prefect/client/orchestration.py → prefect-client-3.1.11/src/prefect/client/orchestration/__init__.py +38 -701
  19. prefect-client-3.1.11/src/prefect/client/orchestration/_artifacts/client.py +239 -0
  20. prefect-client-3.1.11/src/prefect/client/orchestration/_concurrency_limits/client.py +762 -0
  21. prefect-client-3.1.11/src/prefect/client/orchestration/_logs/client.py +95 -0
  22. prefect-client-3.1.11/src/prefect/client/orchestration/_variables/client.py +157 -0
  23. prefect-client-3.1.11/src/prefect/client/orchestration/base.py +46 -0
  24. prefect-client-3.1.11/src/prefect/client/orchestration/routes.py +145 -0
  25. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/client/schemas/actions.py +2 -2
  26. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/client/schemas/filters.py +5 -0
  27. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/client/schemas/objects.py +3 -10
  28. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/client/schemas/schedules.py +22 -10
  29. prefect-client-3.1.11/src/prefect/concurrency/_asyncio.py +87 -0
  30. prefect-client-3.1.10/src/prefect/concurrency/events.py → prefect-client-3.1.11/src/prefect/concurrency/_events.py +10 -10
  31. prefect-client-3.1.11/src/prefect/concurrency/asyncio.py +131 -0
  32. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/concurrency/context.py +6 -4
  33. prefect-client-3.1.11/src/prefect/concurrency/services.py +64 -0
  34. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/concurrency/sync.py +23 -44
  35. prefect-client-3.1.11/src/prefect/concurrency/v1/_asyncio.py +63 -0
  36. prefect-client-3.1.10/src/prefect/concurrency/v1/events.py → prefect-client-3.1.11/src/prefect/concurrency/v1/_events.py +13 -15
  37. prefect-client-3.1.11/src/prefect/concurrency/v1/asyncio.py +93 -0
  38. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/concurrency/v1/context.py +6 -4
  39. prefect-client-3.1.11/src/prefect/concurrency/v1/services.py +70 -0
  40. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/concurrency/v1/sync.py +18 -37
  41. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/context.py +51 -44
  42. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/deployments/base.py +4 -144
  43. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/deployments/flow_runs.py +12 -2
  44. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/deployments/runner.py +11 -3
  45. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/deployments/steps/pull.py +13 -0
  46. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/events/clients.py +7 -1
  47. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/events/schemas/events.py +3 -2
  48. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/flow_engine.py +54 -47
  49. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/input/run_input.py +2 -1
  50. prefect-client-3.1.11/src/prefect/locking/__init__.py +0 -0
  51. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/main.py +1 -3
  52. prefect-client-3.1.11/src/prefect/py.typed +0 -0
  53. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/results.py +2 -307
  54. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/runner/storage.py +87 -21
  55. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/serializers.py +32 -25
  56. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/legacy.py +4 -4
  57. prefect-client-3.1.11/src/prefect/settings/models/__init__.py +0 -0
  58. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/api.py +3 -3
  59. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/cli.py +3 -3
  60. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/client.py +5 -3
  61. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/cloud.py +3 -3
  62. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/deployments.py +3 -3
  63. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/experiments.py +4 -2
  64. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/flows.py +3 -3
  65. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/internal.py +4 -2
  66. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/logging.py +4 -3
  67. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/results.py +3 -3
  68. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/root.py +3 -2
  69. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/runner.py +4 -4
  70. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/server/api.py +3 -3
  71. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/server/database.py +11 -4
  72. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/server/deployments.py +6 -2
  73. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/server/ephemeral.py +4 -2
  74. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/server/events.py +3 -2
  75. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/server/flow_run_graph.py +6 -2
  76. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/server/root.py +3 -3
  77. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/server/services.py +26 -11
  78. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/server/tasks.py +6 -3
  79. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/server/ui.py +3 -3
  80. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/tasks.py +5 -5
  81. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/testing.py +3 -3
  82. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/worker.py +5 -3
  83. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/profiles.py +15 -2
  84. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/states.py +4 -7
  85. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/task_engine.py +54 -75
  86. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/tasks.py +84 -32
  87. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/telemetry/run_telemetry.py +13 -8
  88. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/transactions.py +4 -15
  89. prefect-client-3.1.11/src/prefect/utilities/__init__.py +0 -0
  90. prefect-client-3.1.11/src/prefect/utilities/_git.py +34 -0
  91. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/asyncutils.py +1 -1
  92. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/engine.py +3 -19
  93. prefect-client-3.1.11/src/prefect/utilities/generics.py +18 -0
  94. {prefect-client-3.1.10 → prefect-client-3.1.11/src/prefect_client.egg-info}/PKG-INFO +1 -1
  95. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect_client.egg-info/SOURCES.txt +17 -8
  96. prefect-client-3.1.10/src/prefect/concurrency/asyncio.py +0 -215
  97. prefect-client-3.1.10/src/prefect/concurrency/services.py +0 -112
  98. prefect-client-3.1.10/src/prefect/concurrency/v1/asyncio.py +0 -146
  99. prefect-client-3.1.10/src/prefect/concurrency/v1/services.py +0 -116
  100. prefect-client-3.1.10/src/prefect/records/__init__.py +0 -1
  101. prefect-client-3.1.10/src/prefect/records/base.py +0 -235
  102. prefect-client-3.1.10/src/prefect/records/filesystem.py +0 -213
  103. prefect-client-3.1.10/src/prefect/records/memory.py +0 -184
  104. prefect-client-3.1.10/src/prefect/records/result_store.py +0 -70
  105. {prefect-client-3.1.10 → prefect-client-3.1.11}/LICENSE +0 -0
  106. {prefect-client-3.1.10 → prefect-client-3.1.11}/MANIFEST.in +0 -0
  107. {prefect-client-3.1.10 → prefect-client-3.1.11}/README.md +0 -0
  108. {prefect-client-3.1.10 → prefect-client-3.1.11}/requirements-client.txt +0 -0
  109. {prefect-client-3.1.10 → prefect-client-3.1.11}/requirements-dev.txt +0 -0
  110. {prefect-client-3.1.10 → prefect-client-3.1.11}/requirements.txt +0 -0
  111. {prefect-client-3.1.10 → prefect-client-3.1.11}/setup.cfg +0 -0
  112. {prefect-client-3.1.10 → prefect-client-3.1.11}/setup.py +0 -0
  113. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/.prefectignore +0 -0
  114. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/__init__.py +0 -0
  115. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_experimental/__init__.py +0 -0
  116. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/__init__.py +0 -0
  117. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/compatibility/__init__.py +0 -0
  118. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/concurrency/__init__.py +0 -0
  119. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/concurrency/api.py +0 -0
  120. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/concurrency/calls.py +0 -0
  121. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/concurrency/cancellation.py +0 -0
  122. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/concurrency/event_loop.py +0 -0
  123. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/concurrency/threads.py +0 -0
  124. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/integrations.py +0 -0
  125. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/pydantic/__init__.py +0 -0
  126. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/pydantic/annotations/__init__.py +0 -0
  127. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/pydantic/schemas.py +0 -0
  128. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/pydantic/v1_schema.py +0 -0
  129. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/pydantic/v2_schema.py +0 -0
  130. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/pydantic/v2_validated_func.py +0 -0
  131. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/schemas/__init__.py +0 -0
  132. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/schemas/fields.py +0 -0
  133. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/_internal/schemas/serializers.py +0 -0
  134. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/agent.py +0 -0
  135. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/artifacts.py +0 -0
  136. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/automations.py +0 -0
  137. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/blocks/__init__.py +0 -0
  138. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/blocks/abstract.py +0 -0
  139. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/blocks/fields.py +0 -0
  140. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/blocks/notifications.py +0 -0
  141. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/blocks/redis.py +0 -0
  142. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/blocks/system.py +0 -0
  143. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/blocks/webhook.py +0 -0
  144. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/cache_policies.py +0 -0
  145. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/client/__init__.py +0 -0
  146. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/client/base.py +0 -0
  147. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/client/cloud.py +0 -0
  148. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/client/collections.py +0 -0
  149. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/client/constants.py +0 -0
  150. {prefect-client-3.1.10/src/prefect/client/types → prefect-client-3.1.11/src/prefect/client/orchestration/_artifacts}/__init__.py +0 -0
  151. {prefect-client-3.1.10/src/prefect/concurrency → prefect-client-3.1.11/src/prefect/client/orchestration/_concurrency_limits}/__init__.py +0 -0
  152. {prefect-client-3.1.10/src/prefect/concurrency/v1 → prefect-client-3.1.11/src/prefect/client/orchestration/_logs}/__init__.py +0 -0
  153. {prefect-client-3.1.10/src/prefect/events/cli → prefect-client-3.1.11/src/prefect/client/orchestration/_variables}/__init__.py +0 -0
  154. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/client/schemas/__init__.py +0 -0
  155. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/client/schemas/responses.py +0 -0
  156. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/client/schemas/sorting.py +0 -0
  157. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/client/subscriptions.py +0 -0
  158. {prefect-client-3.1.10/src/prefect/events/schemas → prefect-client-3.1.11/src/prefect/client/types}/__init__.py +0 -0
  159. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/client/types/flexible_schedule_list.py +0 -0
  160. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/client/utilities.py +0 -0
  161. {prefect-client-3.1.10/src/prefect/locking → prefect-client-3.1.11/src/prefect/concurrency}/__init__.py +0 -0
  162. {prefect-client-3.1.10/src/prefect/settings/models → prefect-client-3.1.11/src/prefect/concurrency/v1}/__init__.py +0 -0
  163. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/deployments/__init__.py +0 -0
  164. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/deployments/deployments.py +0 -0
  165. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/deployments/schedules.py +0 -0
  166. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/deployments/steps/__init__.py +0 -0
  167. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/deployments/steps/core.py +0 -0
  168. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/deployments/steps/utility.py +0 -0
  169. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/docker/__init__.py +0 -0
  170. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/docker/docker_image.py +0 -0
  171. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/engine.py +0 -0
  172. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/events/__init__.py +0 -0
  173. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/events/actions.py +0 -0
  174. {prefect-client-3.1.10/src/prefect/utilities → prefect-client-3.1.11/src/prefect/events/cli}/__init__.py +0 -0
  175. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/events/cli/automations.py +0 -0
  176. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/events/filters.py +0 -0
  177. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/events/related.py +0 -0
  178. /prefect-client-3.1.10/src/prefect/py.typed → /prefect-client-3.1.11/src/prefect/events/schemas/__init__.py +0 -0
  179. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/events/schemas/automations.py +0 -0
  180. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/events/schemas/deployment_triggers.py +0 -0
  181. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/events/schemas/labelling.py +0 -0
  182. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/events/utilities.py +0 -0
  183. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/events/worker.py +0 -0
  184. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/exceptions.py +0 -0
  185. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/filesystems.py +0 -0
  186. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/flow_runs.py +0 -0
  187. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/flows.py +0 -0
  188. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/futures.py +0 -0
  189. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/infrastructure/__init__.py +0 -0
  190. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/infrastructure/base.py +0 -0
  191. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/infrastructure/provisioners/__init__.py +0 -0
  192. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/infrastructure/provisioners/cloud_run.py +0 -0
  193. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/infrastructure/provisioners/container_instance.py +0 -0
  194. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/infrastructure/provisioners/ecs.py +0 -0
  195. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/infrastructure/provisioners/modal.py +0 -0
  196. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/input/__init__.py +0 -0
  197. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/input/actions.py +0 -0
  198. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/locking/filesystem.py +0 -0
  199. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/locking/memory.py +0 -0
  200. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/locking/protocol.py +0 -0
  201. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/logging/__init__.py +0 -0
  202. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/logging/configuration.py +0 -0
  203. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/logging/filters.py +0 -0
  204. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/logging/formatters.py +0 -0
  205. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/logging/handlers.py +0 -0
  206. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/logging/highlighters.py +0 -0
  207. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/logging/loggers.py +0 -0
  208. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/logging/logging.yml +0 -0
  209. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/plugins.py +0 -0
  210. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/runner/__init__.py +0 -0
  211. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/runner/runner.py +0 -0
  212. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/runner/server.py +0 -0
  213. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/runner/submit.py +0 -0
  214. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/runner/utils.py +0 -0
  215. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/runtime/__init__.py +0 -0
  216. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/runtime/deployment.py +0 -0
  217. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/runtime/flow_run.py +0 -0
  218. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/runtime/task_run.py +0 -0
  219. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/server/api/collections_data/views/aggregate-worker-metadata.json +0 -0
  220. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/server/api/static/prefect-logo-mark-gradient.png +0 -0
  221. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/__init__.py +0 -0
  222. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/base.py +0 -0
  223. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/constants.py +0 -0
  224. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/context.py +0 -0
  225. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/models/server/__init__.py +0 -0
  226. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/profiles.toml +0 -0
  227. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/settings/sources.py +0 -0
  228. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/task_runners.py +0 -0
  229. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/task_runs.py +0 -0
  230. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/task_worker.py +0 -0
  231. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/telemetry/__init__.py +0 -0
  232. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/telemetry/bootstrap.py +0 -0
  233. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/telemetry/instrumentation.py +0 -0
  234. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/telemetry/logging.py +0 -0
  235. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/telemetry/processors.py +0 -0
  236. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/telemetry/services.py +0 -0
  237. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/types/__init__.py +0 -0
  238. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/types/entrypoint.py +0 -0
  239. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/_engine.py +0 -0
  240. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/annotations.py +0 -0
  241. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/callables.py +0 -0
  242. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/collections.py +0 -0
  243. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/compat.py +0 -0
  244. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/context.py +0 -0
  245. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/dispatch.py +0 -0
  246. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/dockerutils.py +0 -0
  247. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/filesystem.py +0 -0
  248. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/hashing.py +0 -0
  249. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/importtools.py +0 -0
  250. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/math.py +0 -0
  251. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/names.py +0 -0
  252. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/processutils.py +0 -0
  253. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/pydantic.py +0 -0
  254. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/render_swagger.py +0 -0
  255. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/schema_tools/__init__.py +0 -0
  256. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/schema_tools/hydration.py +0 -0
  257. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/schema_tools/validation.py +0 -0
  258. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/services.py +0 -0
  259. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/slugify.py +0 -0
  260. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/templating.py +0 -0
  261. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/text.py +0 -0
  262. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/timeout.py +0 -0
  263. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/urls.py +0 -0
  264. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/utilities/visualization.py +0 -0
  265. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/variables.py +0 -0
  266. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/workers/__init__.py +0 -0
  267. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/workers/base.py +0 -0
  268. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/workers/block.py +0 -0
  269. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/workers/cloud.py +0 -0
  270. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/workers/process.py +0 -0
  271. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/workers/server.py +0 -0
  272. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect/workers/utilities.py +0 -0
  273. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect_client.egg-info/dependency_links.txt +0 -0
  274. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect_client.egg-info/requires.txt +0 -0
  275. {prefect-client-3.1.10 → prefect-client-3.1.11}/src/prefect_client.egg-info/top_level.txt +0 -0
  276. {prefect-client-3.1.10 → prefect-client-3.1.11}/versioneer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prefect-client
3
- Version: 3.1.10
3
+ Version: 3.1.11
4
4
  Summary: Workflow orchestration and management.
5
5
  Home-page: https://www.prefect.io
6
6
  Author: Prefect Technologies, Inc.
@@ -86,18 +86,18 @@ async def emit_lineage_event(
86
86
  else:
87
87
  upstream_resources.extend(related_resources)
88
88
 
89
+ # We want to consider all resources upstream and downstream of the event as
90
+ # lineage-related, including flows, flow runs, etc., so we add the label to
91
+ # all resources involved in the event.
92
+ for res in upstream_resources + downstream_resources:
93
+ if "prefect.resource.lineage-group" not in res:
94
+ res["prefect.resource.lineage-group"] = "global"
95
+
89
96
  # Emit an event for each downstream resource. This is necessary because
90
97
  # our event schema allows one primary resource and many related resources,
91
98
  # and for the purposes of lineage, related resources can only represent
92
99
  # upstream resources.
93
100
  for resource in downstream_resources:
94
- # Downstream lineage resources need to have the
95
- # prefect.resource.lineage-group label. All upstram resources from a
96
- # downstream resource with this label will be considered lineage-related
97
- # resources.
98
- if "prefect.resource.lineage-group" not in resource:
99
- resource["prefect.resource.lineage-group"] = "global"
100
-
101
101
  emit_kwargs: Dict[str, Any] = {
102
102
  "event": event_name,
103
103
  "resource": resource,
@@ -170,7 +170,6 @@ async def emit_result_write_event(
170
170
  {
171
171
  "prefect.resource.id": result_resource_uri,
172
172
  "prefect.resource.role": "result",
173
- "prefect.resource.lineage-group": "global",
174
173
  }
175
174
  ]
176
175
  await emit_lineage_event(
@@ -1,4 +1,14 @@
1
1
  import logging
2
+ import sys
3
+
4
+ from typing_extensions import Self
5
+
6
+ if sys.version_info < (3, 11):
7
+
8
+ def getLevelNamesMapping() -> dict[str, int]:
9
+ return getattr(logging, "_nameToLevel").copy()
10
+ else:
11
+ getLevelNamesMapping = logging.getLevelNamesMapping # novermin
2
12
 
3
13
 
4
14
  class SafeLogger(logging.Logger):
@@ -11,11 +21,13 @@ class SafeLogger(logging.Logger):
11
21
  # deadlocks during complex concurrency handling
12
22
  from prefect.settings import PREFECT_LOGGING_INTERNAL_LEVEL
13
23
 
14
- return level >= logging._nameToLevel[PREFECT_LOGGING_INTERNAL_LEVEL.value()]
24
+ internal_level = getLevelNamesMapping()[PREFECT_LOGGING_INTERNAL_LEVEL.value()]
25
+
26
+ return level >= internal_level
15
27
 
16
- def getChild(self, suffix: str):
28
+ def getChild(self, suffix: str) -> Self:
17
29
  logger = super().getChild(suffix)
18
- logger.__class__ = SafeLogger
30
+ logger.__class__ = self.__class__
19
31
  return logger
20
32
 
21
33
 
@@ -1,11 +1,13 @@
1
1
  import asyncio
2
2
  import inspect
3
+ from collections.abc import Coroutine
3
4
  from functools import wraps
4
- from typing import TYPE_CHECKING, Any, Callable, Coroutine, Optional, TypeVar, Union
5
+ from typing import TYPE_CHECKING, Any, Callable, TypeVar, Union, cast
5
6
 
6
7
  from typing_extensions import ParamSpec
7
8
 
8
9
  if TYPE_CHECKING:
10
+ from prefect.flows import Flow
9
11
  from prefect.tasks import Task
10
12
 
11
13
  R = TypeVar("R")
@@ -41,7 +43,9 @@ def is_in_async_context() -> bool:
41
43
 
42
44
 
43
45
  def _is_acceptable_callable(
44
- obj: Union[Callable[P, R], "Task[P, R]", classmethod],
46
+ obj: Union[
47
+ Callable[P, R], "Flow[P, R]", "Task[P, R]", "classmethod[type[Any], P, R]"
48
+ ],
45
49
  ) -> bool:
46
50
  if inspect.iscoroutinefunction(obj):
47
51
  return True
@@ -58,7 +62,10 @@ def _is_acceptable_callable(
58
62
 
59
63
 
60
64
  def async_dispatch(
61
- async_impl: Callable[P, Coroutine[Any, Any, R]],
65
+ async_impl: Union[
66
+ Callable[P, Coroutine[Any, Any, R]],
67
+ "classmethod[type[Any], P, Coroutine[Any, Any, R]]",
68
+ ],
62
69
  ) -> Callable[[Callable[P, R]], Callable[P, Union[R, Coroutine[Any, Any, R]]]]:
63
70
  """
64
71
  Decorator that dispatches to either sync or async implementation based on context.
@@ -66,27 +73,26 @@ def async_dispatch(
66
73
  Args:
67
74
  async_impl: The async implementation to dispatch to when in async context
68
75
  """
76
+ if not _is_acceptable_callable(async_impl):
77
+ raise TypeError("async_impl must be an async function")
78
+ if isinstance(async_impl, classmethod):
79
+ async_impl = cast(Callable[P, Coroutine[Any, Any, R]], async_impl.__func__)
69
80
 
70
81
  def decorator(
71
82
  sync_fn: Callable[P, R],
72
83
  ) -> Callable[P, Union[R, Coroutine[Any, Any, R]]]:
73
- if not _is_acceptable_callable(async_impl):
74
- raise TypeError("async_impl must be an async function")
75
-
76
84
  @wraps(sync_fn)
77
85
  def wrapper(
78
86
  *args: P.args,
79
- _sync: Optional[bool] = None, # type: ignore
80
87
  **kwargs: P.kwargs,
81
88
  ) -> Union[R, Coroutine[Any, Any, R]]:
82
- should_run_sync = _sync if _sync is not None else not is_in_async_context()
83
-
84
- if should_run_sync:
85
- return sync_fn(*args, **kwargs)
86
- if isinstance(async_impl, classmethod):
87
- return async_impl.__func__(*args, **kwargs)
88
- return async_impl(*args, **kwargs)
89
-
90
- return wrapper # type: ignore
89
+ _sync = kwargs.pop("_sync", None)
90
+ should_run_sync = (
91
+ bool(_sync) if _sync is not None else not is_in_async_context()
92
+ )
93
+ fn = sync_fn if should_run_sync else async_impl
94
+ return fn(*args, **kwargs)
95
+
96
+ return wrapper
91
97
 
92
98
  return decorator
@@ -13,10 +13,11 @@ e.g. Jan 2023.
13
13
  import functools
14
14
  import sys
15
15
  import warnings
16
- from typing import Any, Callable, List, Optional, Type, TypeVar
16
+ from typing import TYPE_CHECKING, Any, Callable, Optional, Union
17
17
 
18
18
  import pendulum
19
19
  from pydantic import BaseModel
20
+ from typing_extensions import ParamSpec, TypeAlias, TypeVar
20
21
 
21
22
  from prefect.utilities.callables import get_call_parameters
22
23
  from prefect.utilities.importtools import (
@@ -25,8 +26,10 @@ from prefect.utilities.importtools import (
25
26
  to_qualified_name,
26
27
  )
27
28
 
28
- T = TypeVar("T", bound=Callable)
29
+ P = ParamSpec("P")
30
+ R = TypeVar("R", infer_variance=True)
29
31
  M = TypeVar("M", bound=BaseModel)
32
+ T = TypeVar("T")
30
33
 
31
34
 
32
35
  DEPRECATED_WARNING = (
@@ -38,7 +41,7 @@ DEPRECATED_MOVED_WARNING = (
38
41
  "path after {end_date}. {help}"
39
42
  )
40
43
  DEPRECATED_DATEFMT = "MMM YYYY" # e.g. Feb 2023
41
- DEPRECATED_MODULE_ALIASES: List[AliasedModuleDefinition] = []
44
+ DEPRECATED_MODULE_ALIASES: list[AliasedModuleDefinition] = []
42
45
 
43
46
 
44
47
  class PrefectDeprecationWarning(DeprecationWarning):
@@ -53,7 +56,7 @@ def generate_deprecation_message(
53
56
  end_date: Optional[str] = None,
54
57
  help: str = "",
55
58
  when: str = "",
56
- ):
59
+ ) -> str:
57
60
  if not start_date and not end_date:
58
61
  raise ValueError(
59
62
  "A start date is required if an end date is not provided. Suggested start"
@@ -61,6 +64,8 @@ def generate_deprecation_message(
61
64
  )
62
65
 
63
66
  if not end_date:
67
+ if TYPE_CHECKING:
68
+ assert start_date is not None
64
69
  parsed_start_date = pendulum.from_format(start_date, DEPRECATED_DATEFMT)
65
70
  parsed_end_date = parsed_start_date.add(months=6)
66
71
  end_date = parsed_end_date.format(DEPRECATED_DATEFMT)
@@ -83,8 +88,8 @@ def deprecated_callable(
83
88
  end_date: Optional[str] = None,
84
89
  stacklevel: int = 2,
85
90
  help: str = "",
86
- ) -> Callable[[T], T]:
87
- def decorator(fn: T):
91
+ ) -> Callable[[Callable[P, R]], Callable[P, R]]:
92
+ def decorator(fn: Callable[P, R]) -> Callable[P, R]:
88
93
  message = generate_deprecation_message(
89
94
  name=to_qualified_name(fn),
90
95
  start_date=start_date,
@@ -93,7 +98,7 @@ def deprecated_callable(
93
98
  )
94
99
 
95
100
  @functools.wraps(fn)
96
- def wrapper(*args, **kwargs):
101
+ def wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
97
102
  warnings.warn(message, PrefectDeprecationWarning, stacklevel=stacklevel)
98
103
  return fn(*args, **kwargs)
99
104
 
@@ -108,8 +113,8 @@ def deprecated_class(
108
113
  end_date: Optional[str] = None,
109
114
  stacklevel: int = 2,
110
115
  help: str = "",
111
- ) -> Callable[[T], T]:
112
- def decorator(cls: T):
116
+ ) -> Callable[[type[T]], type[T]]:
117
+ def decorator(cls: type[T]) -> type[T]:
113
118
  message = generate_deprecation_message(
114
119
  name=to_qualified_name(cls),
115
120
  start_date=start_date,
@@ -120,7 +125,7 @@ def deprecated_class(
120
125
  original_init = cls.__init__
121
126
 
122
127
  @functools.wraps(original_init)
123
- def new_init(self, *args, **kwargs):
128
+ def new_init(self: T, *args: Any, **kwargs: Any) -> None:
124
129
  warnings.warn(message, PrefectDeprecationWarning, stacklevel=stacklevel)
125
130
  original_init(self, *args, **kwargs)
126
131
 
@@ -139,7 +144,7 @@ def deprecated_parameter(
139
144
  help: str = "",
140
145
  when: Optional[Callable[[Any], bool]] = None,
141
146
  when_message: str = "",
142
- ) -> Callable[[T], T]:
147
+ ) -> Callable[[Callable[P, R]], Callable[P, R]]:
143
148
  """
144
149
  Mark a parameter in a callable as deprecated.
145
150
 
@@ -155,7 +160,7 @@ def deprecated_parameter(
155
160
 
156
161
  when = when or (lambda _: True)
157
162
 
158
- def decorator(fn: T):
163
+ def decorator(fn: Callable[P, R]) -> Callable[P, R]:
159
164
  message = generate_deprecation_message(
160
165
  name=f"The parameter {name!r} for {fn.__name__!r}",
161
166
  start_date=start_date,
@@ -165,7 +170,7 @@ def deprecated_parameter(
165
170
  )
166
171
 
167
172
  @functools.wraps(fn)
168
- def wrapper(*args, **kwargs):
173
+ def wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
169
174
  try:
170
175
  parameters = get_call_parameters(fn, args, kwargs, apply_defaults=False)
171
176
  except Exception:
@@ -182,6 +187,10 @@ def deprecated_parameter(
182
187
  return decorator
183
188
 
184
189
 
190
+ JsonValue: TypeAlias = Union[int, float, str, bool, None, list["JsonValue"], "JsonDict"]
191
+ JsonDict: TypeAlias = dict[str, JsonValue]
192
+
193
+
185
194
  def deprecated_field(
186
195
  name: str,
187
196
  *,
@@ -191,7 +200,7 @@ def deprecated_field(
191
200
  help: str = "",
192
201
  when: Optional[Callable[[Any], bool]] = None,
193
202
  stacklevel: int = 2,
194
- ):
203
+ ) -> Callable[[type[M]], type[M]]:
195
204
  """
196
205
  Mark a field in a Pydantic model as deprecated.
197
206
 
@@ -212,7 +221,7 @@ def deprecated_field(
212
221
 
213
222
  # Replaces the model's __init__ method with one that performs an additional warning
214
223
  # check
215
- def decorator(model_cls: Type[M]) -> Type[M]:
224
+ def decorator(model_cls: type[M]) -> type[M]:
216
225
  message = generate_deprecation_message(
217
226
  name=f"The field {name!r} in {model_cls.__name__!r}",
218
227
  start_date=start_date,
@@ -224,7 +233,7 @@ def deprecated_field(
224
233
  cls_init = model_cls.__init__
225
234
 
226
235
  @functools.wraps(model_cls.__init__)
227
- def __init__(__pydantic_self__, **data: Any) -> None:
236
+ def __init__(__pydantic_self__: M, **data: Any) -> None:
228
237
  if name in data.keys() and when(data[name]):
229
238
  warnings.warn(message, PrefectDeprecationWarning, stacklevel=stacklevel)
230
239
 
@@ -232,8 +241,23 @@ def deprecated_field(
232
241
 
233
242
  field = __pydantic_self__.model_fields.get(name)
234
243
  if field is not None:
235
- field.json_schema_extra = field.json_schema_extra or {}
236
- field.json_schema_extra["deprecated"] = True
244
+ json_schema_extra = field.json_schema_extra or {}
245
+
246
+ if not isinstance(json_schema_extra, dict):
247
+ # json_schema_extra is a hook function; wrap it to add the deprecated flag.
248
+ extra_func = json_schema_extra
249
+
250
+ @functools.wraps(extra_func)
251
+ def wrapped(__json_schema: JsonDict) -> None:
252
+ extra_func(__json_schema)
253
+ __json_schema["deprecated"] = True
254
+
255
+ json_schema_extra = wrapped
256
+
257
+ else:
258
+ json_schema_extra["deprecated"] = True
259
+
260
+ field.json_schema_extra = json_schema_extra
237
261
 
238
262
  # Patch the model's init method
239
263
  model_cls.__init__ = __init__
@@ -43,7 +43,7 @@ Removed objects:
43
43
  """
44
44
 
45
45
  import sys
46
- from typing import Any, Callable, Dict
46
+ from typing import Any, Callable
47
47
 
48
48
  from pydantic_core import PydanticCustomError
49
49
 
@@ -157,7 +157,7 @@ def getattr_migration(module_name: str) -> Callable[[str], Any]:
157
157
  f"`{import_path}` has been removed. {error_message}"
158
158
  )
159
159
 
160
- globals: Dict[str, Any] = sys.modules[module_name].__dict__
160
+ globals: dict[str, Any] = sys.modules[module_name].__dict__
161
161
  if name in globals:
162
162
  return globals[name]
163
163
 
@@ -7,7 +7,6 @@ import linecache
7
7
  import sys
8
8
  import threading
9
9
  from types import FrameType
10
- from typing import List, Optional
11
10
 
12
11
  """
13
12
  The following functions are derived from dask/distributed which is licensed under the
@@ -72,26 +71,25 @@ def repr_frame(frame: FrameType) -> str:
72
71
  return text + "\n\t" + line
73
72
 
74
73
 
75
- def call_stack(frame: FrameType) -> List[str]:
74
+ def call_stack(frame: FrameType) -> list[str]:
76
75
  """Create a call text stack from a frame"""
77
- L = []
78
- cur_frame: Optional[FrameType] = frame
76
+ frames: list[str] = []
77
+ cur_frame = frame
79
78
  while cur_frame:
80
- L.append(repr_frame(cur_frame))
79
+ frames.append(repr_frame(cur_frame))
81
80
  cur_frame = cur_frame.f_back
82
- return L[::-1]
81
+ return frames[::-1]
83
82
 
84
83
 
85
- def stack_for_threads(*threads: threading.Thread) -> List[str]:
86
- frames = sys._current_frames()
84
+ def stack_for_threads(*threads: threading.Thread) -> list[str]:
85
+ frames = sys._current_frames() # pyright: ignore[reportPrivateUsage]
87
86
  try:
88
- lines = []
87
+ lines: list[str] = []
89
88
  for thread in threads:
90
- lines.append(
91
- f"------ Call stack of {thread.name} ({hex(thread.ident)}) -----"
92
- )
93
- thread_frames = frames.get(thread.ident)
94
- if thread_frames:
89
+ ident = thread.ident
90
+ hex_ident = hex(ident) if ident is not None else "<unknown>"
91
+ lines.append(f"------ Call stack of {thread.name} ({hex_ident}) -----")
92
+ if ident is not None and (thread_frames := frames.get(ident)):
95
93
  lines.append("".join(call_stack(thread_frames)))
96
94
  else:
97
95
  lines.append("No stack frames found")
@@ -27,7 +27,7 @@ class Event:
27
27
  """
28
28
 
29
29
  def __init__(self) -> None:
30
- self._waiters = collections.deque()
30
+ self._waiters: collections.deque[asyncio.Future[bool]] = collections.deque()
31
31
  self._value = False
32
32
  self._lock = threading.Lock()
33
33
 
@@ -69,7 +69,7 @@ class Event:
69
69
  if self._value:
70
70
  return True
71
71
 
72
- fut = asyncio.get_running_loop().create_future()
72
+ fut: asyncio.Future[bool] = asyncio.get_running_loop().create_future()
73
73
  self._waiters.append(fut)
74
74
 
75
75
  try: