MCPcopy Create free account
hub / github.com/StackStorm/st2 / from_model

Method from_model

st2common/st2common/models/api/auth.py:159–170  ·  view source on GitHub ↗
(cls, model, mask_secrets=False)

Source from the content-addressed store, hash-verified

157
158 @classmethod
159 def from_model(cls, model, mask_secrets=False):
160 doc = cls._from_model(model=model, mask_secrets=mask_secrets)
161 attrs = {attr: value for attr, value in six.iteritems(doc) if value is not None}
162 attrs["created_at"] = (
163 isotime.format(model.created_at, offset=False) if model.created_at else None
164 )
165 # key_hash is ignored.
166 attrs.pop("key_hash", None)
167 # key is unknown so the calling code will have to update after conversion.
168 attrs["key"] = None
169
170 return cls(**attrs)

Callers

nothing calls this directly

Calls 3

_from_modelMethod · 0.80
formatMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected