mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Revert "[BE]: Update Typeguard to TypeIs for better type inference (#133814)"
This reverts commit bce0caba7804b0787684dbf1f4e1c4d9e3acded5. Reverted https://github.com/pytorch/pytorch/pull/133814 on behalf of https://github.com/ezyang due to root cause of internal failures not addressed ([comment](https://github.com/pytorch/pytorch/pull/133814#issuecomment-2302466444))
This commit is contained in:
@ -27,7 +27,7 @@ from typing import (
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
from typing_extensions import TypeAlias, TypeIs
|
||||
from typing_extensions import TypeAlias, TypeGuard # Python 3.10+
|
||||
|
||||
import torch
|
||||
import torch._weights_only_unpickler as _weights_only_unpickler
|
||||
@ -549,7 +549,7 @@ def storage_to_tensor_type(storage):
|
||||
return getattr(module, storage_type.__name__.replace("Storage", "Tensor"))
|
||||
|
||||
|
||||
def _is_path(name_or_buffer) -> TypeIs[Union[str, os.PathLike]]:
|
||||
def _is_path(name_or_buffer) -> TypeGuard[Union[str, os.PathLike]]:
|
||||
return isinstance(name_or_buffer, (str, os.PathLike))
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user