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

Allow Path in polib.pofile() #13396

Merged
merged 4 commits into from
Jan 13, 2025
Merged

Allow Path in polib.pofile() #13396

merged 4 commits into from
Jan 13, 2025

Conversation

m-aciek
Copy link
Contributor

@m-aciek m-aciek commented Jan 13, 2025

Previously:

% mypy generate.py
translators.py:21: error: No overload variant of "pofile" matches argument type "Path"  [call-overload]
translators.py:21: note: Possible overload variants:
translators.py:21: note:     def [_TP: POFile] pofile(pofile: str, *, klass: type[_TP], **kwargs: Any) -> _TP
translators.py:21: note:     def pofile(pofile: str, **kwargs: Any) -> POFile

Confirmed locally that the changes fixes that.

pofile() uses os.open(), so it works nicely with a Path input.

@m-aciek m-aciek marked this pull request as draft January 13, 2025 00:44

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

schemathesis (https://github.com/schemathesis/schemathesis)
-   File "/tmp/mypy_primer/old_mypy/venv/bin/mypy", line 8, in <module>
+   File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 8, in <module>
-   File "/tmp/mypy_primer/old_mypy/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+   File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry

@m-aciek m-aciek changed the title Allow PathLike in polib.pofile() Allow Path in polib.pofile() Jan 13, 2025
@m-aciek m-aciek marked this pull request as ready for review January 13, 2025 08:07
Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Thanks!

@srittau srittau merged commit 88be13d into python:main Jan 13, 2025
43 checks 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