shutil.pyi: update chown stubs to support file descriptor (#11082)

Per the python docs, `os.chown`, which is directly called by `shutil.chown`, supports "specifying a file descriptor". Currently, this below code works but fails in mypy:

```python
import shutil
import tempfile

with tempfile.TemporaryFile() as file:
    shutil.chown(file.fileno(), group="my_group")
```
This commit is contained in:
Jit Kanetkar
2023-11-28 16:22:33 -06:00
committed by GitHub
parent 9d6d79c83c
commit e2a393897c

View File

@@ -154,13 +154,13 @@ def disk_usage(path: FileDescriptorOrPath) -> _ntuple_diskusage: ...
# see https://bugs.python.org/issue33140. We keep it here because it's
# in __all__.
@overload
def chown(path: StrOrBytesPath, user: str | int, group: None = None) -> None: ...
def chown(path: FileDescriptorOrPath, user: str | int, group: None = None) -> None: ...
@overload
def chown(path: StrOrBytesPath, user: None = None, *, group: str | int) -> None: ...
def chown(path: FileDescriptorOrPath, user: None = None, *, group: str | int) -> None: ...
@overload
def chown(path: StrOrBytesPath, user: None, group: str | int) -> None: ...
def chown(path: FileDescriptorOrPath, user: None, group: str | int) -> None: ...
@overload
def chown(path: StrOrBytesPath, user: str | int, group: str | int) -> None: ...
def chown(path: FileDescriptorOrPath, user: str | int, group: str | int) -> None: ...
if sys.version_info >= (3, 8):
@overload