MCPcopy
hub / github.com/marshmallow-code/marshmallow / __init__

Method __init__

src/marshmallow/fields.py:2120–2128  ·  view source on GitHub ↗
(self, constant: _ContantT, **kwargs: Unpack[_BaseFieldKwargs])

Source from the content-addressed store, hash-verified

2118 _CHECK_ATTRIBUTE = False
2119
2120 def __init__(self, constant: _ContantT, **kwargs: Unpack[_BaseFieldKwargs]):
2121 super().__init__(**kwargs)
2122 self.constant = constant
2123 self.load_default = constant
2124 self.dump_default = constant
2125 # If allow_none was not explicitly provided and the constant is None,
2126 # None should be considered valid (mirrors Field.__init__ logic).
2127 if kwargs.get("allow_none") is None and constant is None:
2128 self.allow_none = True
2129
2130 def _validate_missing(self, value):
2131 # Omit check for value is missing_

Callers

nothing calls this directly

Calls 2

getMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected