dict_from_object

tollan.utils.namespace.dict_from_object(obj, keys_attr='__all__', schema_attr='_namespace_to_dict_schema', schema=None, keys=None, to_dict_op=None)[source]

Return a dict composed from object’s attributes.

All attributes are filtered by and in the order of keys_attr, schema_attr, schema, and keys.

Parameters
keys_attrstr or None

The attribute name that contains a list of attributes to keep as keys.

schema_attrstr or None

The attribute name that specifies a schema to filter the attributes.

schemaSchema or None

The schema to filter the attributes.

keyslist of str

A list of attribuate names to keep as keys.

to_dict_opcallable or None

The operator to create the raw dict from obj. If None, the dir based dict is returned.