ovld 0.5.3__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 CHANGED
@@ -45,13 +45,22 @@ def transfer_function(
45
45
  globals=MISSING,
46
46
  name=MISSING,
47
47
  ):
48
- new_fn = FunctionType(
49
- argdefs=func.__defaults__ if argdefs is MISSING else argdefs,
50
- closure=func.__closure__ if closure is MISSING else closure,
51
- code=func.__code__ if code is MISSING else code,
52
- globals=func.__globals__ if globals is MISSING else globals,
53
- name=func.__name__ if name is MISSING else name,
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__)
@@ -161,6 +170,8 @@ class Code:
161
170
  elif isinstance(v, (list, tuple)):
162
171
  if any(isinstance(x, Code) for x in v):
163
172
  return [_rename_step(x) for x in v]
173
+ else:
174
+ return v
164
175
  else:
165
176
  return v
166
177
 
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 __builtins__ and __builtins__[name] != value
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.3"
1
+ version = "0.5.5"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ovld
3
- Version: 0.5.3
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.45|1.00|3.32|4.63|2.04|2.41|1.91|
257
- |[multer](https://github.com/breuleux/ovld/tree/master/benchmarks/test_multer.py)|1.13|1.00|11.05|4.53|8.31|2.19|7.32|
258
- |[add](https://github.com/breuleux/ovld/tree/master/benchmarks/test_add.py)|1.08|1.00|3.73|5.21|2.37|2.79|x|
259
- |[ast](https://github.com/breuleux/ovld/tree/master/benchmarks/test_ast.py)|1.00|1.08|23.14|3.09|1.68|1.91|1.66|
260
- |[calc](https://github.com/breuleux/ovld/tree/master/benchmarks/test_calc.py)|1.00|1.23|54.61|29.32|x|x|x|
261
- |[regexp](https://github.com/breuleux/ovld/tree/master/benchmarks/test_regexp.py)|1.00|1.87|19.18|x|x|x|x|
262
- |[fib](https://github.com/breuleux/ovld/tree/master/benchmarks/test_fib.py)|1.00|3.30|444.31|125.77|x|x|x|
263
- |[tweaknum](https://github.com/breuleux/ovld/tree/master/benchmarks/test_tweaknum.py)|1.00|2.09|x|x|x|x|x|
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=N8qgnpitPD8HEzNWQqmPw4MmSs3wdMsW9qoMo1jEhps,9247
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=MAPQUhZc3_AcLrU4jFQrkVu4nvMJJKiw10N7zFk5QPc,4294
14
- ovld/version.py,sha256=9iBSpgY-F4wj0t-upZDlLaji0_l-xTEqXo5_nwN8O1M,18
15
- ovld-0.5.3.dist-info/METADATA,sha256=2l6SNs5EFY56D3EvhxubpQ-mXoz21EUPLqcFb3JUeVg,9276
16
- ovld-0.5.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
- ovld-0.5.3.dist-info/licenses/LICENSE,sha256=cSwNTIzd1cbI89xt3PeZZYJP2y3j8Zus4bXgo4svpX8,1066
18
- ovld-0.5.3.dist-info/RECORD,,
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