ovld 0.5.4__py3-none-any.whl → 0.5.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/codegen.py +16 -7
- ovld/utils.py +5 -1
- ovld/version.py +1 -1
- {ovld-0.5.4.dist-info → ovld-0.5.5.dist-info}/METADATA +10 -10
- {ovld-0.5.4.dist-info → ovld-0.5.5.dist-info}/RECORD +7 -7
- {ovld-0.5.4.dist-info → ovld-0.5.5.dist-info}/WHEEL +0 -0
- {ovld-0.5.4.dist-info → ovld-0.5.5.dist-info}/licenses/LICENSE +0 -0
ovld/codegen.py
CHANGED
@@ -45,13 +45,22 @@ def transfer_function(
|
|
45
45
|
globals=MISSING,
|
46
46
|
name=MISSING,
|
47
47
|
):
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
48
|
+
closure = func.__closure__ if closure is MISSING else closure
|
49
|
+
if closure:
|
50
|
+
new_fn = FunctionType(
|
51
|
+
argdefs=func.__defaults__ if argdefs is MISSING else argdefs,
|
52
|
+
closure=func.__closure__ if closure is MISSING else closure,
|
53
|
+
code=func.__code__ if code is MISSING else code,
|
54
|
+
globals=func.__globals__ if globals is MISSING else globals,
|
55
|
+
name=func.__name__ if name is MISSING else name,
|
56
|
+
)
|
57
|
+
else:
|
58
|
+
new_fn = FunctionType(
|
59
|
+
argdefs=func.__defaults__ if argdefs is MISSING else argdefs,
|
60
|
+
code=func.__code__ if code is MISSING else code,
|
61
|
+
globals=func.__globals__ if globals is MISSING else globals,
|
62
|
+
name=func.__name__ if name is MISSING else name,
|
63
|
+
)
|
55
64
|
new_fn.__kwdefaults__ = func.__kwdefaults__
|
56
65
|
new_fn.__annotations__ = func.__annotations__
|
57
66
|
new_fn.__dict__.update(func.__dict__)
|
ovld/utils.py
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
"""Miscellaneous utilities."""
|
2
2
|
|
3
|
+
import builtins
|
3
4
|
import functools
|
4
5
|
import re
|
5
6
|
import typing
|
6
7
|
from itertools import count
|
7
8
|
|
9
|
+
_builtins_dict = vars(builtins)
|
10
|
+
|
11
|
+
|
8
12
|
try:
|
9
13
|
from types import UnionType
|
10
14
|
|
@@ -152,7 +156,7 @@ class NameDatabase:
|
|
152
156
|
i = 1
|
153
157
|
name = desired_name
|
154
158
|
while name in self.registered or (
|
155
|
-
name in
|
159
|
+
name in _builtins_dict and _builtins_dict[name] != value
|
156
160
|
):
|
157
161
|
name = f"{desired_name}{i}"
|
158
162
|
i += 1
|
ovld/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
version = "0.5.
|
1
|
+
version = "0.5.5"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ovld
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.5
|
4
4
|
Summary: Overloading Python functions
|
5
5
|
Project-URL: Homepage, https://ovld.readthedocs.io/en/latest/
|
6
6
|
Project-URL: Documentation, https://ovld.readthedocs.io/en/latest/
|
@@ -251,13 +251,13 @@ f3 = Total(punctuation="!", factor=3)
|
|
251
251
|
|
252
252
|
Time relative to the fastest implementation (1.00) (lower is better).
|
253
253
|
|
254
|
-
| Benchmark | custom | [ovld](https://github.com/breuleux/ovld) | [plum](https://github.com/beartype/plum) | [multim](https://github.com/coady/multimethod) | [multid](https://github.com/mrocklin/multipledispatch) | [runtype](https://github.com/erezsh/runtype) | [sd](https://docs.python.org/3/library/functools.html#functools.singledispatch) |
|
254
|
+
| Benchmark | custom | [ovld](https://github.com/breuleux/ovld) | [plum](https://github.com/beartype/plum) | [multim](https://github.com/coady/multimethod) | [multid](https://github.com/mrocklin/multipledispatch/) | [runtype](https://github.com/erezsh/runtype) | [sd](https://docs.python.org/3/library/functools.html#functools.singledispatch) |
|
255
255
|
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
|
256
|
-
|[trivial](https://github.com/breuleux/ovld/tree/master/benchmarks/test_trivial.py)|1.
|
257
|
-
|[multer](https://github.com/breuleux/ovld/tree/master/benchmarks/test_multer.py)|1.
|
258
|
-
|[add](https://github.com/breuleux/ovld/tree/master/benchmarks/test_add.py)|1.
|
259
|
-
|[ast](https://github.com/breuleux/ovld/tree/master/benchmarks/test_ast.py)|1.
|
260
|
-
|[calc](https://github.com/breuleux/ovld/tree/master/benchmarks/test_calc.py)|1.00|1.
|
261
|
-
|[regexp](https://github.com/breuleux/ovld/tree/master/benchmarks/test_regexp.py)|1.00|
|
262
|
-
|[fib](https://github.com/breuleux/ovld/tree/master/benchmarks/test_fib.py)|1.00|3.
|
263
|
-
|[tweaknum](https://github.com/breuleux/ovld/tree/master/benchmarks/test_tweaknum.py)|1.00|
|
256
|
+
|[trivial](https://github.com/breuleux/ovld/tree/master/benchmarks/test_trivial.py)|1.56|1.00|3.38|4.92|2.00|2.38|2.15|
|
257
|
+
|[multer](https://github.com/breuleux/ovld/tree/master/benchmarks/test_multer.py)|1.22|1.00|11.06|4.67|9.22|2.24|3.92|
|
258
|
+
|[add](https://github.com/breuleux/ovld/tree/master/benchmarks/test_add.py)|1.27|1.00|3.61|4.93|2.24|2.62|x|
|
259
|
+
|[ast](https://github.com/breuleux/ovld/tree/master/benchmarks/test_ast.py)|1.01|1.00|22.98|2.72|1.52|1.70|1.57|
|
260
|
+
|[calc](https://github.com/breuleux/ovld/tree/master/benchmarks/test_calc.py)|1.00|1.28|57.86|29.79|x|x|x|
|
261
|
+
|[regexp](https://github.com/breuleux/ovld/tree/master/benchmarks/test_regexp.py)|1.00|2.28|22.71|x|x|x|x|
|
262
|
+
|[fib](https://github.com/breuleux/ovld/tree/master/benchmarks/test_fib.py)|1.00|3.39|403.38|114.69|x|x|x|
|
263
|
+
|[tweaknum](https://github.com/breuleux/ovld/tree/master/benchmarks/test_tweaknum.py)|1.00|1.86|x|x|x|x|x||[tweaknum](https://github.com/breuleux/ovld/tree/master/benchmarks/test_tweaknum.py)|1.00|1.86|x|x|x|x|x|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
ovld/__init__.py,sha256=JuCM8Sj65gobV0KYyLr95cSI23Pi6RYZ7X3_F3fdsSw,1821
|
2
2
|
ovld/abc.py,sha256=4qpZyYwI8dWgY1Oiv5FhdKg2uzNcyWxIpGmGJVcjXrs,1177
|
3
|
-
ovld/codegen.py,sha256=
|
3
|
+
ovld/codegen.py,sha256=27tmamlanuTPDT-x31ISyqP0wGKW9BCFZJGVyq9qLg8,9728
|
4
4
|
ovld/core.py,sha256=HEREHblKcjM9dhFBr0FNwUCyec7o-9XjCsCfJ23SnNw,17544
|
5
5
|
ovld/dependent.py,sha256=h3j4oQYTQfGqMzggWlLV6TpojX_GtYRFWAO0GcMB0Zs,9085
|
6
6
|
ovld/medley.py,sha256=0fseIntzJRCPYXq-tmnxgy5ipNa4ZxR0D_6So0xstdQ,12729
|
@@ -10,9 +10,9 @@ ovld/recode.py,sha256=ZVqD3sCu_myaFj3lKPCMjFBf1pTdTAAd3NJdsqtLYuU,16434
|
|
10
10
|
ovld/signatures.py,sha256=Q8JucSOun0ESGx14aWtHtBzLEiM6FxY5HP3imyqXoDo,8984
|
11
11
|
ovld/typemap.py,sha256=5Pro1Ee60fH4L7NW7k5nbN5EfDygA0LFHcI6o3mCagI,13596
|
12
12
|
ovld/types.py,sha256=0hkhAR5_5793NABdrM-fP1dSJBhYof85FILKqVP2YMg,13392
|
13
|
-
ovld/utils.py,sha256=
|
14
|
-
ovld/version.py,sha256=
|
15
|
-
ovld-0.5.
|
16
|
-
ovld-0.5.
|
17
|
-
ovld-0.5.
|
18
|
-
ovld-0.5.
|
13
|
+
ovld/utils.py,sha256=fD20RWWGwI3Z8q5DvrdCPDA_Wm1uiyfCZLLL2IM9ZJw,4348
|
14
|
+
ovld/version.py,sha256=v9c8T1qB0Dxuq0vdkPvh2bpcAlRxlK4BxHPcACDymFw,18
|
15
|
+
ovld-0.5.5.dist-info/METADATA,sha256=K1dYchmA245qK_Kji4j7t-d8CTgriiem6JM_MnigdXM,9383
|
16
|
+
ovld-0.5.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
17
|
+
ovld-0.5.5.dist-info/licenses/LICENSE,sha256=cSwNTIzd1cbI89xt3PeZZYJP2y3j8Zus4bXgo4svpX8,1066
|
18
|
+
ovld-0.5.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|