antimatter.converters#

Submodules#

Package Contents#

Classes#

CapabilityConverter

TagConverter

Supports parsing tags from strings and dictionaries.

class antimatter.converters.CapabilityConverter#
static convert_capabilities(capabilities: List[str | Dict[str, Any]]) Dict[str, str]#

Convert a list of capabilities into a dictionary.

class antimatter.converters.TagConverter#

Supports parsing tags from strings and dictionaries. Tags can be of the following format: - A list of unary tags, like [‘tag.antimatter.io/pii/email’, ‘tag.antimatter.io/pii/name’, ‘name’, ‘admin’] - A list of key-value pairs, like [“tag.antimatter.io/pii/date=24/12/2021”, “tag.antimatter.io/pii/credit_card=1234”, ‘admin=True’] - A list of dictionaries, like [{“tag.antimatter.io/pii/email”: “”}, {“tag.antimatter.io/pii/date”: “24/12/2021”}] - A list of dictionaries as a name/value pair, like [{“name”: “tag.antimatter.io/pii/email”, “value”: “”}, {“name”: “tag.antimatter.io/pii/date”, “value”: “24/12/2021”}] - Any combination of the above

static infer_type(tag: str) antimatter.fieldtype.fieldtypes.FieldType#

Infer the field type of the tag value.

static convert_tags(tags: List[str | Dict[str, Any]], unary_value: Any = '') List[antimatter.tags.SpanTag]#

Convert a list of tags into a dictionary.