2.2.3.14. pycsamt.api.property#
Common object and metadata helpers for pyCSAMT APIs.
Classes
Small mixin for attaching free-form object metadata. |
|
Root object for lightweight pyCSAMT API behavior. |
- class pycsamt.api.property.MetadataMixin[source]
Bases:
objectSmall mixin for attaching free-form object metadata.
The mixin is intentionally separate from
PyCSAMTObjectso the universal root class remains lightweight.- ensure_metadata()[source]
Return the metadata mapping, creating it when needed.
- class pycsamt.api.property.PyCSAMTObject[source]
Bases:
objectRoot object for lightweight pyCSAMT API behavior.
PyCSAMTObjectprovides a small, dependency-light base for readable object display and shallow introspection. It is not an electromagnetic numerical class and does not assume EDI, MT, TEM, ModEM, Occam, or AI semantics.Subclasses may override
__repr__or__str__freely. For smaller customization, define__repr_fields__or__repr_exclude__on the subclass.- Variables:
__repr_fields__ (iterable of str or None) – Explicit field order for
__repr__. IfNone, dataclass fields,__dict__keys, and__slots__names are discovered automatically.__repr_exclude__ (set of str) – Attribute names excluded from automatic displays.
__repr_max_fields__ (int) – Maximum number of fields shown in
__repr__.__repr_max_string__ (int) – Maximum string length before shortening.
Examples
>>> class Obj(PyCSAMTObject): ... def __init__(self): ... self.name = "S001" ... self.verbose = 2 ... self.values = [1, 2, 3] >>> repr(Obj()) "Obj(name='S001', values=list(len=3, sample=[1, 2, 3]))"
- summary(*, max_fields=None)[source]
Return a short one-line object summary.
- to_dict(*, public_only=True, max_depth=1)[source]
Return a shallow dictionary representation.
- update(**kwargs)[source]
Set attributes from keyword arguments and validate.
- Parameters:
kwargs (Any)
- Return type:
- clone(**overrides)[source]
Return a shallow copy with optional attribute overrides.
- Parameters:
overrides (Any)
- Return type:
- validate()[source]
Validate object state.
Subclasses can override this hook. The base implementation intentionally accepts all states.
- Return type:
None