mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user