|
7 | 7 | import types
|
8 | 8 | import typing
|
9 | 9 | from collections.abc import Callable, Iterable, Iterator, Mapping
|
10 |
| -from typing import Any, Literal, TypeVar, Union, get_type_hints, overload |
| 10 | +from typing import Any, Literal, NewType, TypeVar, Union, get_type_hints, overload |
11 | 11 |
|
12 | 12 |
|
13 |
| -class DispatchError(TypeError): |
14 |
| - pass |
| 13 | +class DispatchError(TypeError): ... |
15 | 14 |
|
16 | 15 |
|
17 | 16 | def get_origin(tp):
|
@@ -48,7 +47,7 @@ class subtype(abc.ABCMeta):
|
48 | 47 | def __new__(cls, tp, *args):
|
49 | 48 | if tp is Any:
|
50 | 49 | return object
|
51 |
| - if hasattr(tp, '__supertype__'): # isinstance(..., NewType) only supported >=3.10 |
| 50 | + if isinstance(tp, NewType): |
52 | 51 | return cls(tp.__supertype__, *args)
|
53 | 52 | if hasattr(typing, 'TypeAliasType') and isinstance(tp, typing.TypeAliasType):
|
54 | 53 | return cls(tp.__value__, *args)
|
@@ -414,8 +413,7 @@ class multimeta(type):
|
414 | 413 | """Convert all callables in namespace to multimethods."""
|
415 | 414 |
|
416 | 415 | class __prepare__(dict):
|
417 |
| - def __init__(*args): |
418 |
| - pass |
| 416 | + def __init__(*args): ... |
419 | 417 |
|
420 | 418 | def __setitem__(self, key, value):
|
421 | 419 | if callable(value):
|
|
0 commit comments