strawberry-graphql 0.270.3__py3-none-any.whl → 0.270.5__py3-none-any.whl

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.
@@ -0,0 +1,40 @@
1
+ # Additional information
2
+
3
+ This folder contains file(s) or code that is originally taken from other
4
+ projects and got further adaptations by the maintainers of Strawberry.
5
+
6
+ ## `dataclasses.py`
7
+
8
+ The file
9
+ [dataclasses.py](https://github.com/strawberry-graphql/strawberry/tree/main/strawberry/ext/dataclasses/dataclasses.py)
10
+ which is based on
11
+ https://github.com/python/cpython/blob/v3.9.6/Lib/dataclasses.py#L489-L536
12
+ but has got some small adjustments in the adopted function
13
+ `dataclass_init_fn()` so the functionality is fitting the desired
14
+ requirements within Strawberry.
15
+
16
+ From the docstring of `dataclass_init_fn()`:
17
+
18
+ ```
19
+ """
20
+ Create an __init__ function for a dataclass.
21
+
22
+ We create a custom __init__ function for the dataclasses that back
23
+ Strawberry object types to only accept keyword arguments. This allows us to
24
+ avoid the problem where a type cannot define a field with a default value
25
+ before a field that doesn't have a default value.
26
+
27
+ An example of the problem:
28
+ https://stackoverflow.com/questions/51575931/class-inheritance-in-python-3-7-dataclasses
29
+
30
+ Code is adapted from:
31
+ https://github.com/python/cpython/blob/v3.9.6/Lib/dataclasses.py#L489-L536
32
+
33
+ Note: in Python 3.10 and above we use the `kw_only` argument to achieve the
34
+ same result.
35
+ """
36
+ ```
37
+
38
+ The file was added so kwargs could be enforced on Python classes within
39
+ Strawberry.
40
+ See also the file LICENSE for copyright information.
@@ -216,13 +216,18 @@ class BaseGraphQLTransportWSHandler(Generic[Context, RootValue]):
216
216
  await self.websocket.close(code=4400, reason=exc.message)
217
217
  return
218
218
 
219
+ operation_name = message["payload"].get("operationName")
220
+
219
221
  try:
220
- operation_type = get_operation_type(
221
- graphql_document, message["payload"].get("operationName")
222
- )
222
+ operation_type = get_operation_type(graphql_document, operation_name)
223
223
  except RuntimeError:
224
224
  await self.websocket.close(
225
- code=4400, reason="Can't get GraphQL operation type"
225
+ code=4400,
226
+ reason=(
227
+ f'Unknown operation named "{operation_name}".'
228
+ if operation_name
229
+ else "Can't get GraphQL operation type"
230
+ ),
226
231
  )
227
232
  return
228
233
 
@@ -199,7 +199,13 @@ class BaseGraphQLWSHandler(Generic[Context, RootValue]):
199
199
  ErrorMessage(
200
200
  type="error",
201
201
  id=operation_id,
202
- payload={"message": f'Unknown operation named "{operation_name}".'},
202
+ payload={
203
+ "message": (
204
+ f'Unknown operation named "{operation_name}".'
205
+ if operation_name
206
+ else "Can't get GraphQL operation type"
207
+ )
208
+ },
203
209
  )
204
210
  )
205
211
  except asyncio.CancelledError:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: strawberry-graphql
3
- Version: 0.270.3
3
+ Version: 0.270.5
4
4
  Summary: A library for creating GraphQL APIs
5
5
  License: MIT
6
6
  Keywords: graphql,api,rest,starlette,async
@@ -59,6 +59,7 @@ Requires-Dist: starlette (>=0.18.0) ; extra == "asgi" or extra == "debug-server"
59
59
  Requires-Dist: typer (>=0.7.0) ; extra == "debug-server" or extra == "cli"
60
60
  Requires-Dist: typing-extensions (>=4.5.0)
61
61
  Requires-Dist: uvicorn (>=0.11.6) ; extra == "debug-server"
62
+ Requires-Dist: websockets (>=15.0.1,<16.0.0) ; extra == "debug-server"
62
63
  Project-URL: Changelog, https://strawberry.rocks/changelog
63
64
  Project-URL: Documentation, https://strawberry.rocks/
64
65
  Project-URL: Discord, https://discord.com/invite/3uQ2PaY
@@ -84,6 +84,7 @@ strawberry/experimental/pydantic/utils.py,sha256=URSzmcK2KzNGsLv4RyFdFfJnr-ARNLk
84
84
  strawberry/ext/LICENSE,sha256=_oY0TZg0b_sW0--0T44aMTpy2e2zF1Kiyn8E1qDiivo,1249
85
85
  strawberry/ext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
86
86
  strawberry/ext/dataclasses/LICENSE,sha256=WZgm35K_3NJwLqxpEHJJi7CWxVrwTumEz5D3Dtd7WnA,13925
87
+ strawberry/ext/dataclasses/README.md,sha256=WE3523o9gBGpa18ikiQhgEUNuuBJWR5tMKmjicrLOHU,1389
87
88
  strawberry/ext/dataclasses/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
89
  strawberry/ext/dataclasses/dataclasses.py,sha256=bTW8nRwflW7_JtGhzXiKhe9Kajha_fgCfR0jVKrCzBw,2287
89
90
  strawberry/ext/mypy_plugin.py,sha256=KqpEWUnQftmmlC0CtK33H1FMR7P-WdI-F9Evnc60Mm0,20458
@@ -184,10 +185,10 @@ strawberry/static/pathfinder.html,sha256=0DPx9AmJ2C_sJstFXnWOz9k5tVQHeHaK7qdVY4l
184
185
  strawberry/subscriptions/__init__.py,sha256=1VGmiCzFepqRFyCikagkUoHHdoTG3XYlFu9GafoQMws,170
185
186
  strawberry/subscriptions/protocols/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
186
187
  strawberry/subscriptions/protocols/graphql_transport_ws/__init__.py,sha256=wN6dkMu6WiaIZTE19PGoN9xXpIN_RdDE_q7F7ZgjCxk,138
187
- strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py,sha256=PFJDEYOXqqROkczVKZ8k4yWJbib1cE6ySx9GIR5hAVI,15079
188
+ strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py,sha256=8F93epfxwktsAgTF7_TwC-9kBnjrzOpF-McEV36xEVw,15257
188
189
  strawberry/subscriptions/protocols/graphql_transport_ws/types.py,sha256=N9r2mXg5jmmjYoZV5rWf3lAzgylCOUrbKGmClXCoOso,2169
189
190
  strawberry/subscriptions/protocols/graphql_ws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
190
- strawberry/subscriptions/protocols/graphql_ws/handlers.py,sha256=MWSipEW-mnklAvdqfmTdQZ4w3Dtk7lMLpIIuI4wyNz8,8675
191
+ strawberry/subscriptions/protocols/graphql_ws/handlers.py,sha256=5mFyfP3brn0aS3SmeF7-z2vWTS2NhsLTD3JVE1zbr6k,8891
191
192
  strawberry/subscriptions/protocols/graphql_ws/types.py,sha256=Uumiz-1O5qQnx-ERBaQtaf7db5yx-V9LMypOn9oGKwM,2003
192
193
  strawberry/test/__init__.py,sha256=lKVbKJDBnrYSPYHIKrg54UpaZcSoL93Z01zOpA1IzZM,115
193
194
  strawberry/test/client.py,sha256=ILAttb6A3jplH5wJNMeyyT1u_Q8KnollfpYLP_BVZR4,6438
@@ -229,8 +230,8 @@ strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,7
229
230
  strawberry/utils/operation.py,sha256=s7ajvLg_q6v2mg47kEMQPjO_J-XluMKTCwo4d47mGvE,1195
230
231
  strawberry/utils/str_converters.py,sha256=-eH1Cl16IO_wrBlsGM-km4IY0IKsjhjnSNGRGOwQjVM,897
231
232
  strawberry/utils/typing.py,sha256=SDvX-Du-9HAV3-XXjqi7Q5f5qPDDFd_gASIITiwBQT4,14073
232
- strawberry_graphql-0.270.3.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
233
- strawberry_graphql-0.270.3.dist-info/METADATA,sha256=nBJgasFC21zrKkwnL1wgCkSIrZJo8yUI0FNdUmtveV0,7686
234
- strawberry_graphql-0.270.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
235
- strawberry_graphql-0.270.3.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
236
- strawberry_graphql-0.270.3.dist-info/RECORD,,
233
+ strawberry_graphql-0.270.5.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
234
+ strawberry_graphql-0.270.5.dist-info/METADATA,sha256=HjkrVU8BGAhcdblmyYS4Gt5lP6Y-ezKEL7ElpOUtQa8,7757
235
+ strawberry_graphql-0.270.5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
236
+ strawberry_graphql-0.270.5.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
237
+ strawberry_graphql-0.270.5.dist-info/RECORD,,