ObjectNode
- class stdatamodels.properties.ObjectNode(attr, instance, schema, ctx, parent)
Bases:
NodeA dictionary-like object that supports validation against a schema.
Methods Summary
get_default(attr)Retrieve the schema-defined default value of an attribute.
get_dtype(attr)Retrieve the numpy dtype for an attribute, if defined.
hasattr(attr)Check if the node has an attribute in its instance.
items()Methods Documentation
- get_default(attr)
Retrieve the schema-defined default value of an attribute.
- Parameters:
- attrstr
Attribute to set to its default value.
- Returns:
- object or None
The default value for the given attribute. If the attribute is schema-defined but has no default value in the schema, this will return None.
- Raises:
- AttributeError
If the given attribute is not defined in the schema.
- get_dtype(attr)
Retrieve the numpy dtype for an attribute, if defined.
- Parameters:
- attrstr
The attribute to retrieve the dtype for.
- Returns:
- numpy.dtype
The numpy dtype for the attribute.
- Raises:
- AttributeError
If the given attribute is not defined in the schema.
- ValueError
If the given attribute is defined in the schema but has no datatype.
- hasattr(attr)
Check if the node has an attribute in its instance.
- Parameters:
- attrstr
The name of the attribute to check for.
- Returns:
- bool
True if the attribute is in the instance, False otherwise.
- items()