ovld 0.5.2__tar.gz → 0.5.4__tar.gz
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-0.5.2 → ovld-0.5.4}/PKG-INFO +1 -1
- {ovld-0.5.2 → ovld-0.5.4}/pyproject.toml +2 -2
- {ovld-0.5.2 → ovld-0.5.4}/src/ovld/codegen.py +3 -0
- {ovld-0.5.2 → ovld-0.5.4}/src/ovld/core.py +4 -1
- {ovld-0.5.2 → ovld-0.5.4}/src/ovld/utils.py +2 -2
- ovld-0.5.4/src/ovld/version.py +1 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_codegen.py +6 -0
- ovld-0.5.2/src/ovld/version.py +0 -1
- {ovld-0.5.2 → ovld-0.5.4}/.github/workflows/publish.yml +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/.github/workflows/python-package.yml +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/.gitignore +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/.python-version +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/.readthedocs.yaml +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/LICENSE +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/README.md +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/benchmarks/__init__.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/benchmarks/common.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/benchmarks/test_add.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/benchmarks/test_ast.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/benchmarks/test_calc.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/benchmarks/test_fib.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/benchmarks/test_multer.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/benchmarks/test_regexp.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/benchmarks/test_trivial.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/benchmarks/test_tweaknum.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/docs/codegen.md +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/docs/compare.md +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/docs/dependent.md +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/docs/features.md +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/docs/index.md +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/docs/medley.md +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/docs/types.md +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/docs/usage.md +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/mkdocs.yml +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/src/ovld/__init__.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/src/ovld/abc.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/src/ovld/dependent.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/src/ovld/medley.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/src/ovld/mro.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/src/ovld/py.typed +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/src/ovld/recode.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/src/ovld/signatures.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/src/ovld/typemap.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/src/ovld/types.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/__init__.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/modules/gingerbread.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_abc.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_codegen/test_dataclass_gen.txt +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_codegen/test_method.txt +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_codegen/test_method_metaclass.txt +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_codegen/test_method_per_instance.txt +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_codegen/test_simple.txt +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_codegen/test_variant_generation.txt +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_dependent.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_examples.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_global.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_medley.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_mro.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_ovld/test_display.txt +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_ovld/test_display_more.txt +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_ovld/test_doc.txt +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_ovld/test_doc2.txt +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_ovld/test_method_doc.txt +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_ovld.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_typemap.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_types.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/tests/test_utils.py +0 -0
- {ovld-0.5.2 → ovld-0.5.4}/uv.lock +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "ovld"
|
3
|
-
version = "0.5.
|
3
|
+
version = "0.5.4"
|
4
4
|
description = "Overloading Python functions"
|
5
5
|
authors = [
|
6
6
|
{ name = "Olivier Breuleux", email = "breuleux@gmail.com" }
|
@@ -32,7 +32,7 @@ benchmark = [
|
|
32
32
|
"multimethod>=1.12",
|
33
33
|
"multipledispatch>=1.0.0",
|
34
34
|
"plum-dispatch>=2.5.2",
|
35
|
-
"runtype>=0.5.
|
35
|
+
"runtype>=0.5.4",
|
36
36
|
]
|
37
37
|
|
38
38
|
[tool.hatch.build.targets.wheel]
|
@@ -161,6 +161,8 @@ class Code:
|
|
161
161
|
elif isinstance(v, (list, tuple)):
|
162
162
|
if any(isinstance(x, Code) for x in v):
|
163
163
|
return [_rename_step(x) for x in v]
|
164
|
+
else:
|
165
|
+
return v
|
164
166
|
else:
|
165
167
|
return v
|
166
168
|
|
@@ -295,6 +297,7 @@ def codegen_specializer(typemap, fn, tup):
|
|
295
297
|
adjusted_name = f"{fn.__name__.split('[')[0]}[{sigstring(tup)}]"
|
296
298
|
func = rename_function(func, adjusted_name)
|
297
299
|
func.__codegen__ = cg
|
300
|
+
func.__orig_name__ = fn.__name__
|
298
301
|
return func
|
299
302
|
|
300
303
|
|
@@ -169,7 +169,10 @@ class Ovld:
|
|
169
169
|
else:
|
170
170
|
hlp = ""
|
171
171
|
for c in possibilities:
|
172
|
-
|
172
|
+
hn = getattr(c.handler, "__orig_name__", c.handler.__name__)
|
173
|
+
hlp += (
|
174
|
+
f"* {hn} (priority: {c.priority}, specificity: {list(c.specificity)})\n"
|
175
|
+
)
|
173
176
|
return ResolutionError(
|
174
177
|
f"Ambiguous resolution in {self} for"
|
175
178
|
f" argument types [{typenames}]\n"
|
@@ -106,7 +106,7 @@ def clsstring(cls):
|
|
106
106
|
return f"{origin.__name__}[{args}]"
|
107
107
|
else:
|
108
108
|
r = repr(cls)
|
109
|
-
if r.startswith("<class "):
|
109
|
+
if r.startswith("<class ") or r.startswith("<enum "):
|
110
110
|
return cls.__name__
|
111
111
|
else:
|
112
112
|
return r
|
@@ -160,7 +160,7 @@ class NameDatabase:
|
|
160
160
|
return name
|
161
161
|
|
162
162
|
def get(self, value, suggested_name=None):
|
163
|
-
if
|
163
|
+
if type(value) in (int, float, str):
|
164
164
|
return repr(value)
|
165
165
|
if id(value) in self.names:
|
166
166
|
return self.names[id(value)]
|
@@ -0,0 +1 @@
|
|
1
|
+
version = "0.5.4"
|
@@ -231,6 +231,11 @@ class TwoPoints:
|
|
231
231
|
b: Point
|
232
232
|
|
233
233
|
|
234
|
+
@dataclass
|
235
|
+
class Empty:
|
236
|
+
pass
|
237
|
+
|
238
|
+
|
234
239
|
@pytest.mark.skipif(sys.version_info < (3, 10), reason="Requires Python 3.10+ for UnionType")
|
235
240
|
def test_inlining_generator():
|
236
241
|
from types import UnionType
|
@@ -289,6 +294,7 @@ def test_inlining_generator():
|
|
289
294
|
assert f(TwoPoints, TwoPoints(Point(1, 2), Point(7, 8))) == TwoPoints(
|
290
295
|
Point(2, 3), Point(8, 9)
|
291
296
|
)
|
297
|
+
assert f(Empty, Empty()) == Empty()
|
292
298
|
|
293
299
|
|
294
300
|
def test_scoped_subcodes():
|
ovld-0.5.2/src/ovld/version.py
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
version = "0.5.2"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|