Skip to content

More useful access to attributes #78

@psrok1

Description

@psrok1

One of use-cases found during some code review:

def remove_attribute(sample: mwdblib.MWDBFile, key: str, value: Any = None) -> None:
    for attribute in sample.attributes[key]:
        if value is None or attribute.value == value:
            sample.remove_attribute(attribute.id)

Code above is wrong but shows expected usage of new API.

get_attributes_detailed exposes identifiers, but attributes are not grouped by key. In addition, it would be nice to have them in named tuples (accessible by getattr, .value) instead of regular dicts with ["value"] syntax to access the value

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions