Skip to content
Myr

adjust type hint for filename parameter in open_file to also take an os.PathLike (#2725)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Adam Englander · committed by GitHub · parents b54eb6e, 91b8406 · Browse files · 2 files+9 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+9 added−2 removed

  • other:+9 added−2 removed

2 files+9 added−2 removed

modified:src/click/utils.py+2 added-2 removed
351 unmodified lines
352 return opener(encoding, errors)353354355def open_file(356 filename: str,356 filename: t.Union[str, "os.PathLike[str]"],357 mode: str = "r",358 encoding: t.Optional[str] = None,359 errors: t.Optional[str] = "strict",360 lazy: bool = False,
12 unmodified lines
373374 with open_file(filename) as f:375 ...376377 :param filename: The name of the file to open, or ``'-'`` for377 :param filename: The name or Path of the file to open, or ``'-'`` for378 ``stdin``/``stdout``.379 :param mode: The mode in which to open the file.380 :param encoding: The encoding to decode or encode a file opened in381 text mode.
243 unmodified lines
modified:CHANGES.rst+7 added
1.. currentmodule:: click23Version 8.1.84-------------56Unreleased78- Fix an issue with type hints for ``click.open_file()``. :issue:`2717`910Version 8.1.711-------------1213Released 2023-08-17
1100 unmodified lines