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

Function format_name

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

Format a GraphQL field or argument name into Python.

(s: str)

Source from the content-addressed store, hash-verified

470
471
472def format_name(s: str) -> str:
473 """Format a GraphQL field or argument name into Python."""
474 # rewrite acronyms, initialisms and abbreviations
475 s = ACRONYM_RE.sub(lambda m: m.group(0).title(), s)
476 s = camel_to_snake(s)
477 if iskeyword(s) or s in _reserved_builtins:
478 s += "_"
479 return s
480
481
482def format_input_type(

Callers 4

test_format_nameFunction · 0.90
_format_nameFunction · 0.85
__init__Method · 0.85
__init__Method · 0.85

Calls 1

subMethod · 0.80

Tested by 1

test_format_nameFunction · 0.72