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

Class Field

sdk/python/src/dagger/client/_core.py:68–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66
67@dataclasses.dataclass(slots=True)
68class Field:
69 type_name: str
70 name: str
71 args: dict[str, Any]
72 children: dict[str, "Field"] = dataclasses.field(default_factory=dict)
73 # When set, children are wrapped in an inline fragment on this type:
74 # field(args) { ... on inline_type { children } }
75 inline_type: str | None = None
76
77 def to_dsl(self, schema: DSLSchema) -> DSLField:
78 type_: DSLType = getattr(schema, self.type_name)
79 field_ = getattr(type_, self.name)(**self.args)
80 if self.children:
81 child_fields = {
82 name: child.to_dsl(schema) for name, child in self.children.items()
83 }
84 if self.inline_type is not None:
85 frag_type: DSLType = getattr(schema, self.inline_type)
86 inline = DSLInlineFragment().on(frag_type).select(**child_fields)
87 field_ = field_.select(inline)
88 else:
89 field_ = field_.select(**child_fields)
90 return field_
91
92 def add_child(self, child: "Field") -> "Field":
93 return dataclasses.replace(self, children={child.name: child})
94
95
96@dataclasses.dataclass(slots=True)

Callers 9

contextFunction · 0.90
selectMethod · 0.70
select_multipleMethod · 0.70
select_idMethod · 0.70
test_generator.pyFile · 0.50
test_user_sync_leafFunction · 0.50
test_user_sync_objectFunction · 0.50

Calls 1

fieldMethod · 0.45

Tested by 5

contextFunction · 0.72
test_user_sync_leafFunction · 0.40
test_user_sync_objectFunction · 0.40