Skip to content

Commit a50594c

Browse files
committed
Regenerate with list fix
1 parent 9bf225d commit a50594c

5 files changed

Lines changed: 42 additions & 34 deletions

File tree

datajunction-clients/python/datajunction/graphql_client/async_base_client.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
)
1919

2020
try:
21-
from websockets.client import ( # type: ignore[import-not-found,unused-ignore]
22-
WebSocketClientProtocol,
21+
from websockets import ( # type: ignore[import-not-found,unused-ignore]
22+
ClientConnection,
23+
)
24+
from websockets import (
2325
connect as ws_connect,
2426
)
2527
from websockets.typing import ( # type: ignore[import-not-found,unused-ignore]
@@ -31,15 +33,15 @@
3133
from contextlib import asynccontextmanager
3234

3335
@asynccontextmanager # type: ignore
34-
async def ws_connect(*args, **kwargs): # pylint: disable=unused-argument
36+
async def ws_connect(*args, **kwargs):
3537
raise NotImplementedError("Subscriptions require 'websockets' package.")
36-
yield # pylint: disable=unreachable
38+
yield
3739

38-
WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore]
40+
ClientConnection = Any # type: ignore[misc,assignment,unused-ignore]
3941
Data = Any # type: ignore[misc,assignment,unused-ignore]
4042
Origin = Any # type: ignore[misc,assignment,unused-ignore]
4143

42-
def Subprotocol(*args, **kwargs): # type: ignore # pylint: disable=invalid-name
44+
def Subprotocol(*args, **kwargs): # type: ignore # noqa: N802, N803
4345
raise NotImplementedError("Subscriptions require 'websockets' package.")
4446

4547

@@ -304,7 +306,7 @@ async def _execute_json(
304306
**merged_kwargs,
305307
)
306308

307-
async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None:
309+
async def _send_connection_init(self, websocket: ClientConnection) -> None:
308310
payload: Dict[str, Any] = {
309311
"type": GraphQLTransportWSMessageType.CONNECTION_INIT.value
310312
}
@@ -314,7 +316,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non
314316

315317
async def _send_subscribe(
316318
self,
317-
websocket: WebSocketClientProtocol,
319+
websocket: ClientConnection,
318320
operation_id: str,
319321
query: str,
320322
operation_name: Optional[str] = None,
@@ -334,7 +336,7 @@ async def _send_subscribe(
334336
async def _handle_ws_message(
335337
self,
336338
message: Data,
337-
websocket: WebSocketClientProtocol,
339+
websocket: ClientConnection,
338340
expected_type: Optional[GraphQLTransportWSMessageType] = None,
339341
) -> Optional[Dict[str, Any]]:
340342
try:

datajunction-clients/python/datajunction/graphql_client/base_model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
from io import IOBase
44

5-
from pydantic import BaseModel as PydanticBaseModel, ConfigDict
5+
from pydantic import BaseModel as PydanticBaseModel
6+
from pydantic import ConfigDict
67

78

89
class UnsetType:

datajunction-clients/python/datajunction/graphql_client/custom_queries.py

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Generated by ariadne-codegen
22

3-
from typing import Any, Dict, Optional
3+
from typing import Any, Dict, List, Optional
44

55
from . import NodeType
66
from .custom_fields import (
@@ -35,16 +35,16 @@ def find_nodes(
3535
cls,
3636
*,
3737
fragment: Optional[str] = None,
38-
names: Optional[str] = None,
39-
node_types: Optional[NodeType] = None,
40-
tags: Optional[str] = None,
38+
names: Optional[List[str]] = None,
39+
node_types: Optional[List[NodeType]] = None,
40+
tags: Optional[List[str]] = None,
4141
limit: Optional[int] = None
4242
) -> NodeFields:
4343
arguments: Dict[str, Dict[str, Any]] = {
4444
"fragment": {"type": "String", "value": fragment},
45-
"names": {"type": "String", "value": names},
46-
"nodeTypes": {"type": "NodeType", "value": node_types},
47-
"tags": {"type": "String", "value": tags},
45+
"names": {"type": "[String!]", "value": names},
46+
"nodeTypes": {"type": "[NodeType!]", "value": node_types},
47+
"tags": {"type": "[String!]", "value": tags},
4848
"limit": {"type": "Int", "value": limit},
4949
}
5050
cleared_arguments = {
@@ -57,9 +57,9 @@ def find_nodes_paginated(
5757
cls,
5858
*,
5959
fragment: Optional[str] = None,
60-
names: Optional[str] = None,
61-
node_types: Optional[NodeType] = None,
62-
tags: Optional[str] = None,
60+
names: Optional[List[str]] = None,
61+
node_types: Optional[List[NodeType]] = None,
62+
tags: Optional[List[str]] = None,
6363
edited_by: Optional[str] = None,
6464
namespace: Optional[str] = None,
6565
after: Optional[str] = None,
@@ -68,9 +68,9 @@ def find_nodes_paginated(
6868
) -> NodeConnectionFields:
6969
arguments: Dict[str, Dict[str, Any]] = {
7070
"fragment": {"type": "String", "value": fragment},
71-
"names": {"type": "String", "value": names},
72-
"nodeTypes": {"type": "NodeType", "value": node_types},
73-
"tags": {"type": "String", "value": tags},
71+
"names": {"type": "[String!]", "value": names},
72+
"nodeTypes": {"type": "[NodeType!]", "value": node_types},
73+
"tags": {"type": "[String!]", "value": tags},
7474
"editedBy": {"type": "String", "value": edited_by},
7575
"namespace": {"type": "String", "value": namespace},
7676
"after": {"type": "String", "value": after},
@@ -86,10 +86,10 @@ def find_nodes_paginated(
8686

8787
@classmethod
8888
def common_dimensions(
89-
cls, *, nodes: Optional[str] = None
89+
cls, *, nodes: Optional[List[str]] = None
9090
) -> DimensionAttributeFields:
9191
arguments: Dict[str, Dict[str, Any]] = {
92-
"nodes": {"type": "String", "value": nodes}
92+
"nodes": {"type": "[String!]", "value": nodes}
9393
}
9494
cleared_arguments = {
9595
key: value for key, value in arguments.items() if value["value"] is not None
@@ -135,11 +135,14 @@ def measures_sql(
135135

136136
@classmethod
137137
def list_tags(
138-
cls, *, tag_names: Optional[str] = None, tag_types: Optional[str] = None
138+
cls,
139+
*,
140+
tag_names: Optional[List[str]] = None,
141+
tag_types: Optional[List[str]] = None
139142
) -> TagFields:
140143
arguments: Dict[str, Dict[str, Any]] = {
141-
"tagNames": {"type": "String", "value": tag_names},
142-
"tagTypes": {"type": "String", "value": tag_types},
144+
"tagNames": {"type": "[String!]", "value": tag_names},
145+
"tagTypes": {"type": "[String!]", "value": tag_types},
143146
}
144147
cleared_arguments = {
145148
key: value for key, value in arguments.items() if value["value"] is not None

datajunction-clients/python/datajunction/graphql_client/exceptions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ def __init__(
3333
locations: Optional[List[Dict[str, int]]] = None,
3434
path: Optional[List[str]] = None,
3535
extensions: Optional[Dict[str, object]] = None,
36-
orginal: Optional[Dict[str, object]] = None,
36+
original: Optional[Dict[str, object]] = None,
3737
):
3838
self.message = message
3939
self.locations = locations
4040
self.path = path
4141
self.extensions = extensions
42-
self.orginal = orginal
42+
self.original = original
4343

4444
def __str__(self) -> str:
4545
return self.message
@@ -51,7 +51,7 @@ def from_dict(cls, error: Dict[str, Any]) -> "GraphQLClientGraphQLError":
5151
locations=error.get("locations"),
5252
path=error.get("path"),
5353
extensions=error.get("extensions"),
54-
orginal=error,
54+
original=error,
5555
)
5656

5757

@@ -77,7 +77,7 @@ def from_errors_dicts(
7777
)
7878

7979

80-
class GraphQLClientInvalidMessageFormat(GraphQLClientError):
80+
class GraphQLClientInvalidMessageFormat(GraphQLClientError): # noqa: N818
8181
def __init__(self, message: Union[str, bytes]) -> None:
8282
self.message = message
8383

datajunction-server/.pre-commit-config.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ repos:
6464
- id: ariadne-codegen
6565
files: ^datajunction-server/datajunction_server/api/graphql/
6666
name: Generate GraphQL Python Client with Ariadne
67-
entry: bash -c 'cd datajunction-server && ariadne-codegen'
68-
language: system
67+
entry: bash -c 'cd datajunction-server && ariadne-codegen client'
68+
language: python
69+
additional_dependencies:
70+
- git+https://github.com/normanre/ariadne-codegen.git@fix/list-arg-handling#egg=ariadne-codegen
6971
pass_filenames: false

0 commit comments

Comments
 (0)