MCPcopy Index your code
hub / github.com/python/cpython / _init_param

Function _init_param

Lib/dataclasses.py:651–667  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

649
650
651def _init_param(f):
652 # Return the __init__ parameter string for this field. For
653 # example, the equivalent of 'x:int=3' (except instead of 'int',
654 # reference a variable set to int, and instead of '3', reference a
655 # variable set to 3).
656 if f.default is MISSING and f.default_factory is MISSING:
657 # There's no default, and no default_factory, just output the
658 # variable name and type.
659 default = ''
660 elif f.default is not MISSING:
661 # There's a default, this will be the name that's used to look
662 # it up.
663 default = f'=__dataclass_dflt_{f.name}__'
664 elif f.default_factory is not MISSING:
665 # There's a factory function. Set a marker.
666 default = '=__dataclass_HAS_DEFAULT_FACTORY__'
667 return f'{f.name}{default}'
668
669
670def _init_fn(fields, std_fields, kw_only_fields, frozen, has_post_init,

Callers 1

_init_fnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…