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

Method func_signature

sdk/python/codegen/src/codegen/generator.py:751–768  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

749 )
750
751 def func_signature(self) -> str:
752 params = ", ".join(
753 chain(
754 ("self",),
755 (a.as_param() for a in self.required_args),
756 ("*",) if self.default_args else (),
757 (a.as_param() for a in self.default_args),
758 )
759 )
760 # arbitrary heuristic to force trailing comma in long signatures
761 if len(params) > 40: # noqa: PLR2004
762 params = f"{params},"
763
764 ret_type = "Self" if self.type == self.parent_name else self.type
765 sig = self.ctx.render_types(f"def {self.name}({params}) -> {ret_type}:")
766 if self.is_exec:
767 sig = f"async {sig}"
768 return sig
769
770 @joiner
771 def func_body(self) -> Iterator[str]:

Callers 4

__str__Method · 0.95
test_core_syncFunction · 0.80
test_user_sync_leafFunction · 0.80
render_bodyMethod · 0.80

Calls 2

as_paramMethod · 0.80
render_typesMethod · 0.80

Tested by 2

test_core_syncFunction · 0.64
test_user_sync_leafFunction · 0.64