MCPcopy Create free account
hub / github.com/dagger/dagger / Object

Class Object

sdk/python/codegen/src/codegen/generator.py:1058–1091  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1056
1057
1058class Object(ObjectHandler[GraphQLObjectType]):
1059 predicate: ClassVar[Predicate] = staticmethod(is_object_type)
1060
1061 def supertype_name(self, t: GraphQLObjectType) -> str:
1062 return "Root" if t.name == "Query" else "Type"
1063
1064 def type_name(self, t: GraphQLObjectType) -> str:
1065 return super().type_name(t)
1066
1067 def fields(self, t: GraphQLObjectType) -> Iterator[_ObjectField]:
1068 return (
1069 _ObjectField(self.ctx, *args, t)
1070 for args in cast(GraphQLFieldMap, t.fields).items()
1071 )
1072
1073 def render_head(self, t: GraphQLObjectType) -> str:
1074 return f"@typecheck\n{super().render_head(t)}"
1075
1076 @joiner
1077 def render_body(self, t: GraphQLObjectType) -> Iterator[str]:
1078 yield super().render_body(t)
1079
1080 if is_self_chainable(t):
1081 self_name = self.type_name(t)
1082 yield textwrap.dedent(
1083 f'''
1084 def with_(self, cb: Callable[["{self_name}"], "{self_name}"]) -> "{self_name}":
1085 """Call the provided callable with current {self_name}.
1086
1087 This is useful for reusability and readability by not breaking the calling chain.
1088 """
1089 return cb(self)
1090 ''' # noqa: E501
1091 )

Callers 1

generateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected