minor type fix
This commit is contained in:
parent
844dacf989
commit
5caa219ead
4
plot.py
4
plot.py
@ -1,5 +1,6 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
@ -32,7 +33,7 @@ def plot(fn: str):
|
||||
plt.ylabel('concurrency (1)')
|
||||
|
||||
with open(fn) as file:
|
||||
jsonified: dict[str] = json.load(file)
|
||||
jsonified: dict[str, Any] = json.load(file)
|
||||
|
||||
title = fn
|
||||
if (params := jsonified.pop('params', None)) is not None:
|
||||
@ -52,6 +53,7 @@ def plot(fn: str):
|
||||
logplot(plt.scatter, 'ActiveBinaryTree:add:exit', c='gold', zorder=99, s=.5)
|
||||
|
||||
plt.legend()
|
||||
plt.savefig(f'{fn}.png')
|
||||
plt.show()
|
||||
plt.clf()
|
||||
|
||||
|
@ -5,7 +5,7 @@ from rainbowadn.core import *
|
||||
|
||||
__all__ = ('Atomic',)
|
||||
|
||||
AtomicMentioned = TypeVar('AtomicMentioned')
|
||||
AtomicMentioned = TypeVar('AtomicMentioned', bound='Atomic')
|
||||
|
||||
|
||||
class Atomic(StaticMentionable, abc.ABC):
|
||||
|
@ -1,10 +1,11 @@
|
||||
from typing import Generic, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
from rainbowadn.nullability import *
|
||||
|
||||
__all__ = ('CollectionInterface',)
|
||||
|
||||
CollectionType = TypeVar('CollectionType')
|
||||
CollectionType = TypeVar('CollectionType', bound=Mentionable, covariant=True)
|
||||
|
||||
|
||||
class CollectionInterface(
|
||||
|
@ -5,7 +5,10 @@ __all__ = (
|
||||
'PlainComparator',
|
||||
)
|
||||
|
||||
from .comparator import Comparator, Comparison, Duplicate, Equal, Fail, Left, Replace, Right
|
||||
from .comparator import (
|
||||
Comparator, Comparison, Duplicate, Equal, Fail, Left,
|
||||
Replace, Right
|
||||
)
|
||||
from .hashcomparator import HashComparator
|
||||
from .keyedcomparator import KeyedComparator
|
||||
from .plaincomparator import PlainComparator
|
||||
|
@ -36,7 +36,7 @@ class Duplicate(Equal):
|
||||
pass
|
||||
|
||||
|
||||
KeyType = TypeVar('KeyType')
|
||||
KeyType = TypeVar('KeyType', bound=Mentionable, contravariant=True)
|
||||
|
||||
|
||||
class Comparator(Generic[KeyType]):
|
||||
|
@ -1,12 +1,13 @@
|
||||
from typing import Generic, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .comparator import *
|
||||
from .protocolcomparator import *
|
||||
|
||||
__all__ = ('HashComparator',)
|
||||
|
||||
KeyType = TypeVar('KeyType')
|
||||
KeyType = TypeVar('KeyType', bound=Mentionable, contravariant=True)
|
||||
|
||||
|
||||
class HashComparator(ProtocolComparator[KeyType], Generic[KeyType]):
|
||||
|
@ -2,11 +2,12 @@ from typing import Generic, TypeVar
|
||||
|
||||
from rainbowadn.collection.keyed import *
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .comparator import *
|
||||
|
||||
__all__ = ('KeyedComparator',)
|
||||
|
||||
ComparatorKeyType = TypeVar('ComparatorKeyType')
|
||||
ComparatorKeyType = TypeVar('ComparatorKeyType', bound=Mentionable, contravariant=True)
|
||||
|
||||
|
||||
class KeyedComparator(
|
||||
|
@ -1,5 +1,6 @@
|
||||
from rainbowadn.atomic import *
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .comparator import *
|
||||
from .protocolcomparator import *
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
import abc
|
||||
from typing import Generic, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .comparator import *
|
||||
|
||||
__all__ = ('ProtocolComparator',)
|
||||
|
||||
KeyType = TypeVar('KeyType')
|
||||
KeyType = TypeVar('KeyType', bound=Mentionable, contravariant=True)
|
||||
|
||||
|
||||
class ProtocolComparator(Comparator[KeyType], abc.ABC, Generic[KeyType]):
|
||||
|
@ -5,7 +5,7 @@ from rainbowadn.core import *
|
||||
|
||||
__all__ = ('Keyed',)
|
||||
|
||||
KKeyType = TypeVar('KKeyType')
|
||||
KKeyType = TypeVar('KKeyType', bound=Mentionable, covariant=True)
|
||||
|
||||
|
||||
class Keyed(RecursiveMentionable, Generic[KKeyType], abc.ABC):
|
||||
|
@ -1,12 +1,13 @@
|
||||
from typing import Generic, Iterable, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .keyed import *
|
||||
|
||||
__all__ = ('KeyMetadata', 'KeyMetadataFactory',)
|
||||
|
||||
ActiveKeyType = TypeVar('ActiveKeyType')
|
||||
MetaDataType = TypeVar('MetaDataType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable, covariant=True)
|
||||
MetaDataType = TypeVar('MetaDataType', bound=Mentionable, covariant=True)
|
||||
|
||||
|
||||
class KeyMetadata(Keyed[ActiveKeyType], Generic[ActiveKeyType, MetaDataType]):
|
||||
|
@ -2,12 +2,13 @@ from typing import Generic, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
from rainbowadn.inlining import *
|
||||
|
||||
from .keyed import *
|
||||
|
||||
__all__ = ('KeyValue',)
|
||||
|
||||
KVKeyType = TypeVar('KVKeyType')
|
||||
KVValueType = TypeVar('KVValueType')
|
||||
KVKeyType = TypeVar('KVKeyType', bound=Mentionable)
|
||||
KVValueType = TypeVar('KVValueType', bound=Mentionable)
|
||||
|
||||
|
||||
class KeyValue(Keyed[KVKeyType], IAuto, Generic[KVKeyType, KVValueType]):
|
||||
@ -36,6 +37,7 @@ class KeyValue(Keyed[KVKeyType], IAuto, Generic[KVKeyType, KVValueType]):
|
||||
def f(
|
||||
cls, f0: RainbowFactory[KVKeyType], f1: RainbowFactory[KVValueType]
|
||||
) -> RainbowFactory['KeyValue[KVKeyType, KVValueType]']:
|
||||
assert issubclass(cls, KeyValue)
|
||||
assert isinstance(f0, RainbowFactory)
|
||||
assert isinstance(f1, RainbowFactory)
|
||||
return cls.auto_f(f0, f1)
|
||||
|
@ -3,5 +3,5 @@ __all__ = (
|
||||
'TLRoot', 'TLRootFactory', 'TLRParametres',
|
||||
)
|
||||
|
||||
from .array import Array, ArrayFactory
|
||||
from .treelist import TLRParametres, TLRoot, TLRootFactory
|
||||
from ._array import Array, ArrayFactory
|
||||
from .treelist import TLRoot, TLRootFactory, TLRParametres
|
||||
|
@ -4,7 +4,7 @@ from rainbowadn.core import *
|
||||
|
||||
__all__ = ('Array', 'ArrayFactory',)
|
||||
|
||||
ElementType = TypeVar('ElementType')
|
||||
ElementType = TypeVar('ElementType', bound=Mentionable, covariant=True)
|
||||
|
||||
|
||||
class Array(RecursiveMentionable, Generic[ElementType]):
|
@ -1,11 +1,12 @@
|
||||
from typing import Generic, Iterable, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .tlparametres import *
|
||||
|
||||
__all__ = ('TLNode', 'TLNodeFactory',)
|
||||
|
||||
ElementType = TypeVar('ElementType')
|
||||
ElementType = TypeVar('ElementType', bound=Mentionable)
|
||||
|
||||
|
||||
class TLNode(RecursiveMentionable, Generic[ElementType]):
|
||||
@ -101,9 +102,10 @@ class TLNode(RecursiveMentionable, Generic[ElementType]):
|
||||
return await self.node_no_resolved(self.nodes - 1)
|
||||
|
||||
async def add(self, element: HashPoint[ElementType]) -> 'TLNode[ElementType]':
|
||||
assert isinstance(self, TLNode)
|
||||
assert isinstance(element, HashPoint)
|
||||
if self.parametres.full:
|
||||
self_hp = HashPoint.of(self)
|
||||
self_hp: HashPoint[TLNode[ElementType]] = HashPoint.of(self)
|
||||
assert isinstance(self_hp, HashPoint)
|
||||
unit = self.unit(element)
|
||||
assert isinstance(unit, TLNode)
|
||||
@ -112,7 +114,7 @@ class TLNode(RecursiveMentionable, Generic[ElementType]):
|
||||
return TLNode(
|
||||
bytes(self_hp) + bytes(unit_hp),
|
||||
self.parametres.superparams(),
|
||||
(LocalMetaOrigin(self_hp.origin), LocalMetaOrigin(unit_hp.origin)),
|
||||
(LocalMetaOrigin(self_hp.origin), LocalMetaOrigin(unit_hp.origin),),
|
||||
(),
|
||||
)
|
||||
elif self.parametres.leaf:
|
||||
|
@ -1,10 +1,12 @@
|
||||
from typing import Generic, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .tlrparametres import *
|
||||
|
||||
__all__ = ('TLParametres',)
|
||||
|
||||
ElementType = TypeVar('ElementType')
|
||||
ElementType = TypeVar('ElementType', bound=Mentionable)
|
||||
|
||||
|
||||
class TLParametres(
|
||||
|
@ -2,13 +2,14 @@ from typing import Generic, Iterable, TypeVar
|
||||
|
||||
from rainbowadn.atomic import *
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .tlnode import *
|
||||
from .tlparametres import *
|
||||
from .tlrparametres import *
|
||||
|
||||
__all__ = ('TLRoot', 'TLRootFactory',)
|
||||
|
||||
ElementType = TypeVar('ElementType')
|
||||
ElementType = TypeVar('ElementType', bound=Mentionable)
|
||||
|
||||
|
||||
class TLRoot(RecursiveMentionable, Generic[ElementType]):
|
||||
|
@ -4,7 +4,7 @@ from rainbowadn.core import *
|
||||
|
||||
__all__ = ('TLRParametres',)
|
||||
|
||||
ElementType = TypeVar('ElementType')
|
||||
ElementType = TypeVar('ElementType', bound=Mentionable)
|
||||
|
||||
|
||||
class TLRParametres(
|
||||
|
@ -7,5 +7,8 @@ __all__ = (
|
||||
|
||||
from .binaryaction import BinaryAction
|
||||
from .compareaction import CompareAction
|
||||
from .stdactions import AddAction, ContainsAction, MergeAction, RemoveAction, SplitAction, UnionAction
|
||||
from .stdactions import (
|
||||
AddAction, ContainsAction, MergeAction, RemoveAction,
|
||||
SplitAction, UnionAction
|
||||
)
|
||||
from .symmetric import InnerOuter, OuterInner, Symmetric
|
||||
|
@ -1,12 +1,13 @@
|
||||
from typing import Generic, TypeVar
|
||||
|
||||
from rainbowadn.collection.trees.binary.core import *
|
||||
from rainbowadn.core import *
|
||||
|
||||
__all__ = ('BinaryAction',)
|
||||
|
||||
TreeType = TypeVar('TreeType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType')
|
||||
MetaDataType = TypeVar('MetaDataType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
|
||||
MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
|
||||
ActionType = TypeVar('ActionType')
|
||||
|
||||
|
||||
|
@ -4,13 +4,14 @@ from typing import Generic, TypeVar
|
||||
from rainbowadn.collection.comparison import *
|
||||
from rainbowadn.collection.trees.binary.core import *
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .binaryaction import *
|
||||
|
||||
__all__ = ('CompareAction',)
|
||||
|
||||
TreeType = TypeVar('TreeType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType')
|
||||
MetaDataType = TypeVar('MetaDataType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
|
||||
MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
|
||||
ActionType = TypeVar('ActionType')
|
||||
|
||||
|
||||
|
@ -3,14 +3,15 @@ from typing import Generic, TypeVar
|
||||
from rainbowadn.collection.comparison import *
|
||||
from rainbowadn.collection.trees.binary.core import *
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .binaryaction import *
|
||||
from .compareaction import *
|
||||
|
||||
__all__ = ('AddAction', 'RemoveAction', 'ContainsAction', 'SplitAction', 'UnionAction', 'MergeAction',)
|
||||
|
||||
TreeType = TypeVar('TreeType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType')
|
||||
MetaDataType = TypeVar('MetaDataType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
|
||||
MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
|
||||
|
||||
|
||||
class AddAction(
|
||||
|
@ -6,8 +6,8 @@ from rainbowadn.core import *
|
||||
__all__ = ('Symmetric', 'InnerOuter', 'OuterInner',)
|
||||
|
||||
TreeType = TypeVar('TreeType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType')
|
||||
MetaDataType = TypeVar('MetaDataType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
|
||||
MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
|
||||
|
||||
|
||||
class Symmetric(
|
||||
@ -55,7 +55,10 @@ class Symmetric(
|
||||
return BinaryProtocolized(self.protocol, self.outer(split))
|
||||
|
||||
|
||||
class InnerOuter(Symmetric):
|
||||
class InnerOuter(
|
||||
Symmetric[ActiveKeyType, MetaDataType, TreeType],
|
||||
Generic[ActiveKeyType, MetaDataType, TreeType]
|
||||
):
|
||||
def inner(
|
||||
self,
|
||||
split: BinarySplit[ActiveKeyType, MetaDataType, TreeType]
|
||||
@ -80,7 +83,10 @@ class InnerOuter(Symmetric):
|
||||
return await self.protocol.tree(inner, outer, key)
|
||||
|
||||
|
||||
class OuterInner(Symmetric):
|
||||
class OuterInner(
|
||||
Symmetric[ActiveKeyType, MetaDataType, TreeType],
|
||||
Generic[ActiveKeyType, MetaDataType, TreeType]
|
||||
):
|
||||
def inner(
|
||||
self,
|
||||
split: BinarySplit[ActiveKeyType, MetaDataType, TreeType]
|
||||
|
@ -4,14 +4,15 @@ from rainbowadn.collection.collectioninterface import *
|
||||
from rainbowadn.collection.keymetadata import *
|
||||
from rainbowadn.core import *
|
||||
from rainbowadn.nullability import *
|
||||
|
||||
from .actions import *
|
||||
from .binarytree import *
|
||||
from .core import *
|
||||
|
||||
__all__ = ('ActiveBinaryTree',)
|
||||
|
||||
ActiveKeyType = TypeVar('ActiveKeyType')
|
||||
MetaDataType = TypeVar('MetaDataType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
|
||||
MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
|
||||
|
||||
|
||||
class ActiveBinaryTree(
|
||||
|
@ -3,12 +3,13 @@ from typing import Generic, Optional, TypeVar
|
||||
from rainbowadn.atomic import *
|
||||
from rainbowadn.collection.comparison import *
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .actions import *
|
||||
from .core import *
|
||||
|
||||
__all__ = ('AVL',)
|
||||
|
||||
ActiveKeyType = TypeVar('ActiveKeyType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
|
||||
TreeType = TypeVar('TreeType')
|
||||
|
||||
|
||||
@ -138,11 +139,11 @@ class BalanceAction(
|
||||
delta = height_l - height_r
|
||||
assert isinstance(delta, int)
|
||||
if delta < -1:
|
||||
splitr: BinarySplit[ActiveKeyType, Integer, TreeType]
|
||||
splitr: BinarySplit[ActiveKeyType, Integer, TreeType] | None
|
||||
assert isinstance(splitr, BinarySplit)
|
||||
return await self.on_symmetric(InnerOuter(case.protocol), case.split.treel, case.split.key, splitr)
|
||||
elif delta > 1:
|
||||
splitl: BinarySplit[ActiveKeyType, Integer, TreeType]
|
||||
splitl: BinarySplit[ActiveKeyType, Integer, TreeType] | None
|
||||
assert isinstance(splitl, BinarySplit)
|
||||
return await self.on_symmetric(OuterInner(case.protocol), case.split.treer, case.split.key, splitl)
|
||||
else:
|
||||
@ -166,7 +167,7 @@ class BalanceAction(
|
||||
assert isinstance(height_oi, int)
|
||||
assert isinstance(height_oo, int)
|
||||
if height_oi > height_oo:
|
||||
splitoi: BinarySplit[ActiveKeyType, Integer, TreeType]
|
||||
splitoi: BinarySplit[ActiveKeyType, Integer, TreeType] | None
|
||||
assert isinstance(splitoi, BinarySplit)
|
||||
inner, outer = await gather(
|
||||
symmetry.tree(treei, symmetry.inner(splitoi), key),
|
||||
|
@ -5,7 +5,7 @@ from rainbowadn.nullability import *
|
||||
|
||||
__all__ = ('BinaryTree', 'BinaryTreeFactory',)
|
||||
|
||||
TreeKeyType = TypeVar('TreeKeyType')
|
||||
TreeKeyType = TypeVar('TreeKeyType', bound=Mentionable)
|
||||
|
||||
|
||||
class BinaryTree(RecursiveMentionable, Generic[TreeKeyType]):
|
||||
@ -28,7 +28,7 @@ class BinaryTree(RecursiveMentionable, Generic[TreeKeyType]):
|
||||
assert isinstance(key, Mentionable)
|
||||
self.treel = treel
|
||||
self.treer = treer
|
||||
self.key = key
|
||||
self.key: TreeKeyType = key
|
||||
|
||||
def points(self) -> Iterable[HashPoint]:
|
||||
return [*self.treel.points(), *self.treer.points(), *RecursiveMentionable.points_of(self.key)]
|
||||
|
@ -2,6 +2,7 @@ import abc
|
||||
from typing import Generic, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .binarybalancing import *
|
||||
from .binarycreation import *
|
||||
from .binaryprotocolized import *
|
||||
@ -9,8 +10,8 @@ from .binaryprotocolized import *
|
||||
__all__ = ('BalancedCreation',)
|
||||
|
||||
TreeType = TypeVar('TreeType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType')
|
||||
MetaDataType = TypeVar('MetaDataType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
|
||||
MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
|
||||
|
||||
|
||||
class BalancedCreation(
|
||||
|
@ -3,14 +3,15 @@ from typing import Generic, TypeVar
|
||||
|
||||
from rainbowadn.collection.comparison import *
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .binarymetadata import *
|
||||
from .binaryprotocolized import *
|
||||
|
||||
__all__ = ('BinaryBalancing',)
|
||||
|
||||
TreeType = TypeVar('TreeType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType')
|
||||
MetaDataType = TypeVar('MetaDataType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
|
||||
MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
|
||||
|
||||
|
||||
class BinaryBalancing(
|
||||
|
@ -2,13 +2,14 @@ from typing import Generic, Optional, TypeVar
|
||||
|
||||
from rainbowadn.collection.comparison import *
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .binarysplit import *
|
||||
|
||||
__all__ = ('BinaryCreation',)
|
||||
|
||||
TreeType = TypeVar('TreeType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType')
|
||||
MetaDataType = TypeVar('MetaDataType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
|
||||
MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
|
||||
|
||||
|
||||
class BinaryCreation(Generic[ActiveKeyType, MetaDataType, TreeType]):
|
||||
|
@ -1,13 +1,14 @@
|
||||
from typing import Generic, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .binarycreation import *
|
||||
|
||||
__all__ = ('BinaryMetadata',)
|
||||
|
||||
TreeType = TypeVar('TreeType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType')
|
||||
MetaDataType = TypeVar('MetaDataType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
|
||||
MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
|
||||
|
||||
|
||||
class BinaryMetadata(Generic[ActiveKeyType, MetaDataType, TreeType]):
|
||||
|
@ -1,13 +1,15 @@
|
||||
from typing import Generic, Optional, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .binarycreation import *
|
||||
from .binarysplit import *
|
||||
|
||||
__all__ = ('BinaryProtocolized',)
|
||||
|
||||
TreeType = TypeVar('TreeType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType')
|
||||
MetaDataType = TypeVar('MetaDataType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
|
||||
MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
|
||||
|
||||
|
||||
class BinaryProtocolized(
|
||||
|
@ -5,8 +5,8 @@ from rainbowadn.core import *
|
||||
__all__ = ('BinarySplit',)
|
||||
|
||||
TreeType = TypeVar('TreeType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType')
|
||||
MetaDataType = TypeVar('MetaDataType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
|
||||
MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
|
||||
|
||||
|
||||
class BinarySplit(
|
||||
|
@ -1,6 +1,7 @@
|
||||
from typing import Generic, Optional, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .binarycreation import *
|
||||
from .binaryprotocolized import *
|
||||
from .binarysplit import *
|
||||
@ -8,8 +9,8 @@ from .binarysplit import *
|
||||
__all__ = ('ProtocolizedBinarySplit',)
|
||||
|
||||
TreeType = TypeVar('TreeType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType')
|
||||
MetaDataType = TypeVar('MetaDataType')
|
||||
ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
|
||||
MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
|
||||
|
||||
|
||||
class ProtocolizedBinarySplit(
|
||||
|
@ -17,11 +17,20 @@ __all__ = (
|
||||
'StaticMentionable', 'StaticFactory',
|
||||
)
|
||||
|
||||
from .asserts import assert_eq, assert_false, assert_none, assert_none_strict, assert_true, assert_trues
|
||||
from .asserts import (
|
||||
assert_eq, assert_false, assert_none, assert_none_strict,
|
||||
assert_true, assert_trues
|
||||
)
|
||||
from .extendableresolver import ExtendableResolver
|
||||
from .gather import aidentity, alist, asum, gather, set_gather_asyncio, set_gather_linear
|
||||
from .gather import (
|
||||
aidentity, alist, asum, gather, set_gather_asyncio,
|
||||
set_gather_linear
|
||||
)
|
||||
from .hashpoint import HashPoint
|
||||
from .hashpointformat import disable_newline, enable_newline, hash_point_format, tabulate
|
||||
from .hashpointformat import (
|
||||
disable_newline, enable_newline,
|
||||
hash_point_format, tabulate
|
||||
)
|
||||
from .hashresolver import HashResolver
|
||||
from .localmetaorigin import LocalMetaOrigin
|
||||
from .localorigin import LocalOrigin
|
||||
|
@ -1,4 +1,4 @@
|
||||
from typing import Iterable, Optional, TypeVar
|
||||
from typing import Any, Iterable, Optional, TypeVar
|
||||
|
||||
__all__ = ('assert_true', 'assert_trues', 'assert_false', 'assert_none', 'assert_none_strict', 'assert_eq',)
|
||||
|
||||
@ -22,7 +22,7 @@ def assert_false(value: bool) -> bool:
|
||||
T = TypeVar('T')
|
||||
|
||||
|
||||
def assert_none(value: Optional[T]) -> bool:
|
||||
def assert_none(value: Optional[Any]) -> bool:
|
||||
assert value is None
|
||||
return True
|
||||
|
||||
|
@ -8,11 +8,11 @@ from .resolvermetaorigin import *
|
||||
|
||||
__all__ = ('ExtendableResolver',)
|
||||
|
||||
Mentioned = TypeVar('Mentioned')
|
||||
Mentioned = TypeVar('Mentioned', bound=Mentionable)
|
||||
|
||||
|
||||
class ExtendableResolver(HashResolver, abc.ABC):
|
||||
async def extend(self, hash_point: HashPoint[Mentioned]) -> 'ExtendableResolver':
|
||||
async def extend(self, hash_point: HashPoint[Mentionable]) -> 'ExtendableResolver':
|
||||
raise NotImplementedError
|
||||
|
||||
async def migrate(self, hash_point: HashPoint[Mentioned]) -> HashPoint[Mentioned]:
|
||||
|
@ -3,11 +3,11 @@ from typing import Any, AsyncIterable, Awaitable, Coroutine, TypeVar, overload
|
||||
|
||||
__all__ = ('gather', 'asum', 'alist', 'set_gather_asyncio', 'set_gather_linear', 'aidentity',)
|
||||
|
||||
_gather = asyncio.gather
|
||||
_gather: Any = asyncio.gather
|
||||
|
||||
|
||||
async def _local_gather(*args):
|
||||
return [await arg for arg in args]
|
||||
return tuple([await arg for arg in args])
|
||||
|
||||
|
||||
def set_gather_asyncio():
|
||||
@ -29,35 +29,39 @@ T4 = TypeVar('T4')
|
||||
|
||||
@overload
|
||||
def gather(
|
||||
a0: Coroutine[Any, Any, T0],
|
||||
a1: Coroutine[Any, Any, T1],
|
||||
a0: Coroutine[Any, Any, T0],
|
||||
a1: Coroutine[Any, Any, T1],
|
||||
/
|
||||
) -> Awaitable[tuple[T0, T1]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
def gather(
|
||||
a0: Coroutine[Any, Any, T0],
|
||||
a1: Coroutine[Any, Any, T1],
|
||||
a2: Coroutine[Any, Any, T2],
|
||||
a0: Coroutine[Any, Any, T0],
|
||||
a1: Coroutine[Any, Any, T1],
|
||||
a2: Coroutine[Any, Any, T2],
|
||||
/
|
||||
) -> Awaitable[tuple[T0, T1, T2]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
def gather(
|
||||
a0: Coroutine[Any, Any, T0],
|
||||
a1: Coroutine[Any, Any, T1],
|
||||
a2: Coroutine[Any, Any, T2],
|
||||
a3: Coroutine[Any, Any, T3],
|
||||
a0: Coroutine[Any, Any, T0],
|
||||
a1: Coroutine[Any, Any, T1],
|
||||
a2: Coroutine[Any, Any, T2],
|
||||
a3: Coroutine[Any, Any, T3],
|
||||
/
|
||||
) -> Awaitable[tuple[T0, T1, T2, T3]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
def gather(
|
||||
a0: Coroutine[Any, Any, T0],
|
||||
a1: Coroutine[Any, Any, T1],
|
||||
a2: Coroutine[Any, Any, T2],
|
||||
a3: Coroutine[Any, Any, T3],
|
||||
a4: Coroutine[Any, Any, T4],
|
||||
a0: Coroutine[Any, Any, T0],
|
||||
a1: Coroutine[Any, Any, T1],
|
||||
a2: Coroutine[Any, Any, T2],
|
||||
a3: Coroutine[Any, Any, T3],
|
||||
a4: Coroutine[Any, Any, T4],
|
||||
/
|
||||
) -> Awaitable[tuple[T0, T1, T2, T3, T4]]: ...
|
||||
|
||||
|
||||
|
@ -9,7 +9,8 @@ from .rainbow_factory import *
|
||||
|
||||
__all__ = ('HashPoint',)
|
||||
|
||||
Mentioned = TypeVar('Mentioned')
|
||||
Mentioned = TypeVar('Mentioned', bound=Mentionable, covariant=True)
|
||||
MentionedI = TypeVar('MentionedI', bound=Mentionable)
|
||||
|
||||
|
||||
def _hash(source: bytes) -> bytes:
|
||||
@ -54,7 +55,8 @@ class HashPoint(Generic[Mentioned]):
|
||||
return topology_hash + bytes(mentioned)
|
||||
|
||||
@classmethod
|
||||
def of(cls, mentioned: Mentioned) -> 'HashPoint[Mentioned]':
|
||||
def of(cls, mentioned: MentionedI) -> 'HashPoint[MentionedI]':
|
||||
assert issubclass(cls, HashPoint)
|
||||
assert isinstance(mentioned, Mentionable)
|
||||
return cls(
|
||||
cls.hash(cls.bytes_of_mentioned(mentioned)), LocalOrigin(mentioned)
|
||||
|
@ -2,13 +2,14 @@ from typing import Generic, TypeVar
|
||||
|
||||
from .asserts import *
|
||||
from .hashpoint import *
|
||||
from .mentionable import *
|
||||
from .metaorigin import *
|
||||
from .origin import *
|
||||
from .rainbow_factory import *
|
||||
|
||||
__all__ = ('LocalMetaOrigin',)
|
||||
|
||||
Mentioned = TypeVar('Mentioned')
|
||||
Mentioned = TypeVar('Mentioned', bound=Mentionable)
|
||||
|
||||
|
||||
class LocalMetaOrigin(MetaOrigin[Mentioned], Generic[Mentioned]):
|
||||
|
@ -2,12 +2,13 @@ from typing import Generic, TypeVar
|
||||
|
||||
from .asserts import *
|
||||
from .hashpoint import *
|
||||
from .mentionable import *
|
||||
from .origin import *
|
||||
from .rainbow_factory import *
|
||||
|
||||
__all__ = ('MetaOrigin',)
|
||||
|
||||
Mentioned = TypeVar('Mentioned')
|
||||
Mentioned = TypeVar('Mentioned', bound=Mentionable, covariant=True)
|
||||
|
||||
|
||||
class MetaOrigin(Generic[Mentioned]):
|
||||
|
@ -4,7 +4,7 @@ from .rainbow_factory import *
|
||||
|
||||
__all__ = ('Origin',)
|
||||
|
||||
Mentioned = TypeVar('Mentioned')
|
||||
Mentioned = TypeVar('Mentioned', covariant=True)
|
||||
|
||||
|
||||
class Origin(Generic[Mentioned]):
|
||||
|
@ -4,7 +4,7 @@ from .hashresolver import *
|
||||
|
||||
__all__ = ('RainbowFactory',)
|
||||
|
||||
Mentioned = TypeVar('Mentioned')
|
||||
Mentioned = TypeVar('Mentioned', covariant=True)
|
||||
|
||||
|
||||
class RainbowFactory(Generic[Mentioned]):
|
||||
|
@ -3,6 +3,7 @@ from typing import Generic, TypeVar
|
||||
from .asserts import *
|
||||
from .hashpoint import *
|
||||
from .hashresolver import *
|
||||
from .mentionable import *
|
||||
from .metaorigin import *
|
||||
from .origin import *
|
||||
from .rainbow_factory import *
|
||||
@ -10,7 +11,7 @@ from .resolverorigin import *
|
||||
|
||||
__all__ = ('ResolverMetaOrigin',)
|
||||
|
||||
Mentioned = TypeVar('Mentioned')
|
||||
Mentioned = TypeVar('Mentioned', bound=Mentionable, covariant=True)
|
||||
|
||||
|
||||
class ResolverMetaOrigin(MetaOrigin[Mentioned], Generic[Mentioned]):
|
||||
|
@ -9,7 +9,7 @@ from .rainbow_factory import *
|
||||
|
||||
__all__ = ('ResolverOrigin',)
|
||||
|
||||
Mentioned = TypeVar('Mentioned')
|
||||
Mentioned = TypeVar('Mentioned', bound=Mentionable, covariant=True)
|
||||
|
||||
|
||||
class ResolverOrigin(Origin[Mentioned], Generic[Mentioned]):
|
||||
|
@ -7,7 +7,7 @@ from .rainbow_factory import *
|
||||
|
||||
__all__ = ('StaticMentionable', 'StaticFactory',)
|
||||
|
||||
StaticMentioned = TypeVar('StaticMentioned')
|
||||
StaticMentioned = TypeVar('StaticMentioned', bound='StaticMentionable')
|
||||
|
||||
|
||||
class StaticMentionable(Mentionable, abc.ABC):
|
||||
|
@ -7,7 +7,7 @@ from rainbowadn.core import *
|
||||
|
||||
__all__ = ('Encrypted', 'EncryptedFactory',)
|
||||
|
||||
EncryptedType = TypeVar('EncryptedType')
|
||||
EncryptedType = TypeVar('EncryptedType', bound=Mentionable)
|
||||
|
||||
|
||||
class Encrypted(RecursiveMentionable, Generic[EncryptedType]):
|
||||
|
@ -4,8 +4,8 @@ from ._mapper import Mapper
|
||||
|
||||
__all__ = ('CallableMapper',)
|
||||
|
||||
Element = TypeVar('Element')
|
||||
Mapped = TypeVar('Mapped')
|
||||
Element = TypeVar('Element', contravariant=True)
|
||||
Mapped = TypeVar('Mapped', covariant=True)
|
||||
|
||||
|
||||
class CallableMapper(
|
||||
|
@ -4,9 +4,9 @@ from ._mapper import *
|
||||
|
||||
__all__ = ('Composition',)
|
||||
|
||||
Element = TypeVar('Element')
|
||||
Element = TypeVar('Element', contravariant=True)
|
||||
Middle = TypeVar('Middle')
|
||||
Mapped = TypeVar('Mapped')
|
||||
Mapped = TypeVar('Mapped', covariant=True)
|
||||
|
||||
|
||||
class Composition(
|
||||
|
@ -2,8 +2,8 @@ from typing import Any, Callable, Coroutine, Generic, TypeVar
|
||||
|
||||
__all__ = ('Mapper',)
|
||||
|
||||
Element = TypeVar('Element')
|
||||
Mapped = TypeVar('Mapped')
|
||||
Element = TypeVar('Element', contravariant=True)
|
||||
Mapped = TypeVar('Mapped', covariant=True)
|
||||
|
||||
|
||||
class Mapper(Generic[Element, Mapped]):
|
||||
|
@ -1,12 +1,13 @@
|
||||
from typing import Any, Callable, Coroutine, Generic, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from ._mapper import *
|
||||
from ._reduce import *
|
||||
|
||||
__all__ = ('MapReduce',)
|
||||
|
||||
Element = TypeVar('Element')
|
||||
Element = TypeVar('Element', contravariant=True)
|
||||
Mapped = TypeVar('Mapped')
|
||||
Out = TypeVar('Out')
|
||||
|
||||
|
@ -7,7 +7,7 @@ from ._reducer import *
|
||||
|
||||
__all__ = ('MapReducer',)
|
||||
|
||||
Element = TypeVar('Element')
|
||||
Element = TypeVar('Element', contravariant=True)
|
||||
Mapped = TypeVar('Mapped')
|
||||
Out = TypeVar('Out')
|
||||
|
||||
|
@ -4,7 +4,7 @@ from rainbowadn.core import *
|
||||
|
||||
__all__ = ('Reduce',)
|
||||
|
||||
Element = TypeVar('Element')
|
||||
Element = TypeVar('Element', contravariant=True)
|
||||
Out = TypeVar('Out')
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@ from ._reduce import *
|
||||
|
||||
__all__ = ('Reducer',)
|
||||
|
||||
Element = TypeVar('Element')
|
||||
Element = TypeVar('Element', contravariant=True)
|
||||
Out = TypeVar('Out')
|
||||
|
||||
|
||||
|
@ -4,8 +4,8 @@ from rainbowadn.flow.core import *
|
||||
|
||||
__all__ = ('ConstMapper',)
|
||||
|
||||
Element = TypeVar('Element')
|
||||
Mapped = TypeVar('Mapped')
|
||||
Element = TypeVar('Element', contravariant=True)
|
||||
Mapped = TypeVar('Mapped', covariant=True)
|
||||
|
||||
|
||||
class ConstMapper(Mapper[Element, Mapped], Generic[Element, Mapped]):
|
||||
|
@ -4,7 +4,7 @@ from rainbowadn.flow.core import *
|
||||
|
||||
__all__ = ('UnitReducer',)
|
||||
|
||||
Element = TypeVar('Element')
|
||||
Element = TypeVar('Element', contravariant=True)
|
||||
Out = TypeVar('Out')
|
||||
|
||||
|
||||
|
@ -2,11 +2,12 @@ from typing import Generic, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
from rainbowadn.flow.core import *
|
||||
|
||||
from ._verification import *
|
||||
|
||||
__all__ = ('CompositionVerification',)
|
||||
|
||||
Verified = TypeVar('Verified')
|
||||
Verified = TypeVar('Verified', contravariant=True)
|
||||
Middle = TypeVar('Middle')
|
||||
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
from typing import Generic, TypeVar
|
||||
|
||||
from rainbowadn.flow.core import *
|
||||
|
||||
from ._verification import *
|
||||
|
||||
__all__ = ('MapperVerification',)
|
||||
|
||||
Verified = TypeVar('Verified')
|
||||
Verified = TypeVar('Verified', contravariant=True)
|
||||
|
||||
|
||||
class MapperVerification(Verification[Verified], Generic[Verified]):
|
||||
|
@ -2,12 +2,13 @@ from typing import Generic, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
from rainbowadn.flow.core import *
|
||||
|
||||
from ._verification import *
|
||||
from ._verifyreduce import *
|
||||
|
||||
__all__ = ('ReduceVerification',)
|
||||
|
||||
Verified = TypeVar('Verified')
|
||||
Verified = TypeVar('Verified', contravariant=True)
|
||||
|
||||
|
||||
class ReduceVerification(
|
||||
|
@ -5,7 +5,7 @@ from rainbowadn.flow.core import *
|
||||
|
||||
__all__ = ('Verification',)
|
||||
|
||||
Verified = TypeVar('Verified')
|
||||
Verified = TypeVar('Verified', contravariant=True)
|
||||
|
||||
|
||||
class Verification(
|
||||
|
@ -5,7 +5,7 @@ from rainbowadn.flow.core import *
|
||||
from rainbowadn.flow.verification.core import *
|
||||
from rainbowadn.nullability import *
|
||||
|
||||
__all__ = ('StateVerification',)
|
||||
__all__ = ('StateVerification', 'SVF',)
|
||||
|
||||
Header = TypeVar('Header')
|
||||
State = TypeVar('State')
|
||||
@ -19,7 +19,7 @@ class StateVerification(
|
||||
def __init__(
|
||||
self,
|
||||
mapper: Mapper[Link, tuple[Header, State]],
|
||||
verification: Verification[tuple[Nullable[State], Header, State]]
|
||||
verification: Verification[tuple[Nullable[State], Header, State]],
|
||||
):
|
||||
assert isinstance(mapper, Mapper)
|
||||
assert isinstance(verification, Mapper)
|
||||
@ -58,3 +58,12 @@ class StateVerification(
|
||||
|
||||
def loose(self) -> Verification[tuple[Nullable[Link], Link]]:
|
||||
return self
|
||||
|
||||
|
||||
class SVF(Generic[Header, State, Link]):
|
||||
def make(
|
||||
self,
|
||||
mapper: Mapper[Link, tuple[Header, State]],
|
||||
verification: Verification[tuple[Nullable[State], Header, State]],
|
||||
) -> Verification[tuple[Nullable[Link], Link]]:
|
||||
return StateVerification(mapper, verification)
|
||||
|
@ -12,4 +12,7 @@ from ._flowblock import FlowBlock, FlowBlockFactory, FlowBlockVerification
|
||||
from ._flowcheque import FlowCheque
|
||||
from ._flowiterate import FlowIterate
|
||||
from ._flowstandard import FlowStandard
|
||||
from ._flowtransaction import FlowCoin, FlowCoinData, FlowTransaction, FlowTransactionData
|
||||
from ._flowtransaction import (
|
||||
FlowCoin, FlowCoinData, FlowTransaction,
|
||||
FlowTransactionData
|
||||
)
|
||||
|
@ -5,6 +5,7 @@ from rainbowadn.flow.core import *
|
||||
from rainbowadn.flow.verification.core import *
|
||||
from rainbowadn.inlining import *
|
||||
from rainbowadn.nullability import *
|
||||
|
||||
from ._bankflow import *
|
||||
from ._flowbank import *
|
||||
from ._flowblock import *
|
||||
@ -42,7 +43,8 @@ class BankBlock:
|
||||
|
||||
@classmethod
|
||||
def verification(cls) -> Verification[Index]:
|
||||
return FlowBlockVerification(cls.flow().link_verification()).loose()
|
||||
fbvf: FBVF[Link] = FBVF()
|
||||
return fbvf.make(cls.flow().link_verification())
|
||||
|
||||
async def verify(self) -> bool:
|
||||
assert_true(await self.verification().verify(await FlowBlock.outer_of(self.link_factory(), self.reference)))
|
||||
|
@ -8,6 +8,7 @@ from rainbowadn.flow.verification.core import *
|
||||
from rainbowadn.flow.verification.stateverification import *
|
||||
from rainbowadn.inlining import *
|
||||
from rainbowadn.nullability import *
|
||||
|
||||
from ._flowbank import *
|
||||
from ._flowcheque import *
|
||||
from ._flowstandard import *
|
||||
@ -21,7 +22,7 @@ Link: TypeAlias = IPair[FlowCheque, FlowBank]
|
||||
|
||||
class BankFlow(
|
||||
Verification[
|
||||
tuple[Nullable[HashPoint[FlowBank]], HashPoint[FlowCheque], HashPoint[FlowBank]]
|
||||
tuple[Nullable[FlowBank], FlowCheque, FlowBank]
|
||||
],
|
||||
):
|
||||
def __init__(self, initial: FlowBank):
|
||||
@ -157,12 +158,13 @@ class BankFlow(
|
||||
assert isinstance(bank, FlowBank)
|
||||
return cheque, bank
|
||||
|
||||
return StateVerification(
|
||||
svf: SVF[FlowCheque, FlowBank, HashPoint[Link]] = SVF()
|
||||
return svf.make(
|
||||
Decomposition(),
|
||||
self.loose()
|
||||
).loose()
|
||||
)
|
||||
|
||||
def loose(self) -> Verification[
|
||||
tuple[Nullable[HashPoint[FlowBank]], HashPoint[FlowCheque], HashPoint[FlowBank]]
|
||||
tuple[Nullable[FlowBank], FlowCheque, FlowBank]
|
||||
]:
|
||||
return self
|
||||
|
@ -9,8 +9,8 @@ from rainbowadn.flow.core import *
|
||||
|
||||
__all__ = ('BinaryReducer', 'VerifySubsetAction', 'CheckResult',)
|
||||
|
||||
KeyT = TypeVar('KeyT')
|
||||
MetadataT = TypeVar('MetadataT')
|
||||
KeyT = TypeVar('KeyT', bound=Mentionable)
|
||||
MetadataT = TypeVar('MetadataT', bound=Mentionable)
|
||||
TreeT = TypeVar('TreeT')
|
||||
Out = TypeVar('Out')
|
||||
|
||||
@ -38,7 +38,7 @@ class BinaryReducerAction(
|
||||
BinaryAction[KeyT, MetadataT, TreeT, Out],
|
||||
Generic[KeyT, MetadataT, TreeT, Out],
|
||||
):
|
||||
def __init__(self, reduce: Reduce[KeyT, Out]):
|
||||
def __init__(self, reduce: Reduce[HashPoint[KeyT], Out]):
|
||||
assert isinstance(reduce, Reduce)
|
||||
self.reduce = reduce
|
||||
|
||||
|
@ -2,6 +2,7 @@ from typing import Iterable
|
||||
|
||||
from rainbowadn.collection.comparison import *
|
||||
from rainbowadn.core import *
|
||||
|
||||
from ._flowstandard import *
|
||||
from ._flowtransaction import *
|
||||
|
||||
|
@ -1,17 +1,15 @@
|
||||
from typing import Generic, Iterable, TypeAlias, TypeVar
|
||||
from typing import Callable, Generic, Iterable, TypeAlias, TypeVar
|
||||
|
||||
from rainbowadn.collection.comparison import *
|
||||
from rainbowadn.core import *
|
||||
from rainbowadn.flow.verification.core import *
|
||||
from rainbowadn.nullability import *
|
||||
|
||||
from ._flowstandard import *
|
||||
|
||||
__all__ = ('FlowBlock', 'FlowBlockFactory', 'FlowBlockVerification',)
|
||||
__all__ = ('FlowBlock', 'FlowBlockFactory', 'FlowBlockVerification', 'FBVF',)
|
||||
|
||||
LinkT = TypeVar('LinkT')
|
||||
|
||||
FBL: TypeAlias = 'FlowBlock[LinkT]'
|
||||
Index: TypeAlias = FlowStandard[FBL]
|
||||
LinkT = TypeVar('LinkT', bound=Mentionable)
|
||||
|
||||
|
||||
class FlowBlock(Generic[LinkT], RecursiveMentionable):
|
||||
@ -21,13 +19,13 @@ class FlowBlock(Generic[LinkT], RecursiveMentionable):
|
||||
def __bytes__(self):
|
||||
return bytes(self.previous) + bytes(self.index) + bytes(self.link)
|
||||
|
||||
def __factory__(self) -> RainbowFactory[FBL]:
|
||||
def __factory__(self) -> RainbowFactory['FBL']:
|
||||
return FlowBlockFactory(self.link.factory)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
previous: NullableReference[FBL],
|
||||
index: Index,
|
||||
previous: NullableReference['FBL'],
|
||||
index: 'Index',
|
||||
link: HashPoint[LinkT],
|
||||
):
|
||||
assert isinstance(previous, NullableReference)
|
||||
@ -36,7 +34,7 @@ class FlowBlock(Generic[LinkT], RecursiveMentionable):
|
||||
self.index = index
|
||||
self.link = link
|
||||
|
||||
async def outer(self) -> Index:
|
||||
async def outer(self) -> 'Index':
|
||||
return FlowStandard(
|
||||
(
|
||||
await self.index.protocolized.tree.add(
|
||||
@ -45,25 +43,25 @@ class FlowBlock(Generic[LinkT], RecursiveMentionable):
|
||||
).protocolized()
|
||||
)
|
||||
|
||||
async def verify_outer_matches(self, index: Index) -> bool:
|
||||
async def verify_outer_matches(self, index: 'Index') -> bool:
|
||||
assert_eq(await self.outer(), index)
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
async def outer_of(cls, factory: RainbowFactory[LinkT], reference: NullableReference[FBL]) -> Index:
|
||||
async def outer_of(cls, factory: RainbowFactory[LinkT], reference: NullableReference['FBL']) -> 'Index':
|
||||
if reference.null():
|
||||
return FlowStandardFactory.empty(FlowBlockFactory(factory), HashComparator(Fail()))
|
||||
else:
|
||||
return await (await reference.resolve()).outer()
|
||||
|
||||
@classmethod
|
||||
async def link_of(cls, reference: NullableReference[FBL]) -> Nullable[LinkT]:
|
||||
async def link_of(cls, reference: NullableReference['FBL']) -> Nullable[LinkT]:
|
||||
if reference.null():
|
||||
return Null()
|
||||
else:
|
||||
return NotNull(await (await reference.resolve()).link.resolve())
|
||||
|
||||
async def add(self, link: HashPoint[LinkT]) -> FBL:
|
||||
async def add(self, link: HashPoint[LinkT]) -> 'FBL':
|
||||
return FlowBlock(
|
||||
NullableReference.off(self),
|
||||
await self.outer(),
|
||||
@ -71,7 +69,7 @@ class FlowBlock(Generic[LinkT], RecursiveMentionable):
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def add_to(cls, reference: NullableReference[FBL], link: HashPoint[LinkT]) -> FBL:
|
||||
async def add_to(cls, reference: NullableReference['FBL'], link: HashPoint[LinkT]) -> 'FBL':
|
||||
return FlowBlock(
|
||||
reference,
|
||||
await cls.outer_of(link.factory, reference),
|
||||
@ -93,12 +91,12 @@ class FlowBlock(Generic[LinkT], RecursiveMentionable):
|
||||
f'{tabulate(tab)}{link_str}'
|
||||
|
||||
|
||||
class FlowBlockFactory(RainbowFactory[FBL], Generic[LinkT]):
|
||||
class FlowBlockFactory(RainbowFactory['FBL'], Generic[LinkT]):
|
||||
def __init__(self, factory: RainbowFactory[LinkT]):
|
||||
assert isinstance(factory, RainbowFactory)
|
||||
self.factory = factory
|
||||
|
||||
def from_bytes(self, source: bytes, resolver: HashResolver) -> FBL:
|
||||
def from_bytes(self, source: bytes, resolver: HashResolver) -> 'FBL':
|
||||
assert isinstance(source, bytes)
|
||||
assert isinstance(resolver, HashResolver)
|
||||
return FlowBlock(
|
||||
@ -109,10 +107,14 @@ class FlowBlockFactory(RainbowFactory[FBL], Generic[LinkT]):
|
||||
ResolverOrigin(self.factory, source[2 * HashPoint.HASH_LENGTH:], resolver).hash_point(),
|
||||
)
|
||||
|
||||
def loose(self) -> RainbowFactory[FBL]:
|
||||
def loose(self) -> RainbowFactory['FBL']:
|
||||
return self
|
||||
|
||||
|
||||
FBL: TypeAlias = 'FlowBlock[LinkT]'
|
||||
Index: TypeAlias = FlowStandard[FBL]
|
||||
|
||||
|
||||
class FlowBlockIndexedVerification(
|
||||
Verification[HashPoint[FBL]],
|
||||
Generic[LinkT]
|
||||
@ -196,3 +198,11 @@ class FlowBlockVerification(
|
||||
|
||||
def loose(self) -> Verification[Index]:
|
||||
return self
|
||||
|
||||
|
||||
class FBVF(Generic[LinkT]):
|
||||
def make(
|
||||
self,
|
||||
verification: Verification[tuple[Nullable[HashPoint[LinkT]], HashPoint[LinkT]]]
|
||||
) -> Verification[Index]:
|
||||
return FlowBlockVerification(verification)
|
||||
|
@ -7,6 +7,7 @@ from rainbowadn.core import *
|
||||
from rainbowadn.flow.core import *
|
||||
from rainbowadn.flow.verification.core import *
|
||||
from rainbowadn.v13 import *
|
||||
|
||||
from ._flowiterate import *
|
||||
from ._flowstandard import *
|
||||
from ._flowtransaction import *
|
||||
@ -76,7 +77,7 @@ class FlowCheque(StaticMentionable, RecursiveMentionable):
|
||||
@classmethod
|
||||
async def total_of(cls, tree: FlowStandard[FlowCoin]) -> int:
|
||||
assert isinstance(tree, FlowStandard)
|
||||
reducer: Reducer[HashPoint[FlowCoin]] = await tree.reducer()
|
||||
reducer: Reducer[HashPoint[FlowCoin], int] = await tree.reducer()
|
||||
assert isinstance(reducer, Reducer)
|
||||
total: int = await reducer.reduce(MapReduce(ValueMapper(), SumReduce(0)))
|
||||
assert isinstance(total, int)
|
||||
|
@ -11,20 +11,20 @@ from rainbowadn.flow.primitive import *
|
||||
from rainbowadn.flow.verification.core import *
|
||||
from rainbowadn.inlining import *
|
||||
from rainbowadn.nullability import *
|
||||
|
||||
from ._binaryflow import *
|
||||
from ._flowtree import *
|
||||
|
||||
__all__ = ('FlowStandard', 'FlowStandardFactory',)
|
||||
|
||||
KeyT = TypeVar('KeyT')
|
||||
FS: TypeAlias = 'FlowStandard[KeyT]'
|
||||
KeyT = TypeVar('KeyT', bound=Mentionable)
|
||||
ABT: TypeAlias = 'ActiveBinaryTree[KeyT, Integer]'
|
||||
BP: TypeAlias = 'BinaryProtocolized[KeyT, Integer, ABT]'
|
||||
|
||||
|
||||
class FlowStandard(
|
||||
RecursiveMentionable,
|
||||
FlowTree[HashPoint[KeyT], FS],
|
||||
FlowTree[HashPoint[KeyT], 'FS'],
|
||||
Generic[KeyT]
|
||||
):
|
||||
def points(self) -> Iterable[HashPoint]:
|
||||
@ -46,14 +46,14 @@ class FlowStandard(
|
||||
async def contains(self, key: HashPoint[KeyT], *, exact: bool) -> bool:
|
||||
return await self.protocolized.tree.contains(key, exact=exact)
|
||||
|
||||
def _protocolized(self: FS) -> BP:
|
||||
def _protocolized(self: 'FS') -> BP:
|
||||
return self.protocolized
|
||||
|
||||
@classmethod
|
||||
def _protocolized_mapper(cls) -> Mapper[FS, BP]:
|
||||
return CallableMapper(cls._protocolized)
|
||||
def _protocolized_mapper(cls) -> Mapper['FS', BP]:
|
||||
return CallableMapper(FlowStandard._protocolized)
|
||||
|
||||
async def verify_subset(self, trees: Reducer[FS, CheckResult]) -> bool:
|
||||
async def verify_subset(self, trees: Reducer['FS', CheckResult]) -> bool:
|
||||
assert isinstance(trees, Reducer)
|
||||
reducer: Reducer[BP, CheckResult] = MapReducer(self._protocolized_mapper(), trees)
|
||||
assert_true(await VerifySubsetAction(reducer).on(self.protocolized))
|
||||
@ -83,6 +83,9 @@ class FlowStandard(
|
||||
return await self.protocolized.tree.reference.str(tab)
|
||||
|
||||
|
||||
FS: TypeAlias = 'FlowStandard[KeyT]'
|
||||
|
||||
|
||||
class FlowStandardFactory(Inlining[FlowStandard[KeyT]], Generic[KeyT]):
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -9,6 +9,7 @@ from rainbowadn.core import *
|
||||
from rainbowadn.flow.core import *
|
||||
from rainbowadn.flow.verification.core import *
|
||||
from rainbowadn.v13 import *
|
||||
|
||||
from ._flowstandard import *
|
||||
from ._resolvemapper import *
|
||||
|
||||
|
@ -1,10 +1,12 @@
|
||||
from typing import TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from ._flowstandard import *
|
||||
|
||||
__all__ = ('flow_union',)
|
||||
|
||||
KeyT = TypeVar('KeyT')
|
||||
KeyT = TypeVar('KeyT', bound=Mentionable)
|
||||
|
||||
|
||||
async def flow_union(left: FlowStandard[KeyT], right: FlowStandard[KeyT]) -> FlowStandard[KeyT]:
|
||||
|
@ -5,7 +5,7 @@ from rainbowadn.flow.core import *
|
||||
|
||||
__all__ = ('ResolveMapper',)
|
||||
|
||||
MentionedT = TypeVar('MentionedT')
|
||||
MentionedT = TypeVar('MentionedT', bound=Mentionable)
|
||||
Out = TypeVar('Out')
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@ import abc
|
||||
from typing import Type, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .istatic import *
|
||||
|
||||
__all__ = ('IAtomic',)
|
||||
|
@ -1,7 +1,11 @@
|
||||
import heapq
|
||||
from typing import Callable, Generic, Iterable, Optional, Type, TypeAlias, TypeVar, overload
|
||||
from typing import (
|
||||
Callable, Generic, Iterable, Optional, Type, TypeAlias,
|
||||
TypeVar, overload
|
||||
)
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .inlining import *
|
||||
|
||||
__all__ = ('IAuto', 'Auto', 'IAutoFactory',)
|
||||
@ -12,7 +16,7 @@ _SList: TypeAlias = list[tuple[int, RainbowFactory, int]]
|
||||
_VList: TypeAlias = list[tuple[int, RainbowFactory]]
|
||||
_MCall: TypeAlias = Callable[['Auto', _IList, _UList], None]
|
||||
_MTuple: TypeAlias = tuple[int, _MCall, int]
|
||||
_IAuto = TypeVar('_IAuto')
|
||||
_IAuto = TypeVar('_IAuto', bound='IAuto')
|
||||
|
||||
|
||||
class IAuto(RecursiveMentionable):
|
||||
@ -58,7 +62,6 @@ class IAuto(RecursiveMentionable):
|
||||
return b''.join(source for _, source in merged_bytes)
|
||||
|
||||
def __factory__(self: _IAuto) -> RainbowFactory[_IAuto]:
|
||||
assert isinstance(self, IAuto)
|
||||
sized: _SList = []
|
||||
inlined_unsized: _VList = []
|
||||
uninlined_unsized: _VList = []
|
||||
@ -156,12 +159,12 @@ class IAuto(RecursiveMentionable):
|
||||
return f'{tabulate(tab)}'.join(formatted)
|
||||
|
||||
|
||||
T = TypeVar('T')
|
||||
T0 = TypeVar('T0')
|
||||
T1 = TypeVar('T1')
|
||||
T2 = TypeVar('T2')
|
||||
T3 = TypeVar('T3')
|
||||
T4 = TypeVar('T4')
|
||||
T = TypeVar('T', bound=Mentionable)
|
||||
T0 = TypeVar('T0', bound=Mentionable)
|
||||
T1 = TypeVar('T1', bound=Mentionable)
|
||||
T2 = TypeVar('T2', bound=Mentionable)
|
||||
T3 = TypeVar('T3', bound=Mentionable)
|
||||
T4 = TypeVar('T4', bound=Mentionable)
|
||||
|
||||
|
||||
class Auto:
|
||||
@ -197,9 +200,16 @@ class Auto:
|
||||
self.__index += size
|
||||
return self.sub(index, self.__index)
|
||||
|
||||
@classmethod
|
||||
def _force_size(cls, factory: RainbowFactory) -> int:
|
||||
size = Inlining.factory_size(factory)
|
||||
if size is None:
|
||||
raise ValueError
|
||||
return size
|
||||
|
||||
@classmethod
|
||||
def _static_size(cls, *factories: RainbowFactory) -> int:
|
||||
return sum(Inlining.factory_size(factory) for factory in factories)
|
||||
return sum(cls._force_size(factory) for factory in factories)
|
||||
|
||||
def _static_simple(self, *factories: RainbowFactory) -> Iterable[Mentionable]:
|
||||
with self:
|
||||
@ -234,32 +244,32 @@ class Auto:
|
||||
|
||||
@overload
|
||||
def static(
|
||||
self, t0: RainbowFactory[T0]
|
||||
self, t0: RainbowFactory[T0], /
|
||||
) -> tuple[T0]:
|
||||
...
|
||||
|
||||
@overload
|
||||
def static(
|
||||
self, t0: RainbowFactory[T0], t1: RainbowFactory[T1]
|
||||
self, t0: RainbowFactory[T0], t1: RainbowFactory[T1], /
|
||||
) -> tuple[T0, T1]:
|
||||
...
|
||||
|
||||
@overload
|
||||
def static(
|
||||
self, t0: RainbowFactory[T0], t1: RainbowFactory[T1], t2: RainbowFactory[T2]
|
||||
self, t0: RainbowFactory[T0], t1: RainbowFactory[T1], t2: RainbowFactory[T2], /
|
||||
) -> tuple[T0, T1, T2]:
|
||||
...
|
||||
|
||||
@overload
|
||||
def static(
|
||||
self, t0: RainbowFactory[T0], t1: RainbowFactory[T1], t2: RainbowFactory[T2], t3: RainbowFactory[T3]
|
||||
self, t0: RainbowFactory[T0], t1: RainbowFactory[T1], t2: RainbowFactory[T2], t3: RainbowFactory[T3], /
|
||||
) -> tuple[T0, T1, T2, T3]:
|
||||
...
|
||||
|
||||
@overload
|
||||
def static(
|
||||
self, t0: RainbowFactory[T0], t1: RainbowFactory[T1], t2: RainbowFactory[T2], t3: RainbowFactory[T3],
|
||||
t4: RainbowFactory[T4]
|
||||
t4: RainbowFactory[T4], /
|
||||
) -> tuple[T0, T1, T2, T3, T4]:
|
||||
...
|
||||
|
||||
@ -267,7 +277,7 @@ class Auto:
|
||||
return tuple(self._static(*factories))
|
||||
|
||||
|
||||
class IAutoFactory(Inlining[IAuto], Generic[_IAuto]):
|
||||
class IAutoFactory(Inlining[_IAuto], Generic[_IAuto]):
|
||||
def __init__(
|
||||
self,
|
||||
typed: Type[_IAuto],
|
||||
|
@ -5,7 +5,7 @@ from rainbowadn.core import *
|
||||
|
||||
__all__ = ('Inlining',)
|
||||
|
||||
Inlined = TypeVar('Inlined')
|
||||
Inlined = TypeVar('Inlined', bound=Mentionable, covariant=True)
|
||||
_FTuple: TypeAlias = tuple[int, Callable[[bytes, HashResolver], HashPoint], int]
|
||||
_HTuple: TypeAlias = tuple[int, Callable[[], Coroutine[Any, Any, bytes]]]
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
from typing import Generic, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .iauto import *
|
||||
|
||||
__all__ = ('IPair',)
|
||||
|
||||
E0 = TypeVar('E0')
|
||||
E1 = TypeVar('E1')
|
||||
E0 = TypeVar('E0', bound=Mentionable)
|
||||
E1 = TypeVar('E1', bound=Mentionable)
|
||||
|
||||
|
||||
class IPair(IAuto, Generic[E0, E1]):
|
||||
|
@ -1,11 +1,12 @@
|
||||
from typing import Generic, Iterable, Optional, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .inlining import *
|
||||
|
||||
__all__ = ('IRef',)
|
||||
|
||||
TRef = TypeVar('TRef')
|
||||
TRef = TypeVar('TRef', bound=Mentionable)
|
||||
|
||||
|
||||
class IRef(RecursiveMentionable, Generic[TRef]):
|
||||
|
@ -2,11 +2,12 @@ import abc
|
||||
from typing import Generic, Optional, Type, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .inlining import *
|
||||
|
||||
__all__ = ('IStatic', 'IStaticFactory',)
|
||||
|
||||
StaticInlined = TypeVar('StaticInlined')
|
||||
StaticInlined = TypeVar('StaticInlined', bound='IStatic')
|
||||
|
||||
|
||||
class IStatic(Mentionable, abc.ABC):
|
||||
|
@ -1,4 +1,5 @@
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .iatomic import *
|
||||
|
||||
__all__ = ('IUnit',)
|
||||
|
@ -4,7 +4,7 @@ from .nullable import *
|
||||
|
||||
__all__ = ('NotNull',)
|
||||
|
||||
NullableType = TypeVar('NullableType')
|
||||
NullableType = TypeVar('NullableType', covariant=True)
|
||||
|
||||
|
||||
class NotNull(Nullable[NullableType], Generic[NullableType]):
|
||||
|
@ -4,7 +4,7 @@ from .nullable import *
|
||||
|
||||
__all__ = ('Null',)
|
||||
|
||||
NullableType = TypeVar('NullableType')
|
||||
NullableType = TypeVar('NullableType', covariant=True)
|
||||
|
||||
|
||||
class Null(Nullable[NullableType], Generic[NullableType]):
|
||||
|
@ -3,7 +3,7 @@ from typing import Generic, TypeVar
|
||||
|
||||
__all__ = ('Nullable',)
|
||||
|
||||
NullableType = TypeVar('NullableType')
|
||||
NullableType = TypeVar('NullableType', covariant=True)
|
||||
|
||||
|
||||
class Nullable(Generic[NullableType], abc.ABC):
|
||||
|
@ -2,13 +2,15 @@ from typing import Generic, Iterable, Optional, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
from rainbowadn.inlining import *
|
||||
|
||||
from .notnull import *
|
||||
from .null import *
|
||||
from .nullable import *
|
||||
|
||||
__all__ = ('NullableReference', 'NullableReferenceFactory',)
|
||||
|
||||
Referenced = TypeVar('Referenced')
|
||||
Referenced = TypeVar('Referenced', bound=Mentionable, covariant=True)
|
||||
ReferencedI = TypeVar('ReferencedI', bound=Mentionable)
|
||||
|
||||
|
||||
class NullableReference(RecursiveMentionable, Generic[Referenced]):
|
||||
@ -41,7 +43,7 @@ class NullableReference(RecursiveMentionable, Generic[Referenced]):
|
||||
return cls(NotNull(hash_point), hash_point.factory)
|
||||
|
||||
@classmethod
|
||||
def off(cls, value: Referenced) -> 'NullableReference[Referenced]':
|
||||
def off(cls, value: ReferencedI) -> 'NullableReference[ReferencedI]':
|
||||
assert isinstance(value, Mentionable)
|
||||
return cls.of(HashPoint.of(value))
|
||||
|
||||
|
@ -4,7 +4,7 @@ from rainbowadn.core import *
|
||||
|
||||
__all__ = ('CachingResolver',)
|
||||
|
||||
Mentioned = TypeVar('Mentioned')
|
||||
Mentioned = TypeVar('Mentioned', bound=Mentionable)
|
||||
|
||||
|
||||
class CachingResolver(ExtendableResolver):
|
||||
|
@ -5,7 +5,7 @@ from rainbowadn.core import *
|
||||
|
||||
__all__ = ('DelayedResolver',)
|
||||
|
||||
Mentioned = TypeVar('Mentioned')
|
||||
Mentioned = TypeVar('Mentioned', bound=Mentionable)
|
||||
|
||||
|
||||
class DelayedResolver(ExtendableResolver):
|
||||
|
@ -5,7 +5,7 @@ from rainbowadn.core import *
|
||||
|
||||
__all__ = ('DictResolver',)
|
||||
|
||||
Mentioned = TypeVar('Mentioned')
|
||||
Mentioned = TypeVar('Mentioned', bound=Mentionable)
|
||||
|
||||
|
||||
class DictResolver(ExtendableResolver):
|
||||
|
@ -9,9 +9,9 @@ from rainbowadn.atomic import *
|
||||
from rainbowadn.collection.comparison import *
|
||||
from rainbowadn.collection.trees.binary import *
|
||||
from rainbowadn.core import *
|
||||
from rainbowadn.flow13 import *
|
||||
from rainbowadn.flow.bridge import *
|
||||
from rainbowadn.flow.primitive import *
|
||||
from rainbowadn.flow13 import *
|
||||
from rainbowadn.v13 import *
|
||||
|
||||
|
||||
|
@ -3,6 +3,7 @@ import unittest
|
||||
from rainbowadn.atomic import *
|
||||
from rainbowadn.core import *
|
||||
from rainbowadn.inlining import *
|
||||
|
||||
from .resolvers import *
|
||||
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
from typing import Generic, Iterable, TypeVar
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .thresholdprotocol import *
|
||||
|
||||
__all__ = ('ValidReference', 'ValidReferenceFactory')
|
||||
|
||||
Referenced = TypeVar('Referenced')
|
||||
Referenced = TypeVar('Referenced', bound=Mentionable)
|
||||
|
||||
|
||||
class ValidReference(RecursiveMentionable, Generic[Referenced]):
|
||||
|
@ -4,6 +4,7 @@ import nacl.signing
|
||||
|
||||
from rainbowadn.core import *
|
||||
from rainbowadn.inlining import *
|
||||
|
||||
from .subject import *
|
||||
|
||||
__all__ = ('BadSignature', 'Signature',)
|
||||
|
@ -2,6 +2,7 @@ import bisect
|
||||
from typing import AsyncIterable, Iterable, Sequence
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .wrisbtparametres import *
|
||||
|
||||
__all__ = ('WeakReferenceIndexSetBTree', 'WrisbtFactory',)
|
||||
@ -222,47 +223,47 @@ class WeakReferenceIndexSetBTree(RecursiveMentionable):
|
||||
assert isinstance(right, WeakReferenceIndexSetBTree)
|
||||
return WeakReferenceIndexSetBTree(
|
||||
(
|
||||
self.source[:self.keysize * index]
|
||||
+
|
||||
middle
|
||||
+
|
||||
self.source[self.keysize * index:self.keyend + HashPoint.HASH_LENGTH * index]
|
||||
+
|
||||
bytes(HashPoint.of(left))
|
||||
+
|
||||
bytes(HashPoint.of(right))
|
||||
+
|
||||
self.source[self.keyend + HashPoint.HASH_LENGTH * (index + 1):]
|
||||
self.source[:self.keysize * index]
|
||||
+
|
||||
middle
|
||||
+
|
||||
self.source[self.keysize * index:self.keyend + HashPoint.HASH_LENGTH * index]
|
||||
+
|
||||
bytes(HashPoint.of(left))
|
||||
+
|
||||
bytes(HashPoint.of(right))
|
||||
+
|
||||
self.source[self.keyend + HashPoint.HASH_LENGTH * (index + 1):]
|
||||
),
|
||||
self.height,
|
||||
self.parametres,
|
||||
self.root,
|
||||
(
|
||||
self.cache[:index]
|
||||
+
|
||||
(LocalMetaOrigin(LocalOrigin(left)), LocalMetaOrigin(LocalOrigin(right)))
|
||||
+
|
||||
self.cache[index + 1:]
|
||||
self.cache[:index]
|
||||
+
|
||||
(LocalMetaOrigin(LocalOrigin(left)), LocalMetaOrigin(LocalOrigin(right)))
|
||||
+
|
||||
self.cache[index + 1:]
|
||||
)
|
||||
)
|
||||
else:
|
||||
return WeakReferenceIndexSetBTree(
|
||||
(
|
||||
self.source[:self.keyend + HashPoint.HASH_LENGTH * index]
|
||||
+
|
||||
bytes(HashPoint.of(child))
|
||||
+
|
||||
self.source[self.keyend + HashPoint.HASH_LENGTH * (index + 1):]
|
||||
self.source[:self.keyend + HashPoint.HASH_LENGTH * index]
|
||||
+
|
||||
bytes(HashPoint.of(child))
|
||||
+
|
||||
self.source[self.keyend + HashPoint.HASH_LENGTH * (index + 1):]
|
||||
),
|
||||
self.height,
|
||||
self.parametres,
|
||||
self.root,
|
||||
(
|
||||
self.cache[:index]
|
||||
+
|
||||
(LocalMetaOrigin(LocalOrigin(child)),)
|
||||
+
|
||||
self.cache[index + 1:]
|
||||
self.cache[:index]
|
||||
+
|
||||
(LocalMetaOrigin(LocalOrigin(child)),)
|
||||
+
|
||||
self.cache[index + 1:]
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
from typing import Iterable
|
||||
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .wrisbtparametres import *
|
||||
from .wrisbtroot import *
|
||||
|
||||
|
@ -2,6 +2,7 @@ from typing import Iterable
|
||||
|
||||
from rainbowadn.atomic import *
|
||||
from rainbowadn.core import *
|
||||
|
||||
from .weakreferenceindexsetbtree import *
|
||||
from .wrisbtparametres import *
|
||||
|
||||
|
@ -29,6 +29,8 @@ def target_str(target) -> str:
|
||||
return name
|
||||
case object(__class__=type(__name__=name)):
|
||||
return name
|
||||
case _:
|
||||
raise TypeError
|
||||
|
||||
|
||||
def jsonify(dumped: Instrumentation) -> dict:
|
||||
|
@ -4,8 +4,9 @@ from contextlib import ExitStack
|
||||
from typing import Any, Callable, Coroutine
|
||||
|
||||
from nacl.signing import SigningKey, VerifyKey
|
||||
|
||||
from plot import *
|
||||
from trace_common import *
|
||||
|
||||
from rainbowadn.collection.trees.binary import *
|
||||
from rainbowadn.core import *
|
||||
from rainbowadn.flow13 import *
|
||||
@ -13,7 +14,6 @@ from rainbowadn.flow13 import FlowCoin
|
||||
from rainbowadn.instrument import *
|
||||
from rainbowadn.testing.resolvers import *
|
||||
from rainbowadn.v13 import *
|
||||
from trace_common import *
|
||||
|
||||
|
||||
def get_instrumentations() -> list[Instrumentation]:
|
||||
@ -91,8 +91,8 @@ async def _migrate(bank: BankBlock, params) -> BankBlock:
|
||||
|
||||
|
||||
async def _instrument(process: Callable[[], Coroutine[Any, Any, None]]) -> list[Instrumentation]:
|
||||
instrumentations: list[Instrumentation] = get_instrumentations()
|
||||
with ExitStack() as estack:
|
||||
instrumentations: list[Instrumentation] = get_instrumentations()
|
||||
for stacked in instrumentations:
|
||||
stacked.enter(estack)
|
||||
try:
|
||||
@ -167,7 +167,7 @@ if __name__ == '__main__':
|
||||
try:
|
||||
asyncio.run(
|
||||
trace(
|
||||
preset_long
|
||||
preset_short
|
||||
)
|
||||
)
|
||||
except KeyboardInterrupt:
|
||||
|
Loading…
Reference in New Issue
Block a user