audeering / audformat

Format to store media files and annotations
https://audeering.github.io/audformat/
Other
11 stars 1 forks source link

Add strict argument to audformat.utils.hash() #454

Closed hagenw closed 4 months ago

hagenw commented 4 months ago

Closes #447

Adds the strict argument to audformat.utils.hash(). If True it will take the order of rows and the names of index levels and columns into account. The returned hash is then identical to the one attached to parquet table files.

A hashing variant that takes into account the order of rows, name of columns and levels, and the data types was needed for calculating a hash for parquet tables as introduced in https://github.com/audeering/audformat/pull/419. Before, this was handled by a private method, independent of audformat.utils.hash().

image

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.0%. Comparing base (a8cd511) to head (7514c60).

Additional details and impacted files | [Files](https://app.codecov.io/gh/audeering/audformat/pull/454?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=audeering) | Coverage Δ | | |---|---|---| | [audformat/core/table.py](https://app.codecov.io/gh/audeering/audformat/pull/454?src=pr&el=tree&filepath=audformat%2Fcore%2Ftable.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=audeering#diff-YXVkZm9ybWF0L2NvcmUvdGFibGUucHk=) | `100.0% <100.0%> (ø)` | | | [audformat/core/utils.py](https://app.codecov.io/gh/audeering/audformat/pull/454?src=pr&el=tree&filepath=audformat%2Fcore%2Futils.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=audeering#diff-YXVkZm9ybWF0L2NvcmUvdXRpbHMucHk=) | `100.0% <100.0%> (ø)` | |
hagenw commented 4 months ago

include_order_and_names is verbose, but also slightly long as an argument name. strict might be a better choice?

hagenw commented 4 months ago

I added a reference to #419 in the description and renamed the argument to strict, thanks for the suggestions.