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

Additional utils #46

Merged
merged 4 commits into from
Dec 14, 2023
Merged

Additional utils #46

merged 4 commits into from
Dec 14, 2023

Conversation

albireox
Copy link
Member

Adds several small utilities:

  • Timer() (already existed, but mentioning for completeness): a context manager to determine the duration of the task executed between __enter__ and __exit__.
  • get_temporary_file_path(): returns a valid temporary named path.
  • run_in_executor(): simple wrapper around asyncio run_in_executor that allows to use thread or process pool executors and handles arguments and keyword arguments.
  • cancel_task(): cancels a task, suppressing the CancelledError.

Copy link

codecov bot commented Dec 14, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (98c2231) 92.9% compared to head (d7fb2f0) 93.1%.

Files Patch % Lines
src/sdsstools/utils.py 94.0% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main     #46     +/-   ##
=======================================
+ Coverage   92.9%   93.1%   +0.3%     
=======================================
  Files          5       6      +1     
  Lines        559     606     +47     
  Branches     126     135      +9     
=======================================
+ Hits         519     564     +45     
- Misses        18      19      +1     
- Partials      22      23      +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@albireox albireox merged commit ab919f2 into main Dec 14, 2023
7 checks passed
@albireox albireox deleted the albireox-utils branch December 14, 2023 02:55
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.

1 participant