Skip to content

Docstrings: correct locale activation return type and thread scope - #442

Merged
hugovk merged 1 commit into
python-humanize:mainfrom
raghav-sharma-ai:patch-1
Nov 12, 2026
Merged

hugovk merged 1 commit into
python-humanize:mainfrom
raghav-sharma-ai:patch-1

Conversation

@raghav-sharma-ai

Copy link
Copy Markdown
Contributor

Changes proposed in this pull request:

  • Correct activate()'s documented return type from dict to gettext.NullTranslations, matching its annotation and the translation objects it returns.
  • Clarify that activate() and deactivate() affect the calling thread, matching the threading.local() state.

Validation: compiled the translation catalogs with the project script; pytest tests/test_i18n.py -q passed all 118 tests; ruff check src/humanize/i18n.py passed. A separate runtime check confirmed the return types and that changing a worker thread's locale leaves the main thread's locale unchanged.

Only docstrings change. Prepared with AI assistance (OpenAI Codex).

@hugovk hugovk added the changelog: skip Exclude PR from release draft label Nov 12, 2026
@hugovk hugovk changed the title docs: correct locale activation return type and thread scope Docstrings: correct locale activation return type and thread scope Nov 12, 2026
Document the translation object returned by activate() and clarify that activation and deactivation apply to the calling thread.

Prepared with AI assistance (OpenAI Codex).
@hugovk
hugovk enabled auto-merge (squash) November 12, 2026 11:45
@codecov

codecov Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.35%. Comparing base (418a6ae) to head (6f5076d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #442   +/-   ##
=======================================
  Coverage   97.35%   97.35%           
=======================================
  Files          12       12           
  Lines        1022     1022           
=======================================
  Hits          995      995           
  Misses         27       27           
Flag Coverage Δ
macos-latest 97.26% <ø> (ø)
ubuntu-latest 95.00% <ø> (ø)
windows-latest 95.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@hugovk
hugovk merged commit 82f617b into python-humanize:main Nov 12, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: skip Exclude PR from release draft

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants