ovld 0.5.11__py3-none-any.whl → 0.5.13__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/medley.py CHANGED
@@ -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.impls:
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
- result = _self.impls[0](self, x, *args, **kwargs)
92
- for impl in _self.impls[1:]:
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
- self = _self.impls[0](self, *args, **kwargs)
103
- for impl in _self.impls[1:]:
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.extend(
367
- (f.name, f.type, remap_field(f)) for f in base.__dataclass_fields__.values()
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
  )
ovld/version.py CHANGED
@@ -1 +1 @@
1
- version = "0.5.11"
1
+ version = "0.5.13"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ovld
3
- Version: 0.5.11
3
+ Version: 0.5.13
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/
@@ -3,7 +3,7 @@ ovld/abc.py,sha256=4qpZyYwI8dWgY1Oiv5FhdKg2uzNcyWxIpGmGJVcjXrs,1177
3
3
  ovld/codegen.py,sha256=27tmamlanuTPDT-x31ISyqP0wGKW9BCFZJGVyq9qLg8,9728
4
4
  ovld/core.py,sha256=vVvaQppGZcccgRuxMkdQCr9jXrG9_xJn3ohyT0bIkEA,18251
5
5
  ovld/dependent.py,sha256=JIgsc_5ddPH51_2IrZ6JW6bWE5RyrrrOwR2e9UvDhZ4,8922
6
- ovld/medley.py,sha256=qiYUtMbYR-fzvmqfr7BDY2Ht3SbNOEJ9VaR7s-BNGRo,12962
6
+ ovld/medley.py,sha256=LO1sOFYJlcXAgLpZ571IPfO9ZEzk-zsBC0-vS3b-87o,13226
7
7
  ovld/mro.py,sha256=RxHoOpf5nIOD4yU-Bb0Zt5tFyral9zljaPDVGebnnJo,6218
8
8
  ovld/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  ovld/recode.py,sha256=vXg9XLExp_9LdAHO0JWR4wvwHhpOLu2Xcrg9ZYg1nms,16407
@@ -11,8 +11,8 @@ ovld/signatures.py,sha256=EXE5Jik8m-3UtkS1lgr3rl5QS7NRcJfuI3VRaU6v1bg,8960
11
11
  ovld/typemap.py,sha256=jcYiIPt8wVng0u7qdceEMt7i0gmlo7BMFbvHLkf6zD8,14092
12
12
  ovld/types.py,sha256=sP4xqx5jZ-gYnQ4LlvT5v7N8I1npNdKKZf72rBelvEA,13402
13
13
  ovld/utils.py,sha256=DJvmhYRZzy3ajdGvoQUNwskV3pe3uQjxPf4lf71ZzsA,5114
14
- ovld/version.py,sha256=Mv9x6du132E5c57DF5qnGJsOrAvDUy71sS1RpqZSerc,19
15
- ovld-0.5.11.dist-info/METADATA,sha256=MpACktITZEAA1nAoiIrl-d8T-M9bXdisE5gIuJtg1JM,10459
16
- ovld-0.5.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
- ovld-0.5.11.dist-info/licenses/LICENSE,sha256=cSwNTIzd1cbI89xt3PeZZYJP2y3j8Zus4bXgo4svpX8,1066
18
- ovld-0.5.11.dist-info/RECORD,,
14
+ ovld/version.py,sha256=yl-8osHxwqrMp2Io8GNQElDhnAkvlu0DlrQzGY5Dqyc,19
15
+ ovld-0.5.13.dist-info/METADATA,sha256=0HNcou96uT6RnmmO-14_ls0KPfqRn2Af0OUFmptZ1sE,10459
16
+ ovld-0.5.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
+ ovld-0.5.13.dist-info/licenses/LICENSE,sha256=cSwNTIzd1cbI89xt3PeZZYJP2y3j8Zus4bXgo4svpX8,1066
18
+ ovld-0.5.13.dist-info/RECORD,,
File without changes