close
Skip to content

Also allow os.PathLike in typing of write_to_path - #606

Merged
pquentin merged 1 commit into
python-trio:masterfrom
bluetech:pathlike
Jul 6, 2023
Merged

Also allow os.PathLike in typing of write_to_path#606
pquentin merged 1 commit into
python-trio:masterfrom
bluetech:pathlike

Conversation

@bluetech

@bluetech bluetech commented Jul 6, 2023

Copy link
Copy Markdown
Member

If have e.g. a pathlib.Path, this allows blob.write_to_path(path) instead of blob.write_to_path(str(path)).

Comment thread src/trustme/__init__.py Outdated

Args:
path (str): The path to write to.
path (str or path-like object): The path to write to.

@pquentin pquentin Jul 6, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This breaks the documentation build, should we use os.PathLike[str] here or find a way to ignore the Sphinx failure?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed, thanks. BTW, these docstring types are mostly redundant with the function typing, I can configure sphinx accordingly and remove them if you agree.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree.

If have e.g. a pathlib.Path, this allows `blob.write_to_path(path)`
instead of `blob.write_to_path(str(path))`.
@pquentin
pquentin merged commit 0801d27 into python-trio:master Jul 6, 2023
@bluetech
bluetech deleted the pathlike branch July 7, 2023 18:32
@pquentin

Copy link
Copy Markdown
Member

Thank you for your contribution, I released it as part of 1.1.0. (It was a good opportunity to setup Trusted Publishing!)

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