Skip to content

Commit 75f3431

Browse files
Regenerating code
1 parent a0db2fe commit 75f3431

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

tests/codegen/snapshot/snapshots/test_basic_stream/test_service/__init__.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
Stream_MethodOutputTypeAdapter,
1717
encode_Stream_MethodInput,
1818
)
19+
from .emit_error import Emit_ErrorErrors, Emit_ErrorErrorsTypeAdapter
20+
21+
intTypeAdapter: TypeAdapter[int] = TypeAdapter(int)
22+
23+
24+
boolTypeAdapter: TypeAdapter[bool] = TypeAdapter(bool)
1925

2026

2127
class Test_ServiceService:
@@ -40,3 +46,22 @@ async def stream_method(
4046
x # type: ignore[arg-type]
4147
),
4248
)
49+
50+
async def emit_error(
51+
self,
52+
inputStream: AsyncIterable[int],
53+
) -> AsyncIterator[bool | Emit_ErrorErrors | RiverError]:
54+
return self.client.send_stream(
55+
"test_service",
56+
"emit_error",
57+
None,
58+
inputStream,
59+
None,
60+
lambda x: x,
61+
lambda x: boolTypeAdapter.validate_python(
62+
x # type: ignore[arg-type]
63+
),
64+
lambda x: Emit_ErrorErrorsTypeAdapter.validate_python(
65+
x # type: ignore[arg-type]
66+
),
67+
)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Code generated by river.codegen. DO NOT EDIT.
2+
from collections.abc import AsyncIterable, AsyncIterator
3+
import datetime
4+
from typing import (
5+
Any,
6+
Literal,
7+
Mapping,
8+
NotRequired,
9+
TypedDict,
10+
)
11+
from typing_extensions import Annotated
12+
13+
from pydantic import BaseModel, Field, TypeAdapter, WrapValidator
14+
from replit_river.error_schema import RiverError
15+
from replit_river.client import (
16+
RiverUnknownError,
17+
translate_unknown_error,
18+
RiverUnknownValue,
19+
translate_unknown_value,
20+
)
21+
22+
import replit_river as river
23+
24+
25+
class Emit_ErrorErrorsOneOf_DATA_LOSS(RiverError):
26+
code: Literal["DATA_LOSS"]
27+
message: str
28+
29+
30+
class Emit_ErrorErrorsOneOf_UNEXPECTED_DISCONNECT(RiverError):
31+
code: Literal["UNEXPECTED_DISCONNECT"]
32+
message: str
33+
34+
35+
Emit_ErrorErrors = Annotated[
36+
Emit_ErrorErrorsOneOf_DATA_LOSS
37+
| Emit_ErrorErrorsOneOf_UNEXPECTED_DISCONNECT
38+
| RiverUnknownError,
39+
WrapValidator(translate_unknown_error),
40+
]
41+
42+
43+
Emit_ErrorErrorsTypeAdapter: TypeAdapter[Emit_ErrorErrors] = TypeAdapter(
44+
Emit_ErrorErrors
45+
)

0 commit comments

Comments
 (0)