Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More useful access to attributes #78

Open
psrok1 opened this issue Jun 23, 2022 · 0 comments
Open

More useful access to attributes #78

psrok1 opened this issue Jun 23, 2022 · 0 comments

Comments

@psrok1
Copy link
Member

psrok1 commented Jun 23, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant