ovld 0.5.11__tar.gz → 0.5.13__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.11 → ovld-0.5.13}/PKG-INFO +1 -1
- {ovld-0.5.11 → ovld-0.5.13}/pyproject.toml +1 -1
- {ovld-0.5.11 → ovld-0.5.13}/src/ovld/medley.py +20 -11
- ovld-0.5.13/src/ovld/version.py +1 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_medley.py +19 -0
- ovld-0.5.11/src/ovld/version.py +0 -1
- {ovld-0.5.11 → ovld-0.5.13}/.github/workflows/publish.yml +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/.github/workflows/python-package.yml +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/.gitignore +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/.python-version +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/.readthedocs.yaml +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/LICENSE +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/README.md +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/benchmarks/__init__.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/benchmarks/common.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/benchmarks/conftest.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/benchmarks/test_add.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/benchmarks/test_ast.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/benchmarks/test_calc.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/benchmarks/test_fib.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/benchmarks/test_multer.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/benchmarks/test_regexp.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/benchmarks/test_trivial.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/benchmarks/test_tweaknum.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/docs/codegen.md +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/docs/compare.md +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/docs/dependent.md +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/docs/features.md +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/docs/index.md +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/docs/medley.md +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/docs/types.md +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/docs/usage.md +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/mkdocs.yml +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/src/ovld/__init__.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/src/ovld/abc.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/src/ovld/codegen.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/src/ovld/core.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/src/ovld/dependent.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/src/ovld/mro.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/src/ovld/py.typed +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/src/ovld/recode.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/src/ovld/signatures.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/src/ovld/typemap.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/src/ovld/types.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/src/ovld/utils.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/__init__.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/modules/gingerbread.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_abc.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_codegen/test_dataclass_gen.txt +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_codegen/test_method.txt +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_codegen/test_method_metaclass.txt +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_codegen/test_method_per_instance.txt +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_codegen/test_simple.txt +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_codegen/test_variant_generation.txt +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_codegen.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_dependent.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_examples.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_global.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_mro.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_ovld/test_display.txt +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_ovld/test_display_more.txt +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_ovld/test_doc.txt +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_ovld/test_doc2.txt +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_ovld/test_method_doc.txt +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_ovld.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_typemap.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_types.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/tests/test_utils.py +0 -0
- {ovld-0.5.11 → ovld-0.5.13}/uv.lock +0 -0
@@ -57,8 +57,12 @@ class ImplList(Combiner):
|
|
57
57
|
super().__init__(field)
|
58
58
|
self.impls = impls or []
|
59
59
|
|
60
|
+
@property
|
61
|
+
def unique_impls(self):
|
62
|
+
return list({impl: True for impl in self.impls}.keys())
|
63
|
+
|
60
64
|
def copy(self):
|
61
|
-
return type(self)(self.field, self.impls)
|
65
|
+
return type(self)(self.field, list(self.impls))
|
62
66
|
|
63
67
|
def get(self, cls):
|
64
68
|
if not self.impls:
|
@@ -79,7 +83,7 @@ class ImplList(Combiner):
|
|
79
83
|
class RunAll(ImplList):
|
80
84
|
def wrap(_self):
|
81
85
|
def run_all(self, *args, **kwargs):
|
82
|
-
for impl in _self.
|
86
|
+
for impl in _self.unique_impls:
|
83
87
|
impl(self, *args, **kwargs)
|
84
88
|
|
85
89
|
return run_all
|
@@ -88,8 +92,9 @@ class RunAll(ImplList):
|
|
88
92
|
class ReduceAll(ImplList):
|
89
93
|
def wrap(_self):
|
90
94
|
def reduce_all(self, x, *args, **kwargs):
|
91
|
-
|
92
|
-
|
95
|
+
impls = _self.unique_impls
|
96
|
+
result = impls[0](self, x, *args, **kwargs)
|
97
|
+
for impl in impls[1:]:
|
93
98
|
result = impl(self, result, *args, **kwargs)
|
94
99
|
return result
|
95
100
|
|
@@ -99,8 +104,9 @@ class ReduceAll(ImplList):
|
|
99
104
|
class ChainAll(ImplList):
|
100
105
|
def wrap(_self):
|
101
106
|
def chain_all(self, *args, **kwargs):
|
102
|
-
|
103
|
-
|
107
|
+
impls = _self.unique_impls
|
108
|
+
self = impls[0](self, *args, **kwargs)
|
109
|
+
for impl in impls[1:]:
|
104
110
|
self = impl(self, *args, **kwargs)
|
105
111
|
return self
|
106
112
|
|
@@ -359,18 +365,21 @@ def meld_classes(classes):
|
|
359
365
|
return _meld_classes_cache[cache_key]
|
360
366
|
|
361
367
|
cg_fields = set()
|
362
|
-
dc_fields =
|
368
|
+
dc_fields = {}
|
363
369
|
|
364
370
|
for base in medleys:
|
365
371
|
cg_fields.update(base._ovld_codegen_fields)
|
366
|
-
dc_fields.
|
367
|
-
|
372
|
+
dc_fields.update(
|
373
|
+
{
|
374
|
+
(f.name, f.type): (f.name, f.type, remap_field(f))
|
375
|
+
for f in base.__dataclass_fields__.values()
|
376
|
+
}
|
368
377
|
)
|
369
378
|
|
370
379
|
merged = medley_cls_dict(medleys)
|
371
380
|
merged.set_direct("_ovld_codegen_fields", tuple(cg_fields))
|
372
381
|
merged.set_direct("_ovld_medleys", tuple(medleys))
|
373
|
-
merged.set_direct("__annotations__", {name: t for name, t, f in dc_fields})
|
382
|
+
merged.set_direct("__annotations__", {name: t for name, t, f in dc_fields.values()})
|
374
383
|
|
375
384
|
if "__qualname__" in merged._combiners:
|
376
385
|
del merged._combiners["__qualname__"]
|
@@ -378,7 +387,7 @@ def meld_classes(classes):
|
|
378
387
|
result = make_dataclass(
|
379
388
|
cls_name="+".join(sorted(c.__name__ for c in medleys)),
|
380
389
|
bases=medleys,
|
381
|
-
fields=dc_fields,
|
390
|
+
fields=list(dc_fields.values()),
|
382
391
|
kw_only=True,
|
383
392
|
namespace=merged,
|
384
393
|
)
|
@@ -0,0 +1 @@
|
|
1
|
+
version = "0.5.13"
|
@@ -572,3 +572,22 @@ def test_configure_dependent():
|
|
572
572
|
def test_configure_dependent_pileon():
|
573
573
|
m = Monkey(regex="chimpanze+") + Monkey(regex="go+rilla")
|
574
574
|
assert m.hi("goorilla") == "hello!"
|
575
|
+
|
576
|
+
|
577
|
+
class Bot(Medley):
|
578
|
+
a: int
|
579
|
+
|
580
|
+
|
581
|
+
class Mid1(Bot):
|
582
|
+
b: int
|
583
|
+
|
584
|
+
|
585
|
+
class Mid2(Bot):
|
586
|
+
c: int
|
587
|
+
|
588
|
+
|
589
|
+
def test_redundant_base():
|
590
|
+
synth = Mid1(a=1, b=2) + Mid2(a=3, c=4)
|
591
|
+
assert synth.a == 3
|
592
|
+
assert synth.b == 2
|
593
|
+
assert synth.c == 4
|
ovld-0.5.11/src/ovld/version.py
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
version = "0.5.11"
|
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
|
File without changes
|
File without changes
|
File without changes
|