44from typing import (
55 Any ,
66 Dict ,
7- List ,
87 Literal ,
98 Optional ,
109 OrderedDict ,
@@ -32,11 +31,11 @@ class RiverConcreteType(BaseModel):
3231
3332
3433class RiverUnionType (BaseModel ):
35- anyOf : List ["RiverType" ]
34+ anyOf : list ["RiverType" ]
3635
3736
3837class RiverIntersectionType (BaseModel ):
39- allOf : List ["RiverType" ]
38+ allOf : list ["RiverType" ]
4039
4140
4241class RiverNotType (BaseModel ):
@@ -93,7 +92,7 @@ def is_literal(tpe: RiverType) -> bool:
9392def encode_type (
9493 type : RiverType , prefix : str , base_model : str
9594) -> Tuple [str , Sequence [str ]]:
96- chunks : List [str ] = []
95+ chunks : list [str ] = []
9796 if isinstance (type , RiverNotType ):
9897 return ("None" , ())
9998 if isinstance (type , RiverUnionType ):
@@ -114,7 +113,7 @@ def flatten_union(tpe: RiverType) -> list[RiverType]:
114113
115114 type = RiverUnionType (anyOf = flatten_union (type ))
116115
117- one_of_candidate_types : List [RiverConcreteType ] = [
116+ one_of_candidate_types : list [RiverConcreteType ] = [
118117 t
119118 for _t in type .anyOf
120119 for t in (_t .anyOf if isinstance (_t , RiverUnionType ) else [_t ])
@@ -160,7 +159,7 @@ def flatten_union(tpe: RiverType) -> list[RiverType]:
160159 (discriminator_value , []),
161160 )[1 ].append (oneof_t )
162161
163- one_of : List [str ] = []
162+ one_of : list [str ] = []
164163 if discriminator_name == "$kind" :
165164 discriminator_name = "kind"
166165 for pfx , (discriminator_value , oneof_ts ) in one_of_pending .items ():
@@ -234,7 +233,7 @@ def encode_{prefix}(x: {repr(prefix)}) -> Any:
234233 # End of stable union detection
235234 # Restore the non-flattened union type
236235 type = original_type
237- any_of : List [str ] = []
236+ any_of : list [str ] = []
238237
239238 typeddict_encoder = []
240239 for i , t in enumerate (type .anyOf ):
@@ -338,7 +337,7 @@ def extract_props(tpe: RiverType) -> list[dict[str, RiverType]]:
338337 return (f"Dict[str, { type_name } ]" , type_chunks )
339338 assert type .type == "object" , type .type
340339
341- current_chunks : List [str ] = [f"class { prefix } ({ base_model } ):" ]
340+ current_chunks : list [str ] = [f"class { prefix } ({ base_model } ):" ]
342341 # For the encoder path, do we need "x" to be bound?
343342 # lambda x: ... vs lambda _: {}
344343 needs_binding = False
@@ -484,7 +483,7 @@ def generate_river_client_module(
484483 schema_root : RiverSchema ,
485484 typed_dict_inputs : bool ,
486485) -> Sequence [str ]:
487- chunks : List [str ] = [
486+ chunks : list [str ] = [
488487 dedent (
489488 """\
490489 # ruff: noqa
@@ -522,7 +521,7 @@ def generate_river_client_module(
522521
523522 input_base_class = "TypedDict" if typed_dict_inputs else "BaseModel"
524523 for schema_name , schema in schema_root .services .items ():
525- current_chunks : List [str ] = [
524+ current_chunks : list [str ] = [
526525 dedent (
527526 f"""\
528527 class { schema_name .title ()} Service:
0 commit comments