Skip to content

Commit

Permalink
update metagen snapshots, grr
Browse files Browse the repository at this point in the history
  • Loading branch information
j03-dev committed Oct 9, 2024
1 parent 302418e commit 7cd8c0b
Show file tree
Hide file tree
Showing 5 changed files with 188 additions and 147 deletions.
88 changes: 64 additions & 24 deletions tests/metagen/__snapshots__/metagen_test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ from dataclasses import dataclass, asdict, fields
FORWARD_REFS = {}
class Ctx:
def gql(self, query: str, variables: str) -> Any:
pass
class Struct:
def repr(self):
return asdict(self)
Expand Down Expand Up @@ -108,7 +113,7 @@ def __repr(value: Any):
def typed_three(user_fn: Callable[[RootOneFnInput, Any], Student]):
def typed_three(user_fn: Callable[[RootOneFnInput, Ctx], Student]):
def exported_wrapper(raw_inp, ctx):
inp: RootOneFnInput = Struct.new(RootOneFnInput, raw_inp)
out: Student = user_fn(inp, ctx)
Expand All @@ -132,7 +137,7 @@ from .other_types import RootOneFnInput, Student, typed_three
@typed_three
def three(inp: RootOneFnInput, ctx) -> Student:
def three(inp: RootOneFnInput, ctx: Ctx) -> Student:
# TODO: write your logic here
raise Exception("three not implemented")
Expand All @@ -147,6 +152,11 @@ from dataclasses import dataclass, asdict, fields
FORWARD_REFS = {}
class Ctx:
def gql(self, query: str, variables: str) -> Any:
pass
class Struct:
def repr(self):
return asdict(self)
Expand Down Expand Up @@ -256,7 +266,7 @@ def __repr(value: Any):
def typed_fnOne(user_fn: Callable[[RootOneFnInput, Any], TypeRootOneFnOutput]):
def typed_fnOne(user_fn: Callable[[RootOneFnInput, Ctx], TypeRootOneFnOutput]):
def exported_wrapper(raw_inp, ctx):
inp: RootOneFnInput = Struct.new(RootOneFnInput, raw_inp)
out: TypeRootOneFnOutput = user_fn(inp, ctx)
Expand All @@ -267,7 +277,7 @@ def typed_fnOne(user_fn: Callable[[RootOneFnInput, Any], TypeRootOneFnOutput]):
return exported_wrapper
def typed_fnTwo(user_fn: Callable[[TwoInput, Any], TypeRootOneFnInputNameString]):
def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeRootOneFnInputNameString]):
def exported_wrapper(raw_inp, ctx):
inp: TwoInput = Struct.new(TwoInput, raw_inp)
out: TypeRootOneFnInputNameString = user_fn(inp, ctx)
Expand All @@ -291,12 +301,12 @@ from .same_hit_types import RootOneFnInput, TwoInput, TypeRootOneFnInputNameStri
@typed_fnOne
def fnOne(inp: RootOneFnInput, ctx) -> TypeRootOneFnOutput:
def fnOne(inp: RootOneFnInput, ctx: Ctx) -> TypeRootOneFnOutput:
# TODO: write your logic here
raise Exception("fnOne not implemented")
@typed_fnTwo
def fnTwo(inp: TwoInput, ctx) -> TypeRootOneFnInputNameString:
def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeRootOneFnInputNameString:
# TODO: write your logic here
raise Exception("fnTwo not implemented")
Expand Down Expand Up @@ -805,6 +815,11 @@ from dataclasses import dataclass, asdict, fields
FORWARD_REFS = {}
class Ctx:
def gql(self, query: str, variables: str) -> Any:
pass
class Struct:
def repr(self):
return asdict(self)
Expand Down Expand Up @@ -904,7 +919,7 @@ def __repr(value: Any):
def typed_three(user_fn: Callable[[RootOneFnInput, Any], Student]):
def typed_three(user_fn: Callable[[RootOneFnInput, Ctx], Student]):
def exported_wrapper(raw_inp, ctx):
inp: RootOneFnInput = Struct.new(RootOneFnInput, raw_inp)
out: Student = user_fn(inp, ctx)
Expand All @@ -928,7 +943,7 @@ from .other_types import RootOneFnInput, Student, typed_three
@typed_three
def three(inp: RootOneFnInput, ctx) -> Student:
def three(inp: RootOneFnInput, ctx: Ctx) -> Student:
# TODO: write your logic here
raise Exception("three not implemented")
Expand All @@ -943,6 +958,11 @@ from dataclasses import dataclass, asdict, fields
FORWARD_REFS = {}
class Ctx:
def gql(self, query: str, variables: str) -> Any:
pass
class Struct:
def repr(self):
return asdict(self)
Expand Down Expand Up @@ -1052,7 +1072,7 @@ def __repr(value: Any):
def typed_fnOne(user_fn: Callable[[RootOneFnInput, Any], TypeRootOneFnOutput]):
def typed_fnOne(user_fn: Callable[[RootOneFnInput, Ctx], TypeRootOneFnOutput]):
def exported_wrapper(raw_inp, ctx):
inp: RootOneFnInput = Struct.new(RootOneFnInput, raw_inp)
out: TypeRootOneFnOutput = user_fn(inp, ctx)
Expand All @@ -1063,7 +1083,7 @@ def typed_fnOne(user_fn: Callable[[RootOneFnInput, Any], TypeRootOneFnOutput]):
return exported_wrapper
def typed_fnTwo(user_fn: Callable[[TwoInput, Any], TypeRootOneFnInputNameString]):
def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeRootOneFnInputNameString]):
def exported_wrapper(raw_inp, ctx):
inp: TwoInput = Struct.new(TwoInput, raw_inp)
out: TypeRootOneFnInputNameString = user_fn(inp, ctx)
Expand All @@ -1087,12 +1107,12 @@ from .same_hit_types import RootOneFnInput, TwoInput, TypeRootOneFnInputNameStri
@typed_fnOne
def fnOne(inp: RootOneFnInput, ctx) -> TypeRootOneFnOutput:
def fnOne(inp: RootOneFnInput, ctx: Ctx) -> TypeRootOneFnOutput:
# TODO: write your logic here
raise Exception("fnOne not implemented")
@typed_fnTwo
def fnTwo(inp: TwoInput, ctx) -> TypeRootOneFnInputNameString:
def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeRootOneFnInputNameString:
# TODO: write your logic here
raise Exception("fnTwo not implemented")
Expand Down Expand Up @@ -1601,6 +1621,11 @@ from dataclasses import dataclass, asdict, fields
FORWARD_REFS = {}
class Ctx:
def gql(self, query: str, variables: str) -> Any:
pass
class Struct:
def repr(self):
return asdict(self)
Expand Down Expand Up @@ -1700,7 +1725,7 @@ def __repr(value: Any):
def typed_three(user_fn: Callable[[RootOneFnInput, Any], Student]):
def typed_three(user_fn: Callable[[RootOneFnInput, Ctx], Student]):
def exported_wrapper(raw_inp, ctx):
inp: RootOneFnInput = Struct.new(RootOneFnInput, raw_inp)
out: Student = user_fn(inp, ctx)
Expand All @@ -1724,7 +1749,7 @@ from .other_types import RootOneFnInput, Student, typed_three
@typed_three
def three(inp: RootOneFnInput, ctx) -> Student:
def three(inp: RootOneFnInput, ctx: Ctx) -> Student:
# TODO: write your logic here
raise Exception("three not implemented")
Expand All @@ -1739,6 +1764,11 @@ from dataclasses import dataclass, asdict, fields
FORWARD_REFS = {}
class Ctx:
def gql(self, query: str, variables: str) -> Any:
pass
class Struct:
def repr(self):
return asdict(self)
Expand Down Expand Up @@ -1848,7 +1878,7 @@ def __repr(value: Any):
def typed_fnOne(user_fn: Callable[[RootOneFnInput, Any], TypeRootOneFnOutput]):
def typed_fnOne(user_fn: Callable[[RootOneFnInput, Ctx], TypeRootOneFnOutput]):
def exported_wrapper(raw_inp, ctx):
inp: RootOneFnInput = Struct.new(RootOneFnInput, raw_inp)
out: TypeRootOneFnOutput = user_fn(inp, ctx)
Expand All @@ -1859,7 +1889,7 @@ def typed_fnOne(user_fn: Callable[[RootOneFnInput, Any], TypeRootOneFnOutput]):
return exported_wrapper
def typed_fnTwo(user_fn: Callable[[TwoInput, Any], TypeRootOneFnInputNameString]):
def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeRootOneFnInputNameString]):
def exported_wrapper(raw_inp, ctx):
inp: TwoInput = Struct.new(TwoInput, raw_inp)
out: TypeRootOneFnInputNameString = user_fn(inp, ctx)
Expand All @@ -1883,12 +1913,12 @@ from .same_hit_types import RootOneFnInput, TwoInput, TypeRootOneFnInputNameStri
@typed_fnOne
def fnOne(inp: RootOneFnInput, ctx) -> TypeRootOneFnOutput:
def fnOne(inp: RootOneFnInput, ctx: Ctx) -> TypeRootOneFnOutput:
# TODO: write your logic here
raise Exception("fnOne not implemented")
@typed_fnTwo
def fnTwo(inp: TwoInput, ctx) -> TypeRootOneFnInputNameString:
def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeRootOneFnInputNameString:
# TODO: write your logic here
raise Exception("fnTwo not implemented")
Expand All @@ -1908,6 +1938,11 @@ from dataclasses import dataclass, asdict, fields
FORWARD_REFS = {}
class Ctx:
def gql(self, query: str, variables: str) -> Any:
pass
class Struct:
def repr(self):
return asdict(self)
Expand Down Expand Up @@ -2007,7 +2042,7 @@ def __repr(value: Any):
def typed_three(user_fn: Callable[[RootOneFnInput, Any], Student]):
def typed_three(user_fn: Callable[[RootOneFnInput, Ctx], Student]):
def exported_wrapper(raw_inp, ctx):
inp: RootOneFnInput = Struct.new(RootOneFnInput, raw_inp)
out: Student = user_fn(inp, ctx)
Expand All @@ -2031,7 +2066,7 @@ from .other_types import RootOneFnInput, Student, typed_three
@typed_three
def three(inp: RootOneFnInput, ctx) -> Student:
def three(inp: RootOneFnInput, ctx: Ctx) -> Student:
# TODO: write your logic here
raise Exception("three not implemented")
Expand All @@ -2046,6 +2081,11 @@ from dataclasses import dataclass, asdict, fields
FORWARD_REFS = {}
class Ctx:
def gql(self, query: str, variables: str) -> Any:
pass
class Struct:
def repr(self):
return asdict(self)
Expand Down Expand Up @@ -2155,7 +2195,7 @@ def __repr(value: Any):
def typed_fnOne(user_fn: Callable[[RootOneFnInput, Any], TypeRootOneFnOutput]):
def typed_fnOne(user_fn: Callable[[RootOneFnInput, Ctx], TypeRootOneFnOutput]):
def exported_wrapper(raw_inp, ctx):
inp: RootOneFnInput = Struct.new(RootOneFnInput, raw_inp)
out: TypeRootOneFnOutput = user_fn(inp, ctx)
Expand All @@ -2166,7 +2206,7 @@ def typed_fnOne(user_fn: Callable[[RootOneFnInput, Any], TypeRootOneFnOutput]):
return exported_wrapper
def typed_fnTwo(user_fn: Callable[[TwoInput, Any], TypeRootOneFnInputNameString]):
def typed_fnTwo(user_fn: Callable[[TwoInput, Ctx], TypeRootOneFnInputNameString]):
def exported_wrapper(raw_inp, ctx):
inp: TwoInput = Struct.new(TwoInput, raw_inp)
out: TypeRootOneFnInputNameString = user_fn(inp, ctx)
Expand All @@ -2190,12 +2230,12 @@ from .same_hit_types import RootOneFnInput, TwoInput, TypeRootOneFnInputNameStri
@typed_fnOne
def fnOne(inp: RootOneFnInput, ctx) -> TypeRootOneFnOutput:
def fnOne(inp: RootOneFnInput, ctx: Ctx) -> TypeRootOneFnOutput:
# TODO: write your logic here
raise Exception("fnOne not implemented")
@typed_fnTwo
def fnTwo(inp: TwoInput, ctx) -> TypeRootOneFnInputNameString:
def fnTwo(inp: TwoInput, ctx: Ctx) -> TypeRootOneFnInputNameString:
# TODO: write your logic here
raise Exception("fnTwo not implemented")
Expand Down
9 changes: 5 additions & 4 deletions tests/metagen/typegraphs/identities/py/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,26 @@
typed_primitives,
SimpleCycles1,
typed_simple_cycles,
Ctx,
)
from . import handlers_types as types


@typed_primitives
def primitives(inp: types.PrimitivesArgs, ctx) -> Primitives:
def primitives(inp: types.PrimitivesArgs, ctx: Ctx) -> Primitives:
return inp.data


@typed_composites
def composites(inp: types.CompositesArgs, ctx) -> Composites:
def composites(inp: types.CompositesArgs, ctx: Ctx) -> Composites:
return inp.data


@typed_cycles
def cycles(inp: types.Cycles1Args, ctx) -> Cycles1:
def cycles(inp: types.Cycles1Args, ctx: Ctx) -> Cycles1:
return inp.data


@typed_simple_cycles
def simple_cycles(inp: types.SimpleCycles1Args, ctx) -> SimpleCycles1:
def simple_cycles(inp: types.SimpleCycles1Args, ctx: Ctx) -> SimpleCycles1:
return inp.data
Loading

0 comments on commit 7cd8c0b

Please sign in to comment.