ovld 0.4.3__py3-none-any.whl → 0.4.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ovld/__init__.py +1 -2
- ovld/abc.py +48 -0
- ovld/core.py +197 -214
- ovld/dependent.py +182 -74
- ovld/mro.py +30 -60
- ovld/recode.py +92 -90
- ovld/typemap.py +9 -31
- ovld/types.py +282 -72
- ovld/utils.py +72 -0
- ovld/version.py +1 -1
- {ovld-0.4.3.dist-info → ovld-0.4.5.dist-info}/METADATA +11 -10
- ovld-0.4.5.dist-info/RECORD +14 -0
- ovld-0.4.3.dist-info/RECORD +0 -13
- {ovld-0.4.3.dist-info → ovld-0.4.5.dist-info}/WHEEL +0 -0
- {ovld-0.4.3.dist-info → ovld-0.4.5.dist-info}/licenses/LICENSE +0 -0
ovld/__init__.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
from typing import TYPE_CHECKING
|
2
2
|
|
3
|
+
from . import abc # noqa: F401
|
3
4
|
from .core import (
|
4
5
|
Ovld,
|
5
6
|
OvldBase,
|
6
|
-
OvldCall,
|
7
7
|
OvldMC,
|
8
8
|
extend_super,
|
9
9
|
is_ovld,
|
@@ -52,7 +52,6 @@ __all__ = [
|
|
52
52
|
"MultiTypeMap",
|
53
53
|
"Ovld",
|
54
54
|
"OvldBase",
|
55
|
-
"OvldCall",
|
56
55
|
"OvldMC",
|
57
56
|
"TypeMap",
|
58
57
|
"extend_super",
|
ovld/abc.py
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
import typing
|
2
|
+
from collections.abc import Callable, Collection, Mapping, Sequence
|
3
|
+
|
4
|
+
from .dependent import Callable as OvldCallable
|
5
|
+
from .dependent import (
|
6
|
+
CollectionFastCheck,
|
7
|
+
Equals,
|
8
|
+
MappingFastCheck,
|
9
|
+
ProductType,
|
10
|
+
SequenceFastCheck,
|
11
|
+
)
|
12
|
+
from .types import normalize_type
|
13
|
+
|
14
|
+
|
15
|
+
@normalize_type.register_generic(typing.Literal)
|
16
|
+
def _(self, t, fn):
|
17
|
+
return Equals[t.__args__]
|
18
|
+
|
19
|
+
|
20
|
+
@normalize_type.register_generic(tuple)
|
21
|
+
def _(self, t, fn):
|
22
|
+
args = tuple(self(arg, fn) for arg in t.__args__)
|
23
|
+
return ProductType[args]
|
24
|
+
|
25
|
+
|
26
|
+
@normalize_type.register_generic(Sequence)
|
27
|
+
def _(self, t, fn):
|
28
|
+
args = tuple(self(arg, fn) for arg in t.__args__)
|
29
|
+
return SequenceFastCheck[args]
|
30
|
+
|
31
|
+
|
32
|
+
@normalize_type.register_generic(Collection)
|
33
|
+
def _(self, t, fn):
|
34
|
+
args = tuple(self(arg, fn) for arg in t.__args__)
|
35
|
+
return CollectionFastCheck[args]
|
36
|
+
|
37
|
+
|
38
|
+
@normalize_type.register_generic(Mapping)
|
39
|
+
def _(self, t, fn):
|
40
|
+
args = tuple(self(arg, fn) for arg in t.__args__)
|
41
|
+
return MappingFastCheck[args]
|
42
|
+
|
43
|
+
|
44
|
+
@normalize_type.register_generic(Callable)
|
45
|
+
def _(self, t, fn):
|
46
|
+
*at, rt = t.__args__
|
47
|
+
at = tuple(self(arg, fn) for arg in at)
|
48
|
+
return OvldCallable[at, self(rt, fn)]
|