mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
Use the FileDescriptorOrPath alias consistently in the stdlib (#9513)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import StrOrBytesPath
|
||||
from _typeshed import FileDescriptorOrPath
|
||||
from collections.abc import Callable
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
@@ -12,7 +12,7 @@ if sys.version_info >= (3, 9):
|
||||
|
||||
class FatalIncludeError(SyntaxError): ...
|
||||
|
||||
def default_loader(href: StrOrBytesPath | int, parse: str, encoding: str | None = ...) -> str | Element: ...
|
||||
def default_loader(href: FileDescriptorOrPath, parse: str, encoding: str | None = ...) -> str | Element: ...
|
||||
|
||||
# TODO: loader is of type default_loader ie it takes a callable that has the
|
||||
# same signature as default_loader. But default_loader has a keyword argument
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from _collections_abc import dict_keys
|
||||
from _typeshed import FileDescriptor, ReadableBuffer, StrOrBytesPath, SupportsRead, SupportsWrite
|
||||
from _typeshed import FileDescriptorOrPath, ReadableBuffer, SupportsRead, SupportsWrite
|
||||
from collections.abc import Callable, Generator, ItemsView, Iterable, Iterator, Mapping, Sequence
|
||||
from typing import Any, TypeVar, overload
|
||||
from typing_extensions import Literal, SupportsIndex, TypeAlias, TypeGuard
|
||||
@@ -38,8 +38,8 @@ if sys.version_info >= (3, 9):
|
||||
__all__ += ["indent"]
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_FileRead: TypeAlias = StrOrBytesPath | FileDescriptor | SupportsRead[bytes] | SupportsRead[str]
|
||||
_FileWriteC14N: TypeAlias = StrOrBytesPath | FileDescriptor | SupportsWrite[bytes]
|
||||
_FileRead: TypeAlias = FileDescriptorOrPath | SupportsRead[bytes] | SupportsRead[str]
|
||||
_FileWriteC14N: TypeAlias = FileDescriptorOrPath | SupportsWrite[bytes]
|
||||
_FileWrite: TypeAlias = _FileWriteC14N | SupportsWrite[str]
|
||||
|
||||
VERSION: str
|
||||
|
||||
Reference in New Issue
Block a user