Skip to content

add missing docstrings to format_time, short_format_time and pformat - #1811

Merged
Nanored4498 merged 2 commits into
joblib:mainfrom
RavSinghChandan:docs/add-missing-docstrings-logger
Jul 15, 2026
Merged

Nanored4498 merged 2 commits into
joblib:mainfrom
RavSinghChandan:docs/add-missing-docstrings-logger

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

Three public functions in joblib/logger.py have no docstrings while the rest of the module is documented:

  • format_time — formats a duration as '12.3s, 0.2min'
  • short_format_time — compact format, switches to minutes above 60s
  • pformat — pretty-prints an object with numpy options temporarily reduced

Added NumPy-style docstrings (Parameters / Returns) matching the style used in Logger.__init__ in the same file.

No logic changes.

@codecov

codecov Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.11%. Comparing base (b030e4e) to head (728bc6e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1811      +/-   ##
==========================================
- Coverage   94.15%   94.11%   -0.04%     
==========================================
  Files          46       46              
  Lines        7970     7970              
==========================================
- Hits         7504     7501       -3     
- Misses        466      469       +3     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Nanored4498 Nanored4498 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. There is just a small change suggestion, and then I think we can merge that.

Comment thread joblib/logger.py Outdated
Returns
-------
str
Formatted string: ``' 42.0s'`` for short durations or

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Formatted string: ``' 42.0s'`` for short durations or
Formatted string: ``' 42.0s'`` for short durations or

I think there should be two spaces before 42.

@RavSinghChandan

Copy link
Copy Markdown
Contributor Author

Good catch, fixed. It returns %5.1fs so 42.0 renders with two leading spaces — updated the docstring to match.

@Nanored4498
Nanored4498 merged commit 8d1ebb9 into joblib:main Jul 15, 2026
1 check passed
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