strawberry-graphql 0.235.2__tar.gz → 0.236.1__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 (260) hide show
  1. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/PKG-INFO +1 -1
  2. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/pyproject.toml +17 -5
  3. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/__init__.py +17 -11
  4. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/aiohttp/handlers/graphql_transport_ws_handler.py +3 -0
  5. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/aiohttp/handlers/graphql_ws_handler.py +3 -0
  6. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/aiohttp/test/client.py +3 -0
  7. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/aiohttp/views.py +3 -0
  8. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/annotation.py +19 -19
  9. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/asgi/__init__.py +3 -3
  10. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/asgi/handlers/graphql_transport_ws_handler.py +3 -0
  11. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/asgi/handlers/graphql_ws_handler.py +3 -0
  12. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/asgi/test/client.py +3 -0
  13. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/chalice/views.py +12 -3
  14. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/channels/handlers/base.py +5 -5
  15. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/channels/handlers/graphql_transport_ws_handler.py +3 -0
  16. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/channels/handlers/graphql_ws_handler.py +3 -0
  17. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/channels/handlers/http_handler.py +5 -2
  18. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/channels/handlers/ws_handler.py +4 -1
  19. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/channels/router.py +9 -5
  20. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/channels/testing.py +11 -4
  21. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/cli/commands/upgrade/__init__.py +13 -5
  22. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/cli/commands/upgrade/_fake_progress.py +2 -1
  23. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/cli/commands/upgrade/_run_codemod.py +18 -1
  24. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/codegen/exceptions.py +8 -0
  25. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/codegen/query_codegen.py +16 -7
  26. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/codegen/types.py +32 -1
  27. strawberry_graphql-0.236.1/strawberry/codemods/update_imports.py +136 -0
  28. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/dataloader.py +13 -0
  29. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/directive.py +52 -4
  30. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/django/context.py +4 -1
  31. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/django/test/client.py +3 -0
  32. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/django/views.py +3 -0
  33. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/__init__.py +5 -5
  34. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/duplicated_type_name.py +1 -1
  35. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/invalid_argument_type.py +3 -3
  36. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/invalid_union_type.py +5 -6
  37. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/missing_arguments_annotations.py +1 -1
  38. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/missing_dependencies.py +10 -2
  39. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/missing_return_annotation.py +1 -1
  40. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/permission_fail_silently_requires_optional.py +3 -3
  41. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/scalar_already_registered.py +1 -1
  42. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/unresolved_field_type.py +2 -2
  43. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/utils/source_finder.py +5 -2
  44. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/experimental/pydantic/conversion.py +5 -5
  45. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/experimental/pydantic/conversion_types.py +4 -2
  46. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/experimental/pydantic/error_type.py +2 -2
  47. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/experimental/pydantic/fields.py +2 -2
  48. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/experimental/pydantic/object_type.py +11 -7
  49. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/experimental/pydantic/utils.py +4 -5
  50. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/ext/dataclasses/dataclasses.py +2 -1
  51. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/ext/mypy_plugin.py +10 -8
  52. strawberry_graphql-0.236.1/strawberry/extensions/add_validation_rules.py +52 -0
  53. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/base_extension.py +6 -4
  54. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/directives.py +4 -1
  55. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/disable_validation.py +15 -12
  56. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/field_extension.py +11 -5
  57. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/mask_errors.py +3 -0
  58. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/max_aliases.py +21 -19
  59. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/max_tokens.py +14 -16
  60. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/parser_cache.py +22 -19
  61. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/pyinstrument.py +4 -8
  62. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/query_depth_limiter.py +22 -23
  63. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/runner.py +3 -0
  64. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/tracing/apollo.py +3 -0
  65. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/tracing/datadog.py +7 -2
  66. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/tracing/opentelemetry.py +3 -0
  67. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/tracing/sentry.py +3 -0
  68. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/tracing/utils.py +3 -0
  69. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/utils.py +3 -0
  70. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/validation_cache.py +23 -20
  71. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/fastapi/context.py +3 -0
  72. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/fastapi/handlers/graphql_transport_ws_handler.py +3 -0
  73. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/fastapi/handlers/graphql_ws_handler.py +3 -0
  74. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/fastapi/router.py +3 -0
  75. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/federation/argument.py +4 -1
  76. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/federation/enum.py +5 -3
  77. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/federation/field.py +6 -3
  78. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/federation/mutation.py +2 -0
  79. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/federation/object_type.py +7 -4
  80. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/federation/scalar.py +43 -20
  81. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/federation/schema.py +12 -9
  82. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/federation/schema_directive.py +2 -2
  83. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/federation/schema_directives.py +19 -1
  84. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/federation/types.py +5 -2
  85. strawberry_graphql-0.236.1/strawberry/federation/union.py +61 -0
  86. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/field_extensions/input_mutation.py +5 -2
  87. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/file_uploads/scalars.py +3 -1
  88. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/file_uploads/utils.py +3 -0
  89. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/flask/views.py +6 -0
  90. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/http/__init__.py +9 -0
  91. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/http/async_base_view.py +4 -3
  92. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/http/base.py +3 -0
  93. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/http/exceptions.py +3 -0
  94. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/http/ides.py +3 -0
  95. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/http/sync_base_view.py +4 -3
  96. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/http/temporal_response.py +3 -0
  97. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/http/types.py +3 -0
  98. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/http/typevars.py +3 -0
  99. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/litestar/controller.py +6 -0
  100. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/litestar/handlers/graphql_transport_ws_handler.py +3 -0
  101. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/litestar/handlers/graphql_ws_handler.py +3 -0
  102. strawberry_graphql-0.236.1/strawberry/parent.py +44 -0
  103. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/permission.py +70 -27
  104. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/printer/ast_from_value.py +4 -1
  105. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/printer/printer.py +8 -5
  106. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/quart/views.py +3 -0
  107. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/relay/exceptions.py +7 -0
  108. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/relay/fields.py +70 -45
  109. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/relay/types.py +78 -78
  110. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/relay/utils.py +10 -1
  111. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/resolvers.py +3 -0
  112. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/sanic/context.py +3 -0
  113. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/sanic/utils.py +10 -8
  114. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/sanic/views.py +4 -2
  115. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/scalars.py +6 -2
  116. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/schema/base.py +7 -4
  117. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/schema/compat.py +12 -2
  118. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/schema/config.py +3 -0
  119. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/schema/exceptions.py +3 -0
  120. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/schema/execute.py +3 -0
  121. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/schema/name_converter.py +12 -9
  122. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/schema/schema.py +46 -9
  123. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/schema/schema_converter.py +16 -14
  124. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/schema/types/base_scalars.py +3 -1
  125. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/schema/types/concrete_type.py +4 -4
  126. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/schema/types/scalar.py +8 -1
  127. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/schema/validation_rules/one_of.py +3 -0
  128. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/schema_codegen/__init__.py +3 -0
  129. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/schema_directive.py +2 -2
  130. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/starlite/controller.py +3 -0
  131. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/starlite/handlers/graphql_transport_ws_handler.py +3 -0
  132. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/starlite/handlers/graphql_ws_handler.py +3 -0
  133. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/subscriptions/__init__.py +6 -0
  134. strawberry_graphql-0.236.1/strawberry/subscriptions/protocols/__init__.py +0 -0
  135. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/subscriptions/protocols/graphql_transport_ws/__init__.py +5 -0
  136. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py +12 -17
  137. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/subscriptions/protocols/graphql_transport_ws/types.py +21 -25
  138. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/subscriptions/protocols/graphql_ws/__init__.py +14 -0
  139. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/subscriptions/protocols/graphql_ws/handlers.py +8 -5
  140. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/subscriptions/protocols/graphql_ws/types.py +11 -0
  141. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/test/client.py +44 -29
  142. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/tools/create_type.py +27 -8
  143. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/tools/merge_types.py +5 -3
  144. strawberry_graphql-0.236.1/strawberry/types/__init__.py +11 -0
  145. {strawberry_graphql-0.235.2/strawberry → strawberry_graphql-0.236.1/strawberry/types}/arguments.py +44 -13
  146. {strawberry_graphql-0.235.2/strawberry → strawberry_graphql-0.236.1/strawberry/types}/auto.py +21 -3
  147. strawberry_graphql-0.235.2/strawberry/types/types.py → strawberry_graphql-0.236.1/strawberry/types/base.py +234 -10
  148. {strawberry_graphql-0.235.2/strawberry → strawberry_graphql-0.236.1/strawberry/types}/enum.py +69 -9
  149. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/types/execution.py +3 -0
  150. {strawberry_graphql-0.235.2/strawberry → strawberry_graphql-0.236.1/strawberry/types}/field.py +46 -23
  151. strawberry_graphql-0.236.1/strawberry/types/fields/__init__.py +0 -0
  152. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/types/fields/resolver.py +2 -2
  153. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/types/graphql.py +3 -0
  154. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/types/info.py +50 -7
  155. {strawberry_graphql-0.235.2/strawberry → strawberry_graphql-0.236.1/strawberry/types}/lazy_type.py +56 -4
  156. strawberry_graphql-0.236.1/strawberry/types/mutation.py +351 -0
  157. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/types/nodes.py +4 -2
  158. {strawberry_graphql-0.235.2/strawberry → strawberry_graphql-0.236.1/strawberry/types}/object_type.py +108 -29
  159. {strawberry_graphql-0.235.2/strawberry → strawberry_graphql-0.236.1/strawberry/types}/private.py +13 -6
  160. strawberry_graphql-0.235.2/strawberry/custom_scalar.py → strawberry_graphql-0.236.1/strawberry/types/scalar.py +39 -23
  161. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/types/type_resolver.py +21 -16
  162. {strawberry_graphql-0.235.2/strawberry → strawberry_graphql-0.236.1/strawberry/types}/union.py +24 -9
  163. {strawberry_graphql-0.235.2/strawberry → strawberry_graphql-0.236.1/strawberry/types}/unset.py +20 -0
  164. strawberry_graphql-0.236.1/strawberry/utils/__init__.py +0 -0
  165. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/utils/aio.py +8 -0
  166. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/utils/await_maybe.py +3 -0
  167. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/utils/dataclasses.py +3 -0
  168. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/utils/debug.py +5 -2
  169. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/utils/deprecations.py +3 -0
  170. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/utils/graphql_lexer.py +3 -0
  171. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/utils/importer.py +3 -0
  172. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/utils/inspect.py +39 -30
  173. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/utils/logging.py +3 -0
  174. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/utils/operation.py +3 -0
  175. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/utils/str_converters.py +3 -0
  176. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/utils/typing.py +33 -16
  177. strawberry_graphql-0.235.2/strawberry/extensions/add_validation_rules.py +0 -48
  178. strawberry_graphql-0.235.2/strawberry/federation/union.py +0 -42
  179. strawberry_graphql-0.235.2/strawberry/mutation.py +0 -8
  180. strawberry_graphql-0.235.2/strawberry/parent.py +0 -38
  181. strawberry_graphql-0.235.2/strawberry/type.py +0 -232
  182. strawberry_graphql-0.235.2/strawberry/types/__init__.py +0 -4
  183. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/LICENSE +0 -0
  184. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/README.md +0 -0
  185. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/__main__.py +0 -0
  186. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/aiohttp/__init__.py +0 -0
  187. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/aiohttp/handlers/__init__.py +0 -0
  188. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/aiohttp/test/__init__.py +0 -0
  189. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/asgi/handlers/__init__.py +0 -0
  190. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/asgi/test/__init__.py +0 -0
  191. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/chalice/__init__.py +0 -0
  192. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/channels/__init__.py +0 -0
  193. {strawberry_graphql-0.235.2/strawberry/cli/commands → strawberry_graphql-0.236.1/strawberry/channels/handlers}/__init__.py +0 -0
  194. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/cli/__init__.py +0 -0
  195. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/cli/app.py +0 -0
  196. {strawberry_graphql-0.235.2/strawberry/codegen/plugins → strawberry_graphql-0.236.1/strawberry/cli/commands}/__init__.py +0 -0
  197. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/cli/commands/codegen.py +0 -0
  198. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/cli/commands/export_schema.py +0 -0
  199. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/cli/commands/schema_codegen.py +0 -0
  200. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/cli/commands/server.py +0 -0
  201. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/cli/constants.py +0 -0
  202. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/cli/debug_server.py +0 -0
  203. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/cli/utils/__init__.py +0 -0
  204. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/cli/utils/load_schema.py +0 -0
  205. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/codegen/__init__.py +0 -0
  206. {strawberry_graphql-0.235.2/strawberry/codemods → strawberry_graphql-0.236.1/strawberry/codegen/plugins}/__init__.py +0 -0
  207. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/codegen/plugins/print_operation.py +0 -0
  208. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/codegen/plugins/python.py +0 -0
  209. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/codegen/plugins/typescript.py +0 -0
  210. {strawberry_graphql-0.235.2/strawberry/exceptions/utils → strawberry_graphql-0.236.1/strawberry/codemods}/__init__.py +0 -0
  211. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/codemods/annotated_unions.py +0 -0
  212. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/django/__init__.py +0 -0
  213. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/django/apps.py +0 -0
  214. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/django/test/__init__.py +0 -0
  215. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/conflicting_arguments.py +0 -0
  216. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/exception.py +0 -0
  217. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/exception_source.py +0 -0
  218. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/handler.py +0 -0
  219. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/missing_field_annotation.py +0 -0
  220. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/not_a_strawberry_enum.py +0 -0
  221. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/object_is_not_a_class.py +0 -0
  222. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/object_is_not_an_enum.py +0 -0
  223. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/private_strawberry_field.py +0 -0
  224. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/exceptions/syntax.py +0 -0
  225. {strawberry_graphql-0.235.2/strawberry/ext → strawberry_graphql-0.236.1/strawberry/exceptions/utils}/__init__.py +0 -0
  226. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/experimental/__init__.py +0 -0
  227. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/experimental/pydantic/__init__.py +0 -0
  228. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/experimental/pydantic/_compat.py +0 -0
  229. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/experimental/pydantic/exceptions.py +0 -0
  230. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/ext/LICENSE +0 -0
  231. {strawberry_graphql-0.235.2/strawberry/ext/dataclasses → strawberry_graphql-0.236.1/strawberry/ext}/__init__.py +0 -0
  232. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/ext/dataclasses/LICENSE +0 -0
  233. {strawberry_graphql-0.235.2/strawberry/flask → strawberry_graphql-0.236.1/strawberry/ext/dataclasses}/__init__.py +0 -0
  234. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/__init__.py +0 -0
  235. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/context.py +0 -0
  236. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/extensions/tracing/__init__.py +0 -0
  237. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/fastapi/__init__.py +0 -0
  238. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/fastapi/handlers/__init__.py +0 -0
  239. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/federation/__init__.py +0 -0
  240. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/field_extensions/__init__.py +0 -0
  241. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/file_uploads/__init__.py +0 -0
  242. {strawberry_graphql-0.235.2/strawberry/quart → strawberry_graphql-0.236.1/strawberry/flask}/__init__.py +0 -0
  243. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/litestar/__init__.py +0 -0
  244. {strawberry_graphql-0.235.2/strawberry/sanic → strawberry_graphql-0.236.1/strawberry/litestar/handlers}/__init__.py +0 -0
  245. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/printer/__init__.py +0 -0
  246. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/py.typed +0 -0
  247. {strawberry_graphql-0.235.2/strawberry/schema/validation_rules → strawberry_graphql-0.236.1/strawberry/quart}/__init__.py +0 -0
  248. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/relay/__init__.py +0 -0
  249. {strawberry_graphql-0.235.2/strawberry/subscriptions/protocols → strawberry_graphql-0.236.1/strawberry/sanic}/__init__.py +0 -0
  250. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/schema/__init__.py +0 -0
  251. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/schema/types/__init__.py +0 -0
  252. {strawberry_graphql-0.235.2/strawberry/types/fields → strawberry_graphql-0.236.1/strawberry/schema/validation_rules}/__init__.py +0 -0
  253. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/schema_directives.py +0 -0
  254. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/starlite/__init__.py +0 -0
  255. {strawberry_graphql-0.235.2/strawberry/utils → strawberry_graphql-0.236.1/strawberry/starlite/handlers}/__init__.py +0 -0
  256. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/static/apollo-sandbox.html +0 -0
  257. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/static/graphiql.html +0 -0
  258. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/static/pathfinder.html +0 -0
  259. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/test/__init__.py +0 -0
  260. {strawberry_graphql-0.235.2 → strawberry_graphql-0.236.1}/strawberry/tools/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: strawberry-graphql
3
- Version: 0.235.2
3
+ Version: 0.236.1
4
4
  Summary: A library for creating GraphQL APIs
5
5
  Home-page: https://strawberry.rocks/
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
1
  [tool.poetry]
2
2
  name = "strawberry-graphql"
3
3
  packages = [ { include = "strawberry" } ]
4
- version = "0.235.2"
4
+ version = "0.236.1"
5
5
  description = "A library for creating GraphQL APIs"
6
6
  authors = ["Patrick Arminio <patrick.arminio@gmail.com>"]
7
7
  license = "MIT"
@@ -68,7 +68,7 @@ asgiref = "^3.2"
68
68
  ddtrace = ">=1.6.4"
69
69
  email-validator = {version = ">=1.1.3,<3.0.0", optional = false}
70
70
  freezegun = "^1.2.1"
71
- libcst = {version = ">=0.4.7", optional = false}
71
+ libcst = {version = ">=1.0.0", optional = false}
72
72
  MarkupSafe = "2.1.3"
73
73
  nox = "^2023.4.22"
74
74
  nox-poetry = "^1.0.3"
@@ -235,9 +235,6 @@ ignore = [
235
235
  "S102",
236
236
  "S104",
237
237
  "S324",
238
- # maybe we can enable this in future
239
- # we'd want to have consistent docstrings in future
240
- "D",
241
238
  "ANN101", # missing annotation for self?
242
239
  # definitely enable these, maybe not in tests
243
240
  "ANN102",
@@ -351,6 +348,17 @@ ignore = [
351
348
  "FIX001",
352
349
  "FIX002",
353
350
  "FA100",
351
+
352
+ # Docstrings, maybe to enable later
353
+ "D100",
354
+ "D101",
355
+ "D102",
356
+ "D103",
357
+ "D104",
358
+ "D105",
359
+ "D106",
360
+ "D107",
361
+ "D412",
354
362
  ]
355
363
 
356
364
  [tool.ruff.lint.per-file-ignores]
@@ -370,6 +378,7 @@ ignore = [
370
378
  "S603",
371
379
  "S607",
372
380
  "B018",
381
+ "D",
373
382
  ]
374
383
  "strawberry/extensions/tracing/__init__.py" = ["TCH004"]
375
384
  "tests/http/clients/__init__.py" = ["F401"]
@@ -384,3 +393,6 @@ exclude =[
384
393
  'tests/codegen/snapshots/',
385
394
  'tests/cli/snapshots/'
386
395
  ]
396
+
397
+ [tool.ruff.lint.pydocstyle]
398
+ convention = "google"
@@ -1,22 +1,28 @@
1
+ """Strawberry is a Python library for GraphQL.
2
+
3
+ Strawberry is a Python library for GraphQL that aims to stay close to the GraphQL
4
+ specification and allow for a more natural way of defining GraphQL schemas.
5
+ """
6
+
1
7
  from . import experimental, federation, relay
2
- from .arguments import argument
3
- from .auto import auto
4
- from .custom_scalar import scalar
5
8
  from .directive import directive, directive_field
6
- from .enum import enum, enum_value
7
- from .field import field
8
- from .lazy_type import LazyType, lazy
9
- from .mutation import mutation, subscription
10
- from .object_type import asdict, input, interface, type
11
9
  from .parent import Parent
12
10
  from .permission import BasePermission
13
- from .private import Private
14
11
  from .scalars import ID
15
12
  from .schema import Schema
16
13
  from .schema_directive import schema_directive
14
+ from .types.arguments import argument
15
+ from .types.auto import auto
16
+ from .types.enum import enum, enum_value
17
+ from .types.field import field
17
18
  from .types.info import Info
18
- from .union import union
19
- from .unset import UNSET
19
+ from .types.lazy_type import LazyType, lazy
20
+ from .types.mutation import mutation, subscription
21
+ from .types.object_type import asdict, input, interface, type
22
+ from .types.private import Private
23
+ from .types.scalar import scalar
24
+ from .types.union import union
25
+ from .types.unset import UNSET
20
26
 
21
27
  __all__ = [
22
28
  "BasePermission",
@@ -57,3 +57,6 @@ class GraphQLTransportWSHandler(BaseGraphQLTransportWSHandler):
57
57
  await self.shutdown()
58
58
 
59
59
  return self._ws
60
+
61
+
62
+ __all__ = ["GraphQLTransportWSHandler"]
@@ -60,3 +60,6 @@ class GraphQLWSHandler(BaseGraphQLWSHandler):
60
60
  await self.cleanup_operation(operation_id)
61
61
 
62
62
  return self._ws
63
+
64
+
65
+ __all__ = ["GraphQLWSHandler"]
@@ -48,3 +48,6 @@ class GraphQLTestClient(BaseGraphQLTestClient):
48
48
  )
49
49
 
50
50
  return response
51
+
52
+
53
+ __all__ = ["GraphQLTestClient"]
@@ -177,3 +177,6 @@ class GraphQLView(
177
177
  sub_response.content_type = "application/json"
178
178
 
179
179
  return sub_response
180
+
181
+
182
+ __all__ = ["GraphQLView"]
@@ -20,26 +20,26 @@ from typing import (
20
20
  )
21
21
  from typing_extensions import Annotated, Self, get_args, get_origin
22
22
 
23
- from strawberry.custom_scalar import ScalarDefinition
24
- from strawberry.enum import EnumDefinition
25
23
  from strawberry.exceptions.not_a_strawberry_enum import NotAStrawberryEnumError
26
- from strawberry.lazy_type import LazyType
27
- from strawberry.private import is_private
28
- from strawberry.type import (
24
+ from strawberry.types.base import (
29
25
  StrawberryList,
26
+ StrawberryObjectDefinition,
30
27
  StrawberryOptional,
31
28
  StrawberryTypeVar,
32
29
  get_object_definition,
33
30
  has_object_definition,
34
31
  )
35
- from strawberry.types.types import StrawberryObjectDefinition
36
- from strawberry.unset import UNSET
32
+ from strawberry.types.enum import EnumDefinition
33
+ from strawberry.types.lazy_type import LazyType
34
+ from strawberry.types.private import is_private
35
+ from strawberry.types.scalar import ScalarDefinition
36
+ from strawberry.types.unset import UNSET
37
37
  from strawberry.utils.typing import eval_type, is_generic, is_type_var
38
38
 
39
39
  if TYPE_CHECKING:
40
- from strawberry.field import StrawberryField
41
- from strawberry.type import StrawberryType
42
- from strawberry.union import StrawberryUnion
40
+ from strawberry.types.base import StrawberryType
41
+ from strawberry.types.field import StrawberryField
42
+ from strawberry.types.union import StrawberryUnion
43
43
 
44
44
 
45
45
  ASYNC_TYPES = (
@@ -226,7 +226,7 @@ class StrawberryAnnotation:
226
226
 
227
227
  def create_union(self, evaled_type: Type[Any], args: list[Any]) -> StrawberryUnion:
228
228
  # Prevent import cycles
229
- from strawberry.union import StrawberryUnion
229
+ from strawberry.types.union import StrawberryUnion
230
230
 
231
231
  # TODO: Deal with Forward References/origin
232
232
  if isinstance(evaled_type, StrawberryUnion):
@@ -290,8 +290,7 @@ class StrawberryAnnotation:
290
290
 
291
291
  @classmethod
292
292
  def _is_optional(cls, annotation: Any, args: List[Any]) -> bool:
293
- """Returns True if the annotation is Optional[SomeType]"""
294
-
293
+ """Returns True if the annotation is Optional[SomeType]."""
295
294
  # Optionals are represented as unions
296
295
  if not cls._is_union(annotation, args):
297
296
  return False
@@ -303,8 +302,7 @@ class StrawberryAnnotation:
303
302
 
304
303
  @classmethod
305
304
  def _is_list(cls, annotation: Any) -> bool:
306
- """Returns True if annotation is a List"""
307
-
305
+ """Returns True if annotation is a List."""
308
306
  annotation_origin = get_origin(annotation)
309
307
  annotation_mro = getattr(annotation, "__mro__", [])
310
308
  is_list = any(x is list for x in annotation_mro)
@@ -318,7 +316,7 @@ class StrawberryAnnotation:
318
316
  @classmethod
319
317
  def _is_strawberry_type(cls, evaled_type: Any) -> bool:
320
318
  # Prevent import cycles
321
- from strawberry.union import StrawberryUnion
319
+ from strawberry.types.union import StrawberryUnion
322
320
 
323
321
  if isinstance(evaled_type, EnumDefinition):
324
322
  return True
@@ -344,8 +342,7 @@ class StrawberryAnnotation:
344
342
 
345
343
  @classmethod
346
344
  def _is_union(cls, annotation: Any, args: List[Any]) -> bool:
347
- """Returns True if annotation is a Union"""
348
-
345
+ """Returns True if annotation is a Union."""
349
346
  # this check is needed because unions declared with the new syntax `A | B`
350
347
  # don't have a `__origin__` property on them, but they are instances of
351
348
  # `UnionType`, which is only available in Python 3.10+
@@ -363,7 +360,7 @@ class StrawberryAnnotation:
363
360
  if annotation_origin is typing.Union:
364
361
  return True
365
362
 
366
- from strawberry.union import StrawberryUnion
363
+ from strawberry.types.union import StrawberryUnion
367
364
 
368
365
  return any(isinstance(arg, StrawberryUnion) for arg in args)
369
366
 
@@ -386,3 +383,6 @@ def _is_input_type(type_: Any) -> bool:
386
383
  return False
387
384
 
388
385
  return type_.__strawberry_definition__.is_input
386
+
387
+
388
+ __all__ = ["StrawberryAnnotation"]
@@ -117,12 +117,12 @@ class GraphQL(
117
117
  else:
118
118
  self.graphql_ide = graphql_ide
119
119
 
120
- async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
120
+ async def __call__(self, scope: Request, receive: Receive, send: Send) -> None:
121
121
  if scope["type"] == "http":
122
- return await self.handle_http(scope, receive, send)
122
+ return await self.handle_http(scope, receive, send) # type: ignore
123
123
 
124
124
  elif scope["type"] == "websocket":
125
- ws = WebSocket(scope=scope, receive=receive, send=send)
125
+ ws = WebSocket(scope, receive=receive, send=send) # type: ignore
126
126
  preferred_protocol = self.pick_preferred_protocol(ws)
127
127
 
128
128
  if preferred_protocol == GRAPHQL_TRANSPORT_WS_PROTOCOL:
@@ -61,3 +61,6 @@ class GraphQLTransportWSHandler(BaseGraphQLTransportWSHandler):
61
61
  pass
62
62
  finally:
63
63
  await self.shutdown()
64
+
65
+
66
+ __all__ = ["GraphQLTransportWSHandler"]
@@ -65,3 +65,6 @@ class GraphQLWSHandler(BaseGraphQLWSHandler):
65
65
 
66
66
  for operation_id in list(self.subscriptions.keys()):
67
67
  await self.cleanup_operation(operation_id)
68
+
69
+
70
+ __all__ = ["GraphQLWSHandler"]
@@ -48,3 +48,6 @@ class GraphQLTestClient(BaseGraphQLTestClient):
48
48
 
49
49
  def _decode(self, response: Any, type: Literal["multipart", "json"]) -> Any:
50
50
  return response.json()
51
+
52
+
53
+ __all__ = ["GraphQLTestClient"]
@@ -94,10 +94,16 @@ class GraphQLView(
94
94
  http_status_code: int,
95
95
  headers: Optional[Dict[str, str | List[str]]] = None,
96
96
  ) -> Response:
97
- """
98
- A wrapper for error responses
97
+ """A wrapper for error responses.
98
+
99
+ Args:
100
+ message: The error message.
101
+ error_code: The error code.
102
+ http_status_code: The HTTP status code.
103
+ headers: The headers to include in the response.
104
+
99
105
  Returns:
100
- An errors response
106
+ An errors response.
101
107
  """
102
108
  body = {"Code": error_code, "Message": message}
103
109
 
@@ -139,3 +145,6 @@ class GraphQLView(
139
145
  message=e.reason,
140
146
  http_status_code=e.status_code,
141
147
  )
148
+
149
+
150
+ __all__ = ["GraphQLView"]
@@ -92,7 +92,7 @@ class ChannelsConsumer(AsyncConsumer):
92
92
  Utility to listen for channels messages for this consumer inside
93
93
  a resolver (usually inside a subscription).
94
94
 
95
- Parameters:
95
+ Args:
96
96
  type:
97
97
  The type of the message to wait for.
98
98
  timeout:
@@ -104,7 +104,6 @@ class ChannelsConsumer(AsyncConsumer):
104
104
  execution and then discarded using `self.channel_layer.group_discard`
105
105
  at the end of the execution.
106
106
  """
107
-
108
107
  warnings.warn("Use listen_to_channel instead", DeprecationWarning, stacklevel=2)
109
108
  if self.channel_layer is None:
110
109
  raise RuntimeError(
@@ -152,7 +151,7 @@ class ChannelsConsumer(AsyncConsumer):
152
151
  Utility to listen for channels messages for this consumer inside
153
152
  a resolver (usually inside a subscription).
154
153
 
155
- Parameters:
154
+ Args:
156
155
  type:
157
156
  The type of the message to wait for.
158
157
  timeout:
@@ -164,7 +163,6 @@ class ChannelsConsumer(AsyncConsumer):
164
163
  execution and then discarded using `self.channel_layer.group_discard`
165
164
  at the end of the execution.
166
165
  """
167
-
168
166
  # Code to acquire resource (Channels subscriptions)
169
167
  if self.channel_layer is None:
170
168
  raise RuntimeError(
@@ -201,7 +199,6 @@ class ChannelsConsumer(AsyncConsumer):
201
199
  Seperated to allow user code to be run after subscribing to channels
202
200
  and before blocking to wait for incoming channel messages.
203
201
  """
204
-
205
202
  while True:
206
203
  awaitable = queue.get()
207
204
  if timeout is not None:
@@ -215,3 +212,6 @@ class ChannelsConsumer(AsyncConsumer):
215
212
 
216
213
  class ChannelsWSConsumer(ChannelsConsumer, AsyncJsonWebsocketConsumer):
217
214
  """Base channels websocket async consumer."""
215
+
216
+
217
+ __all__ = ["ChannelsConsumer", "ChannelsWSConsumer"]
@@ -57,3 +57,6 @@ class GraphQLTransportWSHandler(BaseGraphQLTransportWSHandler):
57
57
 
58
58
  async def handle_disconnect(self, code: int) -> None:
59
59
  await self.shutdown()
60
+
61
+
62
+ __all__ = ["GraphQLTransportWSHandler"]
@@ -67,3 +67,6 @@ class GraphQLWSHandler(BaseGraphQLWSHandler):
67
67
  # channels integration is a high level wrapper that forwards this to
68
68
  # both us and the BaseGraphQLTransportWSHandler.
69
69
  pass
70
+
71
+
72
+ __all__ = ["GraphQLWSHandler"]
@@ -1,4 +1,4 @@
1
- """GraphQLHTTPHandler
1
+ """GraphQLHTTPHandler.
2
2
 
3
3
  A consumer to provide a graphql endpoint, and optionally graphiql.
4
4
  """
@@ -25,7 +25,7 @@ from strawberry.http.sync_base_view import SyncBaseHTTPView, SyncHTTPRequestAdap
25
25
  from strawberry.http.temporal_response import TemporalResponse
26
26
  from strawberry.http.types import FormData
27
27
  from strawberry.http.typevars import Context, RootValue
28
- from strawberry.unset import UNSET
28
+ from strawberry.types.unset import UNSET
29
29
 
30
30
  from .base import ChannelsConsumer
31
31
 
@@ -304,3 +304,6 @@ class SyncGraphQLHTTPConsumer(
304
304
  root_value: Optional[RootValue] = UNSET,
305
305
  ) -> ChannelsResponse:
306
306
  return super().run(request, context, root_value)
307
+
308
+
309
+ __all__ = ["GraphQLHTTPConsumer", "SyncGraphQLHTTPConsumer"]
@@ -15,7 +15,7 @@ if TYPE_CHECKING:
15
15
 
16
16
 
17
17
  class GraphQLWSConsumer(ChannelsWSConsumer):
18
- """A channels websocket consumer for GraphQL
18
+ """A channels websocket consumer for GraphQL.
19
19
 
20
20
  This handles the connections, then hands off to the appropriate
21
21
  handler based on the subprotocol.
@@ -126,3 +126,6 @@ class GraphQLWSConsumer(ChannelsWSConsumer):
126
126
  "connection_params": connection_params,
127
127
  "ws": request,
128
128
  } # type: ignore
129
+
130
+
131
+ __all__ = ["GraphQLWSConsumer"]
@@ -1,4 +1,4 @@
1
- """GraphQLWebSocketRouter
1
+ """GraphQLWebSocketRouter.
2
2
 
3
3
  This is a simple router class that might be better placed as part of Channels itself.
4
4
  It's a simple "SubProtocolRouter" that selects the websocket subprotocol based
@@ -21,11 +21,12 @@ if TYPE_CHECKING:
21
21
 
22
22
 
23
23
  class GraphQLProtocolTypeRouter(ProtocolTypeRouter):
24
- """
25
- Convenience class to set up GraphQL on both HTTP and Websocket, optionally with a
26
- Django application for all other HTTP routes:
24
+ """HTTP and Websocket GraphQL type router.
27
25
 
28
- ```
26
+ Convenience class to set up GraphQL on both HTTP and Websocket,
27
+ optionally with a Django application for all other HTTP routes.
28
+
29
+ ```python
29
30
  from strawberry.channels import GraphQLProtocolTypeRouter
30
31
  from django.core.asgi import get_asgi_application
31
32
 
@@ -63,3 +64,6 @@ class GraphQLProtocolTypeRouter(ProtocolTypeRouter):
63
64
  ),
64
65
  }
65
66
  )
67
+
68
+
69
+ __all__ = ["GraphQLProtocolTypeRouter"]
@@ -41,8 +41,8 @@ if TYPE_CHECKING:
41
41
 
42
42
 
43
43
  class GraphQLWebsocketCommunicator(WebsocketCommunicator):
44
- """
45
- Usage:
44
+ """A test communicator for GraphQL over Websockets.
45
+
46
46
  ```python
47
47
  import pytest
48
48
  from strawberry.channels.testing import GraphQLWebsocketCommunicator
@@ -72,12 +72,16 @@ class GraphQLWebsocketCommunicator(WebsocketCommunicator):
72
72
  connection_params: dict = {},
73
73
  **kwargs: Any,
74
74
  ) -> None:
75
- """
75
+ """Create a new communicator.
76
76
 
77
77
  Args:
78
78
  application: Your asgi application that encapsulates the strawberry schema.
79
79
  path: the url endpoint for the schema.
80
80
  protocol: currently this supports `graphql-transport-ws` only.
81
+ connection_params: a dictionary of connection parameters to send to the server.
82
+ headers: a list of tuples to be sent as headers to the server.
83
+ subprotocols: an ordered list of preferred subprotocols to be sent to the server.
84
+ **kwargs: additional arguments to be passed to the `WebsocketCommunicator` constructor.
81
85
  """
82
86
  self.protocol = protocol
83
87
  subprotocols = kwargs.get("subprotocols", [])
@@ -155,7 +159,7 @@ class GraphQLWebsocketCommunicator(WebsocketCommunicator):
155
159
  return
156
160
 
157
161
  def process_errors(self, errors: List[GraphQLFormattedError]) -> List[GraphQLError]:
158
- """Reconst a GraphQLError from a FormattedGraphQLError"""
162
+ """Reconstructs a GraphQLError from a FormattedGraphQLError."""
159
163
  result = []
160
164
  for f_error in errors:
161
165
  error = GraphQLError(
@@ -165,3 +169,6 @@ class GraphQLWebsocketCommunicator(WebsocketCommunicator):
165
169
  error.path = f_error.get("path", None)
166
170
  result.append(error)
167
171
  return result
172
+
173
+
174
+ __all__ = ["GraphQLWebsocketCommunicator"]
@@ -11,11 +11,13 @@ from libcst.codemod import CodemodContext
11
11
 
12
12
  from strawberry.cli.app import app
13
13
  from strawberry.codemods.annotated_unions import ConvertUnionToAnnotatedUnion
14
+ from strawberry.codemods.update_imports import UpdateImportsCodemod
14
15
 
15
16
  from ._run_codemod import run_codemod
16
17
 
17
18
  codemods = {
18
19
  "annotated-union": ConvertUnionToAnnotatedUnion,
20
+ "update-imports": UpdateImportsCodemod,
19
21
  }
20
22
 
21
23
 
@@ -46,11 +48,17 @@ def upgrade(
46
48
 
47
49
  python_target_version = tuple(int(x) for x in python_target.split("."))
48
50
 
49
- transformer = ConvertUnionToAnnotatedUnion(
50
- CodemodContext(),
51
- use_pipe_syntax=python_target_version >= (3, 10),
52
- use_typing_extensions=use_typing_extensions,
53
- )
51
+ transformer: ConvertUnionToAnnotatedUnion | UpdateImportsCodemod
52
+
53
+ if codemod == "update-imports":
54
+ transformer = UpdateImportsCodemod(context=CodemodContext())
55
+
56
+ else:
57
+ transformer = ConvertUnionToAnnotatedUnion(
58
+ CodemodContext(),
59
+ use_pipe_syntax=python_target_version >= (3, 10),
60
+ use_typing_extensions=use_typing_extensions,
61
+ )
54
62
 
55
63
  files: list[str] = []
56
64
 
@@ -6,7 +6,8 @@ from rich.progress import TaskID
6
6
  class FakeProgress:
7
7
  """A fake progress bar that does nothing.
8
8
 
9
- This is used when the user has only one file to process."""
9
+ This is used when the user has only one file to process.
10
+ """
10
11
 
11
12
  def advance(self, task_id: TaskID) -> None:
12
13
  pass
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import contextlib
4
4
  import os
5
+ from importlib.metadata import version
5
6
  from multiprocessing import Pool, cpu_count
6
7
  from typing import TYPE_CHECKING, Any, Dict, Generator, Sequence, Type, Union
7
8
 
@@ -18,13 +19,29 @@ ProgressType = Union[Type[Progress], Type[FakeProgress]]
18
19
  PoolType = Union[Type[Pool], Type[DummyPool]] # type: ignore
19
20
 
20
21
 
22
+ def _get_libcst_version() -> tuple[int, int, int]:
23
+ package_version_str = version("libcst")
24
+
25
+ try:
26
+ major, minor, patch = map(int, package_version_str.split("."))
27
+ except ValueError:
28
+ major, minor, patch = (0, 0, 0)
29
+
30
+ return major, minor, patch
31
+
32
+
21
33
  def _execute_transform_wrap(
22
34
  job: Dict[str, Any],
23
35
  ) -> ExecutionResult:
36
+ additional_kwargs: Dict[str, Any] = {}
37
+
38
+ if _get_libcst_version() >= (1, 4, 0):
39
+ additional_kwargs["scratch"] = {}
40
+
24
41
  # TODO: maybe capture warnings?
25
42
  with open(os.devnull, "w") as null: # noqa: PTH123
26
43
  with contextlib.redirect_stderr(null):
27
- return _execute_transform(**job)
44
+ return _execute_transform(**job, **additional_kwargs)
28
45
 
29
46
 
30
47
  def _get_progress_and_pool(
@@ -12,3 +12,11 @@ class NoOperationNameProvidedError(CodegenError):
12
12
 
13
13
  class MultipleOperationsProvidedError(CodegenError):
14
14
  pass
15
+
16
+
17
+ __all__ = [
18
+ "CodegenError",
19
+ "NoOperationProvidedError",
20
+ "NoOperationNameProvidedError",
21
+ "MultipleOperationsProvidedError",
22
+ ]
@@ -42,19 +42,19 @@ from graphql import (
42
42
  parse,
43
43
  )
44
44
 
45
- from strawberry.custom_scalar import ScalarDefinition, ScalarWrapper
46
- from strawberry.enum import EnumDefinition
47
- from strawberry.lazy_type import LazyType
48
- from strawberry.type import (
45
+ from strawberry.types.base import (
49
46
  StrawberryList,
47
+ StrawberryObjectDefinition,
50
48
  StrawberryOptional,
51
49
  StrawberryType,
52
50
  get_object_definition,
53
51
  has_object_definition,
54
52
  )
55
- from strawberry.types.types import StrawberryObjectDefinition
56
- from strawberry.union import StrawberryUnion
57
- from strawberry.unset import UNSET
53
+ from strawberry.types.enum import EnumDefinition
54
+ from strawberry.types.lazy_type import LazyType
55
+ from strawberry.types.scalar import ScalarDefinition, ScalarWrapper
56
+ from strawberry.types.union import StrawberryUnion
57
+ from strawberry.types.unset import UNSET
58
58
  from strawberry.utils.str_converters import capitalize_first, to_camel_case
59
59
 
60
60
  from .exceptions import (
@@ -917,3 +917,12 @@ class QueryCodegen:
917
917
  )
918
918
  self._collect_type(graphql_enum)
919
919
  return graphql_enum
920
+
921
+
922
+ __all__ = [
923
+ "QueryCodegen",
924
+ "QueryCodegenPlugin",
925
+ "ConsolePlugin",
926
+ "CodegenFile",
927
+ "CodegenResult",
928
+ ]