@@ -5468,13 +5468,21 @@ class Tholder:
5468
5468
The b64 portion of limen with code stripped (Bexter.bext) of
5469
5469
[["1/2", "1/2", "1/4", "1/4", "1/4"], ["1", "1"]]
5470
5470
is '1s2c1s2c1s4c1s4c1s4a1c1' basically slash is 's', comma is 'c',
5471
- and ANDed clauses are delimited by 'a'.
5471
+ ANDed clauses are delimited by 'a'.
5472
+ Each clause top level weight may be optionally a weighted set of weights
5473
+ delimited by 'k' for the weight on the set and 'v' for the weights in
5474
+ the set.
5475
+ [[{'1/3': ['1/2', '1/2', '1/2']}, '1/2', {'1/2': ['1', '1']}],
5476
+ ['1/2', {'1/2': ['1', '1']}]]
5477
+ b'4AAKA1s3k1s2v1s2v1s2c1s2c1s2k1v1a1s2c1s2k1v1'
5478
+
5472
5479
5473
5480
.sith is original signing threshold suitable for value to be serialized
5474
5481
as json, cbor, mgpk in key event message as either:
5475
5482
non-negative hex number str or
5476
5483
list of str rational number fractions >= 0 and <= 1 or
5477
5484
list of list of str rational number fractions >= 0 and <= 1
5485
+ list of list of weighted map of weights
5478
5486
5479
5487
.thold is parsed signing threshold suitable for calculating satisfaction.
5480
5488
either as int or list of Fractions
@@ -5527,8 +5535,10 @@ def __init__(self, *, thold=None , limen=None, sith=None, **kwa):
5527
5535
the satisfaction of a threshold and is expressed as either:
5528
5536
int of threshold number (M of N)
5529
5537
fractional weight clauses which may be expressed as either:
5530
- an iterable of Fractions or
5531
- an iterable of iterables of Fractions.
5538
+ sequence of either Fractions or tuples of Fraction and
5539
+ sequence of Fractions
5540
+ sequence of sequence of either Fractions or tuples of
5541
+ Fraction and sequence of Fractions
5532
5542
5533
5543
limen is qualified signing threshold (current or next) expressed as either:
5534
5544
Number.qb64 or .qb64b of integer threshold or
@@ -5542,11 +5552,17 @@ def __init__(self, *, thold=None , limen=None, sith=None, **kwa):
5542
5552
non-negative hex string of threshold number (M-of-N threshold)
5543
5553
next threshold may be zero
5544
5554
fractional weight clauses which may be expressed as either:
5545
- an sequence of rational number fraction strings >= 0 and <= 1
5546
- an sequence of sequences of rational number fraction strings >= 0 and <= 1
5547
- JSON serialized str of either:
5548
- list of rational number fraction strings >= 0 and <= 1 or
5549
- list of list of rational number fraction strings >= 0 and <= 1
5555
+ sequence of rational number fraction strings >= 0 and <= 1
5556
+ sequence of either rational number fraction strings >= 0 and <= 1 or
5557
+ map with key rational number string and value as sequence
5558
+ of rational number fraction strings
5559
+ rational number fraction string
5560
+ sequence of sequences of rational number fraction strings >= 0 and <= 1
5561
+ sequence of sequnces of either rational number fraction strings or
5562
+ map with key rational number fraction string with value sequence of
5563
+ rationaly number fraction strings
5564
+ JSON serialized str of the above:
5565
+
5550
5566
5551
5567
"""
5552
5568
if thold is not None :
@@ -5674,7 +5690,6 @@ def _processLimen(self, limen: str | bytes, **kwa):
5674
5690
5675
5691
thold .append (clause )
5676
5692
5677
- #thold = [[self.weight(w) for w in clause] for clause in thold]
5678
5693
self ._processWeighted (thold = thold )
5679
5694
5680
5695
else :
@@ -5829,11 +5844,6 @@ def _processWeighted(self, thold=[]):
5829
5844
ta .append (bc )
5830
5845
5831
5846
bext = "a" .join (["c" .join (bc ) for bc in ta ])
5832
-
5833
- #bext = [[f"{f.numerator}s{f.denominator}" if (0 < f < 1) else f"{int(f)}"
5834
- #for f in clause]
5835
- #for clause in thold]
5836
- #bext = "a".join(["c".join(clause) for clause in bext])
5837
5847
self ._number = None
5838
5848
self ._bexter = Bexter (bext = bext )
5839
5849
@@ -5935,15 +5945,6 @@ def _satisfy_weighted(self, indices):
5935
5945
if cw < 1 : # each clause must sum to at least 1
5936
5946
return False
5937
5947
5938
- #for clause in self.thold:
5939
- #cw = 0 # init clause weight
5940
- #for w in clause:
5941
- #if sats[wio]: # verified signature so weight applies
5942
- #cw += w
5943
- #wio += 1
5944
- #if cw < 1: # each clause must sum to at least 1
5945
- #return False
5946
-
5947
5948
return True # all clauses have cw >= 1 including final one, AND true
5948
5949
5949
5950
except Exception as ex :
0 commit comments