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

Let audb.Dependencies methods return fix types #27

Merged
merged 7 commits into from
Apr 9, 2021

Conversation

hagenw
Copy link
Member

@hagenw hagenw commented Apr 9, 2021

This is a follow up on #24 and #25.

I changed the methods of audb.Dependencies to always return fix types which seems to me much safer as our current approach (even if the current approach makes semantically maybe more sense).

I also changed back the calculation of duration due to this:

>>> deps = audb.dependencies('audioset')
>>> timeit.timeit("deps()['duration'].sum()", number=10, setup="from __main__ import deps")
23.182365000000573
>>> timeit.timeit("sum([deps.duration(file) for file in deps.media])", number=10, setup="from __main__ import deps")
17.973571905007702

@codecov
Copy link

codecov bot commented Apr 9, 2021

Codecov Report

Merging #27 (361cd3c) into master (217b1f7) will not change coverage.
The diff coverage is 100.0%.

Impacted Files Coverage Δ
audb/core/info.py 100.0% <ø> (ø)
audb/core/dependencies.py 100.0% <100.0%> (ø)

@hagenw
Copy link
Member Author

hagenw commented Apr 9, 2021

An alternative fix for duration() would be to add an if deps.duration(file) statement there as well as we did for other methods.
But I still think that it's easier to always return a value.

@frankenjoe
Copy link
Collaborator

But I still think that it's easier to always return a value.

agree

hagenw and others added 4 commits April 9, 2021 10:47
Co-authored-by: Johannes Wagner <jwagner@audeering.com>
Co-authored-by: Johannes Wagner <jwagner@audeering.com>
Co-authored-by: Johannes Wagner <jwagner@audeering.com>
Co-authored-by: Johannes Wagner <jwagner@audeering.com>
@frankenjoe frankenjoe merged commit 7c5d4dc into master Apr 9, 2021
@frankenjoe frankenjoe deleted the fix-return-types branch April 9, 2021 09:10
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

Successfully merging this pull request may close these issues.

2 participants