|
39 | 39 | from asyncio import FIRST_COMPLETED, AbstractEventLoop, Task |
40 | 40 | from collections import UserDict, defaultdict |
41 | 41 | from collections.abc import (AsyncGenerator, Awaitable, Collection, Generator, |
42 | | - Hashable, Iterable, Iterator, KeysView, Mapping) |
| 42 | + Hashable, Iterable, Iterator, KeysView, Mapping, |
| 43 | + Sequence) |
43 | 44 | from concurrent.futures.process import ProcessPoolExecutor |
44 | 45 | from dataclasses import dataclass, field |
45 | 46 | from functools import cache, lru_cache, partial, wraps |
46 | 47 | from types import MappingProxyType |
47 | 48 | from typing import (TYPE_CHECKING, Any, Callable, Generic, Literal, NamedTuple, |
48 | | - Optional, Sequence, Tuple, Type, TypeVar, Union, cast, |
49 | | - overload) |
| 49 | + Optional, TypeVar, Union, cast, overload) |
50 | 50 | from urllib.parse import urlparse |
51 | 51 | from uuid import uuid4 |
52 | 52 |
|
@@ -1921,9 +1921,9 @@ def __len__(self): |
1921 | 1921 | return len(self._factory) |
1922 | 1922 |
|
1923 | 1923 |
|
1924 | | -class ClassRegistry(UserDict[Type[T], _V]): |
| 1924 | +class ClassRegistry(UserDict[type[T], _V]): |
1925 | 1925 |
|
1926 | | - def __getitem__(self, key: Type[T]) -> _V: |
| 1926 | + def __getitem__(self, key: type[T]) -> _V: |
1927 | 1927 | for cls in key.mro(): |
1928 | 1928 | if cls in self.data: |
1929 | 1929 | return self.data[cls] |
@@ -2234,7 +2234,7 @@ def direct_register_custom_op( |
2234 | 2234 | fake_impl: Optional[Callable] = None, |
2235 | 2235 | target_lib: Optional[Library] = None, |
2236 | 2236 | dispatch_key: str = "CUDA", |
2237 | | - tags: Tuple[torch.Tag, ...] = (), |
| 2237 | + tags: tuple[torch.Tag, ...] = (), |
2238 | 2238 | ): |
2239 | 2239 | """ |
2240 | 2240 | `torch.library.custom_op` can have significant overhead because it |
@@ -2489,7 +2489,7 @@ def get_exception_traceback(): |
2489 | 2489 | return err_str |
2490 | 2490 |
|
2491 | 2491 |
|
2492 | | -def split_zmq_path(path: str) -> Tuple[str, str, str]: |
| 2492 | +def split_zmq_path(path: str) -> tuple[str, str, str]: |
2493 | 2493 | """Split a zmq path into its parts.""" |
2494 | 2494 | parsed = urlparse(path) |
2495 | 2495 | if not parsed.scheme: |
|
0 commit comments