drepr.models.parsers.v1.attr_parser#
Classes
|
Attributes have two possible schemas 1. When an attribute has only one path |
|
- class ParsedAttrs(attrs: list[drepr.models.attr.Attr] = <factory>, id2attr: dict[str, drepr.models.attr.Attr] = <factory>, attrs_created_in_preprocessing: set[str] = <factory>)[source]#
Bases:
object- Parameters:
attrs (list[drepr.models.attr.Attr]) –
id2attr (dict[str, drepr.models.attr.Attr]) –
- attrs: list[drepr.models.attr.Attr]#
- id2attr: dict[str, drepr.models.attr.Attr]#
- class AttrParser(path_parser: PathParser)[source]#
Bases:
objectAttributes have two possible schemas 1. When an attribute has only one path
` <attr_id>: <attr_path> # .. other attributes .. ```` <attribute_id>:
[resource_id]: <resource_id> (default is “default”) path: <attr_path> [unique]: true|false (default is false) [sorted]: none|ascending|descending (default is none) [value_type]: unspecified|int|float|str|list[int]|list[str]|list[float] (default is unspecified) [missing_values]: [<value0>, <value1>, …]
- Parameters:
path_parser (PathParser) –
- SORTED_VALUES = {'ascending', 'descending', 'none'}#
- VALUE_TYPE_VALUES = {'float', 'int', 'list[float]', 'list[int]', 'list[str]', 'str', 'unspecified-single'}#
- CLS_KEYS = {'missing_values', 'path', 'resource_id', 'sorted', 'unique', 'value_type'}#
- parse(default_resource_id: str, resources: List[Resource], parsed_attrs: ParsedAttrs, def_attrs: dict)[source]#
- Parameters:
default_resource_id (str) –
parsed_attrs (ParsedAttrs) –
def_attrs (dict) –