minor type fix

This commit is contained in:
AF 2022-12-22 21:48:40 +00:00
parent 844dacf989
commit 5caa219ead
94 changed files with 326 additions and 205 deletions

View File

@ -1,5 +1,6 @@
import json import json
from pathlib import Path from pathlib import Path
from typing import Any
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
@ -32,7 +33,7 @@ def plot(fn: str):
plt.ylabel('concurrency (1)') plt.ylabel('concurrency (1)')
with open(fn) as file: with open(fn) as file:
jsonified: dict[str] = json.load(file) jsonified: dict[str, Any] = json.load(file)
title = fn title = fn
if (params := jsonified.pop('params', None)) is not None: 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) logplot(plt.scatter, 'ActiveBinaryTree:add:exit', c='gold', zorder=99, s=.5)
plt.legend() plt.legend()
plt.savefig(f'{fn}.png')
plt.show() plt.show()
plt.clf() plt.clf()

View File

@ -5,7 +5,7 @@ from rainbowadn.core import *
__all__ = ('Atomic',) __all__ = ('Atomic',)
AtomicMentioned = TypeVar('AtomicMentioned') AtomicMentioned = TypeVar('AtomicMentioned', bound='Atomic')
class Atomic(StaticMentionable, abc.ABC): class Atomic(StaticMentionable, abc.ABC):

View File

@ -1,10 +1,11 @@
from typing import Generic, TypeVar from typing import Generic, TypeVar
from rainbowadn.core import *
from rainbowadn.nullability import * from rainbowadn.nullability import *
__all__ = ('CollectionInterface',) __all__ = ('CollectionInterface',)
CollectionType = TypeVar('CollectionType') CollectionType = TypeVar('CollectionType', bound=Mentionable, covariant=True)
class CollectionInterface( class CollectionInterface(

View File

@ -5,7 +5,10 @@ __all__ = (
'PlainComparator', '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 .hashcomparator import HashComparator
from .keyedcomparator import KeyedComparator from .keyedcomparator import KeyedComparator
from .plaincomparator import PlainComparator from .plaincomparator import PlainComparator

View File

@ -36,7 +36,7 @@ class Duplicate(Equal):
pass pass
KeyType = TypeVar('KeyType') KeyType = TypeVar('KeyType', bound=Mentionable, contravariant=True)
class Comparator(Generic[KeyType]): class Comparator(Generic[KeyType]):

View File

@ -1,12 +1,13 @@
from typing import Generic, TypeVar from typing import Generic, TypeVar
from rainbowadn.core import * from rainbowadn.core import *
from .comparator import * from .comparator import *
from .protocolcomparator import * from .protocolcomparator import *
__all__ = ('HashComparator',) __all__ = ('HashComparator',)
KeyType = TypeVar('KeyType') KeyType = TypeVar('KeyType', bound=Mentionable, contravariant=True)
class HashComparator(ProtocolComparator[KeyType], Generic[KeyType]): class HashComparator(ProtocolComparator[KeyType], Generic[KeyType]):

View File

@ -2,11 +2,12 @@ from typing import Generic, TypeVar
from rainbowadn.collection.keyed import * from rainbowadn.collection.keyed import *
from rainbowadn.core import * from rainbowadn.core import *
from .comparator import * from .comparator import *
__all__ = ('KeyedComparator',) __all__ = ('KeyedComparator',)
ComparatorKeyType = TypeVar('ComparatorKeyType') ComparatorKeyType = TypeVar('ComparatorKeyType', bound=Mentionable, contravariant=True)
class KeyedComparator( class KeyedComparator(

View File

@ -1,5 +1,6 @@
from rainbowadn.atomic import * from rainbowadn.atomic import *
from rainbowadn.core import * from rainbowadn.core import *
from .comparator import * from .comparator import *
from .protocolcomparator import * from .protocolcomparator import *

View File

@ -1,11 +1,13 @@
import abc import abc
from typing import Generic, TypeVar from typing import Generic, TypeVar
from rainbowadn.core import *
from .comparator import * from .comparator import *
__all__ = ('ProtocolComparator',) __all__ = ('ProtocolComparator',)
KeyType = TypeVar('KeyType') KeyType = TypeVar('KeyType', bound=Mentionable, contravariant=True)
class ProtocolComparator(Comparator[KeyType], abc.ABC, Generic[KeyType]): class ProtocolComparator(Comparator[KeyType], abc.ABC, Generic[KeyType]):

View File

@ -5,7 +5,7 @@ from rainbowadn.core import *
__all__ = ('Keyed',) __all__ = ('Keyed',)
KKeyType = TypeVar('KKeyType') KKeyType = TypeVar('KKeyType', bound=Mentionable, covariant=True)
class Keyed(RecursiveMentionable, Generic[KKeyType], abc.ABC): class Keyed(RecursiveMentionable, Generic[KKeyType], abc.ABC):

View File

@ -1,12 +1,13 @@
from typing import Generic, Iterable, TypeVar from typing import Generic, Iterable, TypeVar
from rainbowadn.core import * from rainbowadn.core import *
from .keyed import * from .keyed import *
__all__ = ('KeyMetadata', 'KeyMetadataFactory',) __all__ = ('KeyMetadata', 'KeyMetadataFactory',)
ActiveKeyType = TypeVar('ActiveKeyType') ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable, covariant=True)
MetaDataType = TypeVar('MetaDataType') MetaDataType = TypeVar('MetaDataType', bound=Mentionable, covariant=True)
class KeyMetadata(Keyed[ActiveKeyType], Generic[ActiveKeyType, MetaDataType]): class KeyMetadata(Keyed[ActiveKeyType], Generic[ActiveKeyType, MetaDataType]):

View File

@ -2,12 +2,13 @@ from typing import Generic, TypeVar
from rainbowadn.core import * from rainbowadn.core import *
from rainbowadn.inlining import * from rainbowadn.inlining import *
from .keyed import * from .keyed import *
__all__ = ('KeyValue',) __all__ = ('KeyValue',)
KVKeyType = TypeVar('KVKeyType') KVKeyType = TypeVar('KVKeyType', bound=Mentionable)
KVValueType = TypeVar('KVValueType') KVValueType = TypeVar('KVValueType', bound=Mentionable)
class KeyValue(Keyed[KVKeyType], IAuto, Generic[KVKeyType, KVValueType]): class KeyValue(Keyed[KVKeyType], IAuto, Generic[KVKeyType, KVValueType]):
@ -36,6 +37,7 @@ class KeyValue(Keyed[KVKeyType], IAuto, Generic[KVKeyType, KVValueType]):
def f( def f(
cls, f0: RainbowFactory[KVKeyType], f1: RainbowFactory[KVValueType] cls, f0: RainbowFactory[KVKeyType], f1: RainbowFactory[KVValueType]
) -> RainbowFactory['KeyValue[KVKeyType, KVValueType]']: ) -> RainbowFactory['KeyValue[KVKeyType, KVValueType]']:
assert issubclass(cls, KeyValue)
assert isinstance(f0, RainbowFactory) assert isinstance(f0, RainbowFactory)
assert isinstance(f1, RainbowFactory) assert isinstance(f1, RainbowFactory)
return cls.auto_f(f0, f1) return cls.auto_f(f0, f1)

View File

@ -3,5 +3,5 @@ __all__ = (
'TLRoot', 'TLRootFactory', 'TLRParametres', 'TLRoot', 'TLRootFactory', 'TLRParametres',
) )
from .array import Array, ArrayFactory from ._array import Array, ArrayFactory
from .treelist import TLRParametres, TLRoot, TLRootFactory from .treelist import TLRoot, TLRootFactory, TLRParametres

View File

@ -4,7 +4,7 @@ from rainbowadn.core import *
__all__ = ('Array', 'ArrayFactory',) __all__ = ('Array', 'ArrayFactory',)
ElementType = TypeVar('ElementType') ElementType = TypeVar('ElementType', bound=Mentionable, covariant=True)
class Array(RecursiveMentionable, Generic[ElementType]): class Array(RecursiveMentionable, Generic[ElementType]):

View File

@ -1,11 +1,12 @@
from typing import Generic, Iterable, TypeVar from typing import Generic, Iterable, TypeVar
from rainbowadn.core import * from rainbowadn.core import *
from .tlparametres import * from .tlparametres import *
__all__ = ('TLNode', 'TLNodeFactory',) __all__ = ('TLNode', 'TLNodeFactory',)
ElementType = TypeVar('ElementType') ElementType = TypeVar('ElementType', bound=Mentionable)
class TLNode(RecursiveMentionable, Generic[ElementType]): class TLNode(RecursiveMentionable, Generic[ElementType]):
@ -101,9 +102,10 @@ class TLNode(RecursiveMentionable, Generic[ElementType]):
return await self.node_no_resolved(self.nodes - 1) return await self.node_no_resolved(self.nodes - 1)
async def add(self, element: HashPoint[ElementType]) -> 'TLNode[ElementType]': async def add(self, element: HashPoint[ElementType]) -> 'TLNode[ElementType]':
assert isinstance(self, TLNode)
assert isinstance(element, HashPoint) assert isinstance(element, HashPoint)
if self.parametres.full: if self.parametres.full:
self_hp = HashPoint.of(self) self_hp: HashPoint[TLNode[ElementType]] = HashPoint.of(self)
assert isinstance(self_hp, HashPoint) assert isinstance(self_hp, HashPoint)
unit = self.unit(element) unit = self.unit(element)
assert isinstance(unit, TLNode) assert isinstance(unit, TLNode)
@ -112,7 +114,7 @@ class TLNode(RecursiveMentionable, Generic[ElementType]):
return TLNode( return TLNode(
bytes(self_hp) + bytes(unit_hp), bytes(self_hp) + bytes(unit_hp),
self.parametres.superparams(), self.parametres.superparams(),
(LocalMetaOrigin(self_hp.origin), LocalMetaOrigin(unit_hp.origin)), (LocalMetaOrigin(self_hp.origin), LocalMetaOrigin(unit_hp.origin),),
(), (),
) )
elif self.parametres.leaf: elif self.parametres.leaf:

View File

@ -1,10 +1,12 @@
from typing import Generic, TypeVar from typing import Generic, TypeVar
from rainbowadn.core import *
from .tlrparametres import * from .tlrparametres import *
__all__ = ('TLParametres',) __all__ = ('TLParametres',)
ElementType = TypeVar('ElementType') ElementType = TypeVar('ElementType', bound=Mentionable)
class TLParametres( class TLParametres(

View File

@ -2,13 +2,14 @@ from typing import Generic, Iterable, TypeVar
from rainbowadn.atomic import * from rainbowadn.atomic import *
from rainbowadn.core import * from rainbowadn.core import *
from .tlnode import * from .tlnode import *
from .tlparametres import * from .tlparametres import *
from .tlrparametres import * from .tlrparametres import *
__all__ = ('TLRoot', 'TLRootFactory',) __all__ = ('TLRoot', 'TLRootFactory',)
ElementType = TypeVar('ElementType') ElementType = TypeVar('ElementType', bound=Mentionable)
class TLRoot(RecursiveMentionable, Generic[ElementType]): class TLRoot(RecursiveMentionable, Generic[ElementType]):

View File

@ -4,7 +4,7 @@ from rainbowadn.core import *
__all__ = ('TLRParametres',) __all__ = ('TLRParametres',)
ElementType = TypeVar('ElementType') ElementType = TypeVar('ElementType', bound=Mentionable)
class TLRParametres( class TLRParametres(

View File

@ -7,5 +7,8 @@ __all__ = (
from .binaryaction import BinaryAction from .binaryaction import BinaryAction
from .compareaction import CompareAction 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 from .symmetric import InnerOuter, OuterInner, Symmetric

View File

@ -1,12 +1,13 @@
from typing import Generic, TypeVar from typing import Generic, TypeVar
from rainbowadn.collection.trees.binary.core import * from rainbowadn.collection.trees.binary.core import *
from rainbowadn.core import *
__all__ = ('BinaryAction',) __all__ = ('BinaryAction',)
TreeType = TypeVar('TreeType') TreeType = TypeVar('TreeType')
ActiveKeyType = TypeVar('ActiveKeyType') ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
MetaDataType = TypeVar('MetaDataType') MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
ActionType = TypeVar('ActionType') ActionType = TypeVar('ActionType')

View File

@ -4,13 +4,14 @@ from typing import Generic, TypeVar
from rainbowadn.collection.comparison import * from rainbowadn.collection.comparison import *
from rainbowadn.collection.trees.binary.core import * from rainbowadn.collection.trees.binary.core import *
from rainbowadn.core import * from rainbowadn.core import *
from .binaryaction import * from .binaryaction import *
__all__ = ('CompareAction',) __all__ = ('CompareAction',)
TreeType = TypeVar('TreeType') TreeType = TypeVar('TreeType')
ActiveKeyType = TypeVar('ActiveKeyType') ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
MetaDataType = TypeVar('MetaDataType') MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
ActionType = TypeVar('ActionType') ActionType = TypeVar('ActionType')

View File

@ -3,14 +3,15 @@ from typing import Generic, TypeVar
from rainbowadn.collection.comparison import * from rainbowadn.collection.comparison import *
from rainbowadn.collection.trees.binary.core import * from rainbowadn.collection.trees.binary.core import *
from rainbowadn.core import * from rainbowadn.core import *
from .binaryaction import * from .binaryaction import *
from .compareaction import * from .compareaction import *
__all__ = ('AddAction', 'RemoveAction', 'ContainsAction', 'SplitAction', 'UnionAction', 'MergeAction',) __all__ = ('AddAction', 'RemoveAction', 'ContainsAction', 'SplitAction', 'UnionAction', 'MergeAction',)
TreeType = TypeVar('TreeType') TreeType = TypeVar('TreeType')
ActiveKeyType = TypeVar('ActiveKeyType') ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
MetaDataType = TypeVar('MetaDataType') MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
class AddAction( class AddAction(

View File

@ -6,8 +6,8 @@ from rainbowadn.core import *
__all__ = ('Symmetric', 'InnerOuter', 'OuterInner',) __all__ = ('Symmetric', 'InnerOuter', 'OuterInner',)
TreeType = TypeVar('TreeType') TreeType = TypeVar('TreeType')
ActiveKeyType = TypeVar('ActiveKeyType') ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
MetaDataType = TypeVar('MetaDataType') MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
class Symmetric( class Symmetric(
@ -55,7 +55,10 @@ class Symmetric(
return BinaryProtocolized(self.protocol, self.outer(split)) return BinaryProtocolized(self.protocol, self.outer(split))
class InnerOuter(Symmetric): class InnerOuter(
Symmetric[ActiveKeyType, MetaDataType, TreeType],
Generic[ActiveKeyType, MetaDataType, TreeType]
):
def inner( def inner(
self, self,
split: BinarySplit[ActiveKeyType, MetaDataType, TreeType] split: BinarySplit[ActiveKeyType, MetaDataType, TreeType]
@ -80,7 +83,10 @@ class InnerOuter(Symmetric):
return await self.protocol.tree(inner, outer, key) return await self.protocol.tree(inner, outer, key)
class OuterInner(Symmetric): class OuterInner(
Symmetric[ActiveKeyType, MetaDataType, TreeType],
Generic[ActiveKeyType, MetaDataType, TreeType]
):
def inner( def inner(
self, self,
split: BinarySplit[ActiveKeyType, MetaDataType, TreeType] split: BinarySplit[ActiveKeyType, MetaDataType, TreeType]

View File

@ -4,14 +4,15 @@ from rainbowadn.collection.collectioninterface import *
from rainbowadn.collection.keymetadata import * from rainbowadn.collection.keymetadata import *
from rainbowadn.core import * from rainbowadn.core import *
from rainbowadn.nullability import * from rainbowadn.nullability import *
from .actions import * from .actions import *
from .binarytree import * from .binarytree import *
from .core import * from .core import *
__all__ = ('ActiveBinaryTree',) __all__ = ('ActiveBinaryTree',)
ActiveKeyType = TypeVar('ActiveKeyType') ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
MetaDataType = TypeVar('MetaDataType') MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
class ActiveBinaryTree( class ActiveBinaryTree(

View File

@ -3,12 +3,13 @@ from typing import Generic, Optional, TypeVar
from rainbowadn.atomic import * from rainbowadn.atomic import *
from rainbowadn.collection.comparison import * from rainbowadn.collection.comparison import *
from rainbowadn.core import * from rainbowadn.core import *
from .actions import * from .actions import *
from .core import * from .core import *
__all__ = ('AVL',) __all__ = ('AVL',)
ActiveKeyType = TypeVar('ActiveKeyType') ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
TreeType = TypeVar('TreeType') TreeType = TypeVar('TreeType')
@ -138,11 +139,11 @@ class BalanceAction(
delta = height_l - height_r delta = height_l - height_r
assert isinstance(delta, int) assert isinstance(delta, int)
if delta < -1: if delta < -1:
splitr: BinarySplit[ActiveKeyType, Integer, TreeType] splitr: BinarySplit[ActiveKeyType, Integer, TreeType] | None
assert isinstance(splitr, BinarySplit) assert isinstance(splitr, BinarySplit)
return await self.on_symmetric(InnerOuter(case.protocol), case.split.treel, case.split.key, splitr) return await self.on_symmetric(InnerOuter(case.protocol), case.split.treel, case.split.key, splitr)
elif delta > 1: elif delta > 1:
splitl: BinarySplit[ActiveKeyType, Integer, TreeType] splitl: BinarySplit[ActiveKeyType, Integer, TreeType] | None
assert isinstance(splitl, BinarySplit) assert isinstance(splitl, BinarySplit)
return await self.on_symmetric(OuterInner(case.protocol), case.split.treer, case.split.key, splitl) return await self.on_symmetric(OuterInner(case.protocol), case.split.treer, case.split.key, splitl)
else: else:
@ -166,7 +167,7 @@ class BalanceAction(
assert isinstance(height_oi, int) assert isinstance(height_oi, int)
assert isinstance(height_oo, int) assert isinstance(height_oo, int)
if height_oi > height_oo: if height_oi > height_oo:
splitoi: BinarySplit[ActiveKeyType, Integer, TreeType] splitoi: BinarySplit[ActiveKeyType, Integer, TreeType] | None
assert isinstance(splitoi, BinarySplit) assert isinstance(splitoi, BinarySplit)
inner, outer = await gather( inner, outer = await gather(
symmetry.tree(treei, symmetry.inner(splitoi), key), symmetry.tree(treei, symmetry.inner(splitoi), key),

View File

@ -5,7 +5,7 @@ from rainbowadn.nullability import *
__all__ = ('BinaryTree', 'BinaryTreeFactory',) __all__ = ('BinaryTree', 'BinaryTreeFactory',)
TreeKeyType = TypeVar('TreeKeyType') TreeKeyType = TypeVar('TreeKeyType', bound=Mentionable)
class BinaryTree(RecursiveMentionable, Generic[TreeKeyType]): class BinaryTree(RecursiveMentionable, Generic[TreeKeyType]):
@ -28,7 +28,7 @@ class BinaryTree(RecursiveMentionable, Generic[TreeKeyType]):
assert isinstance(key, Mentionable) assert isinstance(key, Mentionable)
self.treel = treel self.treel = treel
self.treer = treer self.treer = treer
self.key = key self.key: TreeKeyType = key
def points(self) -> Iterable[HashPoint]: def points(self) -> Iterable[HashPoint]:
return [*self.treel.points(), *self.treer.points(), *RecursiveMentionable.points_of(self.key)] return [*self.treel.points(), *self.treer.points(), *RecursiveMentionable.points_of(self.key)]

View File

@ -2,6 +2,7 @@ import abc
from typing import Generic, TypeVar from typing import Generic, TypeVar
from rainbowadn.core import * from rainbowadn.core import *
from .binarybalancing import * from .binarybalancing import *
from .binarycreation import * from .binarycreation import *
from .binaryprotocolized import * from .binaryprotocolized import *
@ -9,8 +10,8 @@ from .binaryprotocolized import *
__all__ = ('BalancedCreation',) __all__ = ('BalancedCreation',)
TreeType = TypeVar('TreeType') TreeType = TypeVar('TreeType')
ActiveKeyType = TypeVar('ActiveKeyType') ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
MetaDataType = TypeVar('MetaDataType') MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
class BalancedCreation( class BalancedCreation(

View File

@ -3,14 +3,15 @@ from typing import Generic, TypeVar
from rainbowadn.collection.comparison import * from rainbowadn.collection.comparison import *
from rainbowadn.core import * from rainbowadn.core import *
from .binarymetadata import * from .binarymetadata import *
from .binaryprotocolized import * from .binaryprotocolized import *
__all__ = ('BinaryBalancing',) __all__ = ('BinaryBalancing',)
TreeType = TypeVar('TreeType') TreeType = TypeVar('TreeType')
ActiveKeyType = TypeVar('ActiveKeyType') ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
MetaDataType = TypeVar('MetaDataType') MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
class BinaryBalancing( class BinaryBalancing(

View File

@ -2,13 +2,14 @@ from typing import Generic, Optional, TypeVar
from rainbowadn.collection.comparison import * from rainbowadn.collection.comparison import *
from rainbowadn.core import * from rainbowadn.core import *
from .binarysplit import * from .binarysplit import *
__all__ = ('BinaryCreation',) __all__ = ('BinaryCreation',)
TreeType = TypeVar('TreeType') TreeType = TypeVar('TreeType')
ActiveKeyType = TypeVar('ActiveKeyType') ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
MetaDataType = TypeVar('MetaDataType') MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
class BinaryCreation(Generic[ActiveKeyType, MetaDataType, TreeType]): class BinaryCreation(Generic[ActiveKeyType, MetaDataType, TreeType]):

View File

@ -1,13 +1,14 @@
from typing import Generic, TypeVar from typing import Generic, TypeVar
from rainbowadn.core import * from rainbowadn.core import *
from .binarycreation import * from .binarycreation import *
__all__ = ('BinaryMetadata',) __all__ = ('BinaryMetadata',)
TreeType = TypeVar('TreeType') TreeType = TypeVar('TreeType')
ActiveKeyType = TypeVar('ActiveKeyType') ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
MetaDataType = TypeVar('MetaDataType') MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
class BinaryMetadata(Generic[ActiveKeyType, MetaDataType, TreeType]): class BinaryMetadata(Generic[ActiveKeyType, MetaDataType, TreeType]):

View File

@ -1,13 +1,15 @@
from typing import Generic, Optional, TypeVar from typing import Generic, Optional, TypeVar
from rainbowadn.core import *
from .binarycreation import * from .binarycreation import *
from .binarysplit import * from .binarysplit import *
__all__ = ('BinaryProtocolized',) __all__ = ('BinaryProtocolized',)
TreeType = TypeVar('TreeType') TreeType = TypeVar('TreeType')
ActiveKeyType = TypeVar('ActiveKeyType') ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
MetaDataType = TypeVar('MetaDataType') MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
class BinaryProtocolized( class BinaryProtocolized(

View File

@ -5,8 +5,8 @@ from rainbowadn.core import *
__all__ = ('BinarySplit',) __all__ = ('BinarySplit',)
TreeType = TypeVar('TreeType') TreeType = TypeVar('TreeType')
ActiveKeyType = TypeVar('ActiveKeyType') ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
MetaDataType = TypeVar('MetaDataType') MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
class BinarySplit( class BinarySplit(

View File

@ -1,6 +1,7 @@
from typing import Generic, Optional, TypeVar from typing import Generic, Optional, TypeVar
from rainbowadn.core import * from rainbowadn.core import *
from .binarycreation import * from .binarycreation import *
from .binaryprotocolized import * from .binaryprotocolized import *
from .binarysplit import * from .binarysplit import *
@ -8,8 +9,8 @@ from .binarysplit import *
__all__ = ('ProtocolizedBinarySplit',) __all__ = ('ProtocolizedBinarySplit',)
TreeType = TypeVar('TreeType') TreeType = TypeVar('TreeType')
ActiveKeyType = TypeVar('ActiveKeyType') ActiveKeyType = TypeVar('ActiveKeyType', bound=Mentionable)
MetaDataType = TypeVar('MetaDataType') MetaDataType = TypeVar('MetaDataType', bound=Mentionable)
class ProtocolizedBinarySplit( class ProtocolizedBinarySplit(

View File

@ -17,11 +17,20 @@ __all__ = (
'StaticMentionable', 'StaticFactory', '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 .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 .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 .hashresolver import HashResolver
from .localmetaorigin import LocalMetaOrigin from .localmetaorigin import LocalMetaOrigin
from .localorigin import LocalOrigin from .localorigin import LocalOrigin

View File

@ -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',) __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') T = TypeVar('T')
def assert_none(value: Optional[T]) -> bool: def assert_none(value: Optional[Any]) -> bool:
assert value is None assert value is None
return True return True

View File

@ -8,11 +8,11 @@ from .resolvermetaorigin import *
__all__ = ('ExtendableResolver',) __all__ = ('ExtendableResolver',)
Mentioned = TypeVar('Mentioned') Mentioned = TypeVar('Mentioned', bound=Mentionable)
class ExtendableResolver(HashResolver, abc.ABC): 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 raise NotImplementedError
async def migrate(self, hash_point: HashPoint[Mentioned]) -> HashPoint[Mentioned]: async def migrate(self, hash_point: HashPoint[Mentioned]) -> HashPoint[Mentioned]:

View File

@ -3,11 +3,11 @@ from typing import Any, AsyncIterable, Awaitable, Coroutine, TypeVar, overload
__all__ = ('gather', 'asum', 'alist', 'set_gather_asyncio', 'set_gather_linear', 'aidentity',) __all__ = ('gather', 'asum', 'alist', 'set_gather_asyncio', 'set_gather_linear', 'aidentity',)
_gather = asyncio.gather _gather: Any = asyncio.gather
async def _local_gather(*args): async def _local_gather(*args):
return [await arg for arg in args] return tuple([await arg for arg in args])
def set_gather_asyncio(): def set_gather_asyncio():
@ -31,6 +31,7 @@ T4 = TypeVar('T4')
def gather( def gather(
a0: Coroutine[Any, Any, T0], a0: Coroutine[Any, Any, T0],
a1: Coroutine[Any, Any, T1], a1: Coroutine[Any, Any, T1],
/
) -> Awaitable[tuple[T0, T1]]: ... ) -> Awaitable[tuple[T0, T1]]: ...
@ -39,6 +40,7 @@ def gather(
a0: Coroutine[Any, Any, T0], a0: Coroutine[Any, Any, T0],
a1: Coroutine[Any, Any, T1], a1: Coroutine[Any, Any, T1],
a2: Coroutine[Any, Any, T2], a2: Coroutine[Any, Any, T2],
/
) -> Awaitable[tuple[T0, T1, T2]]: ... ) -> Awaitable[tuple[T0, T1, T2]]: ...
@ -48,6 +50,7 @@ def gather(
a1: Coroutine[Any, Any, T1], a1: Coroutine[Any, Any, T1],
a2: Coroutine[Any, Any, T2], a2: Coroutine[Any, Any, T2],
a3: Coroutine[Any, Any, T3], a3: Coroutine[Any, Any, T3],
/
) -> Awaitable[tuple[T0, T1, T2, T3]]: ... ) -> Awaitable[tuple[T0, T1, T2, T3]]: ...
@ -58,6 +61,7 @@ def gather(
a2: Coroutine[Any, Any, T2], a2: Coroutine[Any, Any, T2],
a3: Coroutine[Any, Any, T3], a3: Coroutine[Any, Any, T3],
a4: Coroutine[Any, Any, T4], a4: Coroutine[Any, Any, T4],
/
) -> Awaitable[tuple[T0, T1, T2, T3, T4]]: ... ) -> Awaitable[tuple[T0, T1, T2, T3, T4]]: ...

View File

@ -9,7 +9,8 @@ from .rainbow_factory import *
__all__ = ('HashPoint',) __all__ = ('HashPoint',)
Mentioned = TypeVar('Mentioned') Mentioned = TypeVar('Mentioned', bound=Mentionable, covariant=True)
MentionedI = TypeVar('MentionedI', bound=Mentionable)
def _hash(source: bytes) -> bytes: def _hash(source: bytes) -> bytes:
@ -54,7 +55,8 @@ class HashPoint(Generic[Mentioned]):
return topology_hash + bytes(mentioned) return topology_hash + bytes(mentioned)
@classmethod @classmethod
def of(cls, mentioned: Mentioned) -> 'HashPoint[Mentioned]': def of(cls, mentioned: MentionedI) -> 'HashPoint[MentionedI]':
assert issubclass(cls, HashPoint)
assert isinstance(mentioned, Mentionable) assert isinstance(mentioned, Mentionable)
return cls( return cls(
cls.hash(cls.bytes_of_mentioned(mentioned)), LocalOrigin(mentioned) cls.hash(cls.bytes_of_mentioned(mentioned)), LocalOrigin(mentioned)

View File

@ -2,13 +2,14 @@ from typing import Generic, TypeVar
from .asserts import * from .asserts import *
from .hashpoint import * from .hashpoint import *
from .mentionable import *
from .metaorigin import * from .metaorigin import *
from .origin import * from .origin import *
from .rainbow_factory import * from .rainbow_factory import *
__all__ = ('LocalMetaOrigin',) __all__ = ('LocalMetaOrigin',)
Mentioned = TypeVar('Mentioned') Mentioned = TypeVar('Mentioned', bound=Mentionable)
class LocalMetaOrigin(MetaOrigin[Mentioned], Generic[Mentioned]): class LocalMetaOrigin(MetaOrigin[Mentioned], Generic[Mentioned]):

View File

@ -2,12 +2,13 @@ from typing import Generic, TypeVar
from .asserts import * from .asserts import *
from .hashpoint import * from .hashpoint import *
from .mentionable import *
from .origin import * from .origin import *
from .rainbow_factory import * from .rainbow_factory import *
__all__ = ('MetaOrigin',) __all__ = ('MetaOrigin',)
Mentioned = TypeVar('Mentioned') Mentioned = TypeVar('Mentioned', bound=Mentionable, covariant=True)
class MetaOrigin(Generic[Mentioned]): class MetaOrigin(Generic[Mentioned]):

View File

@ -4,7 +4,7 @@ from .rainbow_factory import *
__all__ = ('Origin',) __all__ = ('Origin',)
Mentioned = TypeVar('Mentioned') Mentioned = TypeVar('Mentioned', covariant=True)
class Origin(Generic[Mentioned]): class Origin(Generic[Mentioned]):

View File

@ -4,7 +4,7 @@ from .hashresolver import *
__all__ = ('RainbowFactory',) __all__ = ('RainbowFactory',)
Mentioned = TypeVar('Mentioned') Mentioned = TypeVar('Mentioned', covariant=True)
class RainbowFactory(Generic[Mentioned]): class RainbowFactory(Generic[Mentioned]):

View File

@ -3,6 +3,7 @@ from typing import Generic, TypeVar
from .asserts import * from .asserts import *
from .hashpoint import * from .hashpoint import *
from .hashresolver import * from .hashresolver import *
from .mentionable import *
from .metaorigin import * from .metaorigin import *
from .origin import * from .origin import *
from .rainbow_factory import * from .rainbow_factory import *
@ -10,7 +11,7 @@ from .resolverorigin import *
__all__ = ('ResolverMetaOrigin',) __all__ = ('ResolverMetaOrigin',)
Mentioned = TypeVar('Mentioned') Mentioned = TypeVar('Mentioned', bound=Mentionable, covariant=True)
class ResolverMetaOrigin(MetaOrigin[Mentioned], Generic[Mentioned]): class ResolverMetaOrigin(MetaOrigin[Mentioned], Generic[Mentioned]):

View File

@ -9,7 +9,7 @@ from .rainbow_factory import *
__all__ = ('ResolverOrigin',) __all__ = ('ResolverOrigin',)
Mentioned = TypeVar('Mentioned') Mentioned = TypeVar('Mentioned', bound=Mentionable, covariant=True)
class ResolverOrigin(Origin[Mentioned], Generic[Mentioned]): class ResolverOrigin(Origin[Mentioned], Generic[Mentioned]):

View File

@ -7,7 +7,7 @@ from .rainbow_factory import *
__all__ = ('StaticMentionable', 'StaticFactory',) __all__ = ('StaticMentionable', 'StaticFactory',)
StaticMentioned = TypeVar('StaticMentioned') StaticMentioned = TypeVar('StaticMentioned', bound='StaticMentionable')
class StaticMentionable(Mentionable, abc.ABC): class StaticMentionable(Mentionable, abc.ABC):

View File

@ -7,7 +7,7 @@ from rainbowadn.core import *
__all__ = ('Encrypted', 'EncryptedFactory',) __all__ = ('Encrypted', 'EncryptedFactory',)
EncryptedType = TypeVar('EncryptedType') EncryptedType = TypeVar('EncryptedType', bound=Mentionable)
class Encrypted(RecursiveMentionable, Generic[EncryptedType]): class Encrypted(RecursiveMentionable, Generic[EncryptedType]):

View File

@ -4,8 +4,8 @@ from ._mapper import Mapper
__all__ = ('CallableMapper',) __all__ = ('CallableMapper',)
Element = TypeVar('Element') Element = TypeVar('Element', contravariant=True)
Mapped = TypeVar('Mapped') Mapped = TypeVar('Mapped', covariant=True)
class CallableMapper( class CallableMapper(

View File

@ -4,9 +4,9 @@ from ._mapper import *
__all__ = ('Composition',) __all__ = ('Composition',)
Element = TypeVar('Element') Element = TypeVar('Element', contravariant=True)
Middle = TypeVar('Middle') Middle = TypeVar('Middle')
Mapped = TypeVar('Mapped') Mapped = TypeVar('Mapped', covariant=True)
class Composition( class Composition(

View File

@ -2,8 +2,8 @@ from typing import Any, Callable, Coroutine, Generic, TypeVar
__all__ = ('Mapper',) __all__ = ('Mapper',)
Element = TypeVar('Element') Element = TypeVar('Element', contravariant=True)
Mapped = TypeVar('Mapped') Mapped = TypeVar('Mapped', covariant=True)
class Mapper(Generic[Element, Mapped]): class Mapper(Generic[Element, Mapped]):

View File

@ -1,12 +1,13 @@
from typing import Any, Callable, Coroutine, Generic, TypeVar from typing import Any, Callable, Coroutine, Generic, TypeVar
from rainbowadn.core import * from rainbowadn.core import *
from ._mapper import * from ._mapper import *
from ._reduce import * from ._reduce import *
__all__ = ('MapReduce',) __all__ = ('MapReduce',)
Element = TypeVar('Element') Element = TypeVar('Element', contravariant=True)
Mapped = TypeVar('Mapped') Mapped = TypeVar('Mapped')
Out = TypeVar('Out') Out = TypeVar('Out')

View File

@ -7,7 +7,7 @@ from ._reducer import *
__all__ = ('MapReducer',) __all__ = ('MapReducer',)
Element = TypeVar('Element') Element = TypeVar('Element', contravariant=True)
Mapped = TypeVar('Mapped') Mapped = TypeVar('Mapped')
Out = TypeVar('Out') Out = TypeVar('Out')

View File

@ -4,7 +4,7 @@ from rainbowadn.core import *
__all__ = ('Reduce',) __all__ = ('Reduce',)
Element = TypeVar('Element') Element = TypeVar('Element', contravariant=True)
Out = TypeVar('Out') Out = TypeVar('Out')

View File

@ -4,7 +4,7 @@ from ._reduce import *
__all__ = ('Reducer',) __all__ = ('Reducer',)
Element = TypeVar('Element') Element = TypeVar('Element', contravariant=True)
Out = TypeVar('Out') Out = TypeVar('Out')

View File

@ -4,8 +4,8 @@ from rainbowadn.flow.core import *
__all__ = ('ConstMapper',) __all__ = ('ConstMapper',)
Element = TypeVar('Element') Element = TypeVar('Element', contravariant=True)
Mapped = TypeVar('Mapped') Mapped = TypeVar('Mapped', covariant=True)
class ConstMapper(Mapper[Element, Mapped], Generic[Element, Mapped]): class ConstMapper(Mapper[Element, Mapped], Generic[Element, Mapped]):

View File

@ -4,7 +4,7 @@ from rainbowadn.flow.core import *
__all__ = ('UnitReducer',) __all__ = ('UnitReducer',)
Element = TypeVar('Element') Element = TypeVar('Element', contravariant=True)
Out = TypeVar('Out') Out = TypeVar('Out')

View File

@ -2,11 +2,12 @@ from typing import Generic, TypeVar
from rainbowadn.core import * from rainbowadn.core import *
from rainbowadn.flow.core import * from rainbowadn.flow.core import *
from ._verification import * from ._verification import *
__all__ = ('CompositionVerification',) __all__ = ('CompositionVerification',)
Verified = TypeVar('Verified') Verified = TypeVar('Verified', contravariant=True)
Middle = TypeVar('Middle') Middle = TypeVar('Middle')

View File

@ -1,11 +1,12 @@
from typing import Generic, TypeVar from typing import Generic, TypeVar
from rainbowadn.flow.core import * from rainbowadn.flow.core import *
from ._verification import * from ._verification import *
__all__ = ('MapperVerification',) __all__ = ('MapperVerification',)
Verified = TypeVar('Verified') Verified = TypeVar('Verified', contravariant=True)
class MapperVerification(Verification[Verified], Generic[Verified]): class MapperVerification(Verification[Verified], Generic[Verified]):

View File

@ -2,12 +2,13 @@ from typing import Generic, TypeVar
from rainbowadn.core import * from rainbowadn.core import *
from rainbowadn.flow.core import * from rainbowadn.flow.core import *
from ._verification import * from ._verification import *
from ._verifyreduce import * from ._verifyreduce import *
__all__ = ('ReduceVerification',) __all__ = ('ReduceVerification',)
Verified = TypeVar('Verified') Verified = TypeVar('Verified', contravariant=True)
class ReduceVerification( class ReduceVerification(

View File

@ -5,7 +5,7 @@ from rainbowadn.flow.core import *
__all__ = ('Verification',) __all__ = ('Verification',)
Verified = TypeVar('Verified') Verified = TypeVar('Verified', contravariant=True)
class Verification( class Verification(

View File

@ -5,7 +5,7 @@ from rainbowadn.flow.core import *
from rainbowadn.flow.verification.core import * from rainbowadn.flow.verification.core import *
from rainbowadn.nullability import * from rainbowadn.nullability import *
__all__ = ('StateVerification',) __all__ = ('StateVerification', 'SVF',)
Header = TypeVar('Header') Header = TypeVar('Header')
State = TypeVar('State') State = TypeVar('State')
@ -19,7 +19,7 @@ class StateVerification(
def __init__( def __init__(
self, self,
mapper: Mapper[Link, tuple[Header, State]], 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(mapper, Mapper)
assert isinstance(verification, Mapper) assert isinstance(verification, Mapper)
@ -58,3 +58,12 @@ class StateVerification(
def loose(self) -> Verification[tuple[Nullable[Link], Link]]: def loose(self) -> Verification[tuple[Nullable[Link], Link]]:
return self 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)

View File

@ -12,4 +12,7 @@ from ._flowblock import FlowBlock, FlowBlockFactory, FlowBlockVerification
from ._flowcheque import FlowCheque from ._flowcheque import FlowCheque
from ._flowiterate import FlowIterate from ._flowiterate import FlowIterate
from ._flowstandard import FlowStandard from ._flowstandard import FlowStandard
from ._flowtransaction import FlowCoin, FlowCoinData, FlowTransaction, FlowTransactionData from ._flowtransaction import (
FlowCoin, FlowCoinData, FlowTransaction,
FlowTransactionData
)

View File

@ -5,6 +5,7 @@ from rainbowadn.flow.core import *
from rainbowadn.flow.verification.core import * from rainbowadn.flow.verification.core import *
from rainbowadn.inlining import * from rainbowadn.inlining import *
from rainbowadn.nullability import * from rainbowadn.nullability import *
from ._bankflow import * from ._bankflow import *
from ._flowbank import * from ._flowbank import *
from ._flowblock import * from ._flowblock import *
@ -42,7 +43,8 @@ class BankBlock:
@classmethod @classmethod
def verification(cls) -> Verification[Index]: 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: async def verify(self) -> bool:
assert_true(await self.verification().verify(await FlowBlock.outer_of(self.link_factory(), self.reference))) assert_true(await self.verification().verify(await FlowBlock.outer_of(self.link_factory(), self.reference)))

View File

@ -8,6 +8,7 @@ from rainbowadn.flow.verification.core import *
from rainbowadn.flow.verification.stateverification import * from rainbowadn.flow.verification.stateverification import *
from rainbowadn.inlining import * from rainbowadn.inlining import *
from rainbowadn.nullability import * from rainbowadn.nullability import *
from ._flowbank import * from ._flowbank import *
from ._flowcheque import * from ._flowcheque import *
from ._flowstandard import * from ._flowstandard import *
@ -21,7 +22,7 @@ Link: TypeAlias = IPair[FlowCheque, FlowBank]
class BankFlow( class BankFlow(
Verification[ Verification[
tuple[Nullable[HashPoint[FlowBank]], HashPoint[FlowCheque], HashPoint[FlowBank]] tuple[Nullable[FlowBank], FlowCheque, FlowBank]
], ],
): ):
def __init__(self, initial: FlowBank): def __init__(self, initial: FlowBank):
@ -157,12 +158,13 @@ class BankFlow(
assert isinstance(bank, FlowBank) assert isinstance(bank, FlowBank)
return cheque, bank return cheque, bank
return StateVerification( svf: SVF[FlowCheque, FlowBank, HashPoint[Link]] = SVF()
return svf.make(
Decomposition(), Decomposition(),
self.loose() self.loose()
).loose() )
def loose(self) -> Verification[ def loose(self) -> Verification[
tuple[Nullable[HashPoint[FlowBank]], HashPoint[FlowCheque], HashPoint[FlowBank]] tuple[Nullable[FlowBank], FlowCheque, FlowBank]
]: ]:
return self return self

View File

@ -9,8 +9,8 @@ from rainbowadn.flow.core import *
__all__ = ('BinaryReducer', 'VerifySubsetAction', 'CheckResult',) __all__ = ('BinaryReducer', 'VerifySubsetAction', 'CheckResult',)
KeyT = TypeVar('KeyT') KeyT = TypeVar('KeyT', bound=Mentionable)
MetadataT = TypeVar('MetadataT') MetadataT = TypeVar('MetadataT', bound=Mentionable)
TreeT = TypeVar('TreeT') TreeT = TypeVar('TreeT')
Out = TypeVar('Out') Out = TypeVar('Out')
@ -38,7 +38,7 @@ class BinaryReducerAction(
BinaryAction[KeyT, MetadataT, TreeT, Out], BinaryAction[KeyT, MetadataT, TreeT, Out],
Generic[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) assert isinstance(reduce, Reduce)
self.reduce = reduce self.reduce = reduce

View File

@ -2,6 +2,7 @@ from typing import Iterable
from rainbowadn.collection.comparison import * from rainbowadn.collection.comparison import *
from rainbowadn.core import * from rainbowadn.core import *
from ._flowstandard import * from ._flowstandard import *
from ._flowtransaction import * from ._flowtransaction import *

View File

@ -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.collection.comparison import *
from rainbowadn.core import * from rainbowadn.core import *
from rainbowadn.flow.verification.core import * from rainbowadn.flow.verification.core import *
from rainbowadn.nullability import * from rainbowadn.nullability import *
from ._flowstandard import * from ._flowstandard import *
__all__ = ('FlowBlock', 'FlowBlockFactory', 'FlowBlockVerification',) __all__ = ('FlowBlock', 'FlowBlockFactory', 'FlowBlockVerification', 'FBVF',)
LinkT = TypeVar('LinkT') LinkT = TypeVar('LinkT', bound=Mentionable)
FBL: TypeAlias = 'FlowBlock[LinkT]'
Index: TypeAlias = FlowStandard[FBL]
class FlowBlock(Generic[LinkT], RecursiveMentionable): class FlowBlock(Generic[LinkT], RecursiveMentionable):
@ -21,13 +19,13 @@ class FlowBlock(Generic[LinkT], RecursiveMentionable):
def __bytes__(self): def __bytes__(self):
return bytes(self.previous) + bytes(self.index) + bytes(self.link) 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) return FlowBlockFactory(self.link.factory)
def __init__( def __init__(
self, self,
previous: NullableReference[FBL], previous: NullableReference['FBL'],
index: Index, index: 'Index',
link: HashPoint[LinkT], link: HashPoint[LinkT],
): ):
assert isinstance(previous, NullableReference) assert isinstance(previous, NullableReference)
@ -36,7 +34,7 @@ class FlowBlock(Generic[LinkT], RecursiveMentionable):
self.index = index self.index = index
self.link = link self.link = link
async def outer(self) -> Index: async def outer(self) -> 'Index':
return FlowStandard( return FlowStandard(
( (
await self.index.protocolized.tree.add( await self.index.protocolized.tree.add(
@ -45,25 +43,25 @@ class FlowBlock(Generic[LinkT], RecursiveMentionable):
).protocolized() ).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) assert_eq(await self.outer(), index)
return True return True
@classmethod @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(): if reference.null():
return FlowStandardFactory.empty(FlowBlockFactory(factory), HashComparator(Fail())) return FlowStandardFactory.empty(FlowBlockFactory(factory), HashComparator(Fail()))
else: else:
return await (await reference.resolve()).outer() return await (await reference.resolve()).outer()
@classmethod @classmethod
async def link_of(cls, reference: NullableReference[FBL]) -> Nullable[LinkT]: async def link_of(cls, reference: NullableReference['FBL']) -> Nullable[LinkT]:
if reference.null(): if reference.null():
return Null() return Null()
else: else:
return NotNull(await (await reference.resolve()).link.resolve()) 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( return FlowBlock(
NullableReference.off(self), NullableReference.off(self),
await self.outer(), await self.outer(),
@ -71,7 +69,7 @@ class FlowBlock(Generic[LinkT], RecursiveMentionable):
) )
@classmethod @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( return FlowBlock(
reference, reference,
await cls.outer_of(link.factory, reference), await cls.outer_of(link.factory, reference),
@ -93,12 +91,12 @@ class FlowBlock(Generic[LinkT], RecursiveMentionable):
f'{tabulate(tab)}{link_str}' f'{tabulate(tab)}{link_str}'
class FlowBlockFactory(RainbowFactory[FBL], Generic[LinkT]): class FlowBlockFactory(RainbowFactory['FBL'], Generic[LinkT]):
def __init__(self, factory: RainbowFactory[LinkT]): def __init__(self, factory: RainbowFactory[LinkT]):
assert isinstance(factory, RainbowFactory) assert isinstance(factory, RainbowFactory)
self.factory = factory 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(source, bytes)
assert isinstance(resolver, HashResolver) assert isinstance(resolver, HashResolver)
return FlowBlock( return FlowBlock(
@ -109,10 +107,14 @@ class FlowBlockFactory(RainbowFactory[FBL], Generic[LinkT]):
ResolverOrigin(self.factory, source[2 * HashPoint.HASH_LENGTH:], resolver).hash_point(), ResolverOrigin(self.factory, source[2 * HashPoint.HASH_LENGTH:], resolver).hash_point(),
) )
def loose(self) -> RainbowFactory[FBL]: def loose(self) -> RainbowFactory['FBL']:
return self return self
FBL: TypeAlias = 'FlowBlock[LinkT]'
Index: TypeAlias = FlowStandard[FBL]
class FlowBlockIndexedVerification( class FlowBlockIndexedVerification(
Verification[HashPoint[FBL]], Verification[HashPoint[FBL]],
Generic[LinkT] Generic[LinkT]
@ -196,3 +198,11 @@ class FlowBlockVerification(
def loose(self) -> Verification[Index]: def loose(self) -> Verification[Index]:
return self return self
class FBVF(Generic[LinkT]):
def make(
self,
verification: Verification[tuple[Nullable[HashPoint[LinkT]], HashPoint[LinkT]]]
) -> Verification[Index]:
return FlowBlockVerification(verification)

View File

@ -7,6 +7,7 @@ from rainbowadn.core import *
from rainbowadn.flow.core import * from rainbowadn.flow.core import *
from rainbowadn.flow.verification.core import * from rainbowadn.flow.verification.core import *
from rainbowadn.v13 import * from rainbowadn.v13 import *
from ._flowiterate import * from ._flowiterate import *
from ._flowstandard import * from ._flowstandard import *
from ._flowtransaction import * from ._flowtransaction import *
@ -76,7 +77,7 @@ class FlowCheque(StaticMentionable, RecursiveMentionable):
@classmethod @classmethod
async def total_of(cls, tree: FlowStandard[FlowCoin]) -> int: async def total_of(cls, tree: FlowStandard[FlowCoin]) -> int:
assert isinstance(tree, FlowStandard) assert isinstance(tree, FlowStandard)
reducer: Reducer[HashPoint[FlowCoin]] = await tree.reducer() reducer: Reducer[HashPoint[FlowCoin], int] = await tree.reducer()
assert isinstance(reducer, Reducer) assert isinstance(reducer, Reducer)
total: int = await reducer.reduce(MapReduce(ValueMapper(), SumReduce(0))) total: int = await reducer.reduce(MapReduce(ValueMapper(), SumReduce(0)))
assert isinstance(total, int) assert isinstance(total, int)

View File

@ -11,20 +11,20 @@ from rainbowadn.flow.primitive import *
from rainbowadn.flow.verification.core import * from rainbowadn.flow.verification.core import *
from rainbowadn.inlining import * from rainbowadn.inlining import *
from rainbowadn.nullability import * from rainbowadn.nullability import *
from ._binaryflow import * from ._binaryflow import *
from ._flowtree import * from ._flowtree import *
__all__ = ('FlowStandard', 'FlowStandardFactory',) __all__ = ('FlowStandard', 'FlowStandardFactory',)
KeyT = TypeVar('KeyT') KeyT = TypeVar('KeyT', bound=Mentionable)
FS: TypeAlias = 'FlowStandard[KeyT]'
ABT: TypeAlias = 'ActiveBinaryTree[KeyT, Integer]' ABT: TypeAlias = 'ActiveBinaryTree[KeyT, Integer]'
BP: TypeAlias = 'BinaryProtocolized[KeyT, Integer, ABT]' BP: TypeAlias = 'BinaryProtocolized[KeyT, Integer, ABT]'
class FlowStandard( class FlowStandard(
RecursiveMentionable, RecursiveMentionable,
FlowTree[HashPoint[KeyT], FS], FlowTree[HashPoint[KeyT], 'FS'],
Generic[KeyT] Generic[KeyT]
): ):
def points(self) -> Iterable[HashPoint]: def points(self) -> Iterable[HashPoint]:
@ -46,14 +46,14 @@ class FlowStandard(
async def contains(self, key: HashPoint[KeyT], *, exact: bool) -> bool: async def contains(self, key: HashPoint[KeyT], *, exact: bool) -> bool:
return await self.protocolized.tree.contains(key, exact=exact) return await self.protocolized.tree.contains(key, exact=exact)
def _protocolized(self: FS) -> BP: def _protocolized(self: 'FS') -> BP:
return self.protocolized return self.protocolized
@classmethod @classmethod
def _protocolized_mapper(cls) -> Mapper[FS, BP]: def _protocolized_mapper(cls) -> Mapper['FS', BP]:
return CallableMapper(cls._protocolized) 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) assert isinstance(trees, Reducer)
reducer: Reducer[BP, CheckResult] = MapReducer(self._protocolized_mapper(), trees) reducer: Reducer[BP, CheckResult] = MapReducer(self._protocolized_mapper(), trees)
assert_true(await VerifySubsetAction(reducer).on(self.protocolized)) assert_true(await VerifySubsetAction(reducer).on(self.protocolized))
@ -83,6 +83,9 @@ class FlowStandard(
return await self.protocolized.tree.reference.str(tab) return await self.protocolized.tree.reference.str(tab)
FS: TypeAlias = 'FlowStandard[KeyT]'
class FlowStandardFactory(Inlining[FlowStandard[KeyT]], Generic[KeyT]): class FlowStandardFactory(Inlining[FlowStandard[KeyT]], Generic[KeyT]):
def __init__( def __init__(
self, self,

View File

@ -9,6 +9,7 @@ from rainbowadn.core import *
from rainbowadn.flow.core import * from rainbowadn.flow.core import *
from rainbowadn.flow.verification.core import * from rainbowadn.flow.verification.core import *
from rainbowadn.v13 import * from rainbowadn.v13 import *
from ._flowstandard import * from ._flowstandard import *
from ._resolvemapper import * from ._resolvemapper import *

View File

@ -1,10 +1,12 @@
from typing import TypeVar from typing import TypeVar
from rainbowadn.core import *
from ._flowstandard import * from ._flowstandard import *
__all__ = ('flow_union',) __all__ = ('flow_union',)
KeyT = TypeVar('KeyT') KeyT = TypeVar('KeyT', bound=Mentionable)
async def flow_union(left: FlowStandard[KeyT], right: FlowStandard[KeyT]) -> FlowStandard[KeyT]: async def flow_union(left: FlowStandard[KeyT], right: FlowStandard[KeyT]) -> FlowStandard[KeyT]:

View File

@ -5,7 +5,7 @@ from rainbowadn.flow.core import *
__all__ = ('ResolveMapper',) __all__ = ('ResolveMapper',)
MentionedT = TypeVar('MentionedT') MentionedT = TypeVar('MentionedT', bound=Mentionable)
Out = TypeVar('Out') Out = TypeVar('Out')

View File

@ -2,6 +2,7 @@ import abc
from typing import Type, TypeVar from typing import Type, TypeVar
from rainbowadn.core import * from rainbowadn.core import *
from .istatic import * from .istatic import *
__all__ = ('IAtomic',) __all__ = ('IAtomic',)

View File

@ -1,7 +1,11 @@
import heapq 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 rainbowadn.core import *
from .inlining import * from .inlining import *
__all__ = ('IAuto', 'Auto', 'IAutoFactory',) __all__ = ('IAuto', 'Auto', 'IAutoFactory',)
@ -12,7 +16,7 @@ _SList: TypeAlias = list[tuple[int, RainbowFactory, int]]
_VList: TypeAlias = list[tuple[int, RainbowFactory]] _VList: TypeAlias = list[tuple[int, RainbowFactory]]
_MCall: TypeAlias = Callable[['Auto', _IList, _UList], None] _MCall: TypeAlias = Callable[['Auto', _IList, _UList], None]
_MTuple: TypeAlias = tuple[int, _MCall, int] _MTuple: TypeAlias = tuple[int, _MCall, int]
_IAuto = TypeVar('_IAuto') _IAuto = TypeVar('_IAuto', bound='IAuto')
class IAuto(RecursiveMentionable): class IAuto(RecursiveMentionable):
@ -58,7 +62,6 @@ class IAuto(RecursiveMentionable):
return b''.join(source for _, source in merged_bytes) return b''.join(source for _, source in merged_bytes)
def __factory__(self: _IAuto) -> RainbowFactory[_IAuto]: def __factory__(self: _IAuto) -> RainbowFactory[_IAuto]:
assert isinstance(self, IAuto)
sized: _SList = [] sized: _SList = []
inlined_unsized: _VList = [] inlined_unsized: _VList = []
uninlined_unsized: _VList = [] uninlined_unsized: _VList = []
@ -156,12 +159,12 @@ class IAuto(RecursiveMentionable):
return f'{tabulate(tab)}'.join(formatted) return f'{tabulate(tab)}'.join(formatted)
T = TypeVar('T') T = TypeVar('T', bound=Mentionable)
T0 = TypeVar('T0') T0 = TypeVar('T0', bound=Mentionable)
T1 = TypeVar('T1') T1 = TypeVar('T1', bound=Mentionable)
T2 = TypeVar('T2') T2 = TypeVar('T2', bound=Mentionable)
T3 = TypeVar('T3') T3 = TypeVar('T3', bound=Mentionable)
T4 = TypeVar('T4') T4 = TypeVar('T4', bound=Mentionable)
class Auto: class Auto:
@ -197,9 +200,16 @@ class Auto:
self.__index += size self.__index += size
return self.sub(index, self.__index) 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 @classmethod
def _static_size(cls, *factories: RainbowFactory) -> int: 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]: def _static_simple(self, *factories: RainbowFactory) -> Iterable[Mentionable]:
with self: with self:
@ -234,32 +244,32 @@ class Auto:
@overload @overload
def static( def static(
self, t0: RainbowFactory[T0] self, t0: RainbowFactory[T0], /
) -> tuple[T0]: ) -> tuple[T0]:
... ...
@overload @overload
def static( def static(
self, t0: RainbowFactory[T0], t1: RainbowFactory[T1] self, t0: RainbowFactory[T0], t1: RainbowFactory[T1], /
) -> tuple[T0, T1]: ) -> tuple[T0, T1]:
... ...
@overload @overload
def static( 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]: ) -> tuple[T0, T1, T2]:
... ...
@overload @overload
def static( 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]: ) -> tuple[T0, T1, T2, T3]:
... ...
@overload @overload
def static( 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],
t4: RainbowFactory[T4] t4: RainbowFactory[T4], /
) -> tuple[T0, T1, T2, T3, T4]: ) -> tuple[T0, T1, T2, T3, T4]:
... ...
@ -267,7 +277,7 @@ class Auto:
return tuple(self._static(*factories)) return tuple(self._static(*factories))
class IAutoFactory(Inlining[IAuto], Generic[_IAuto]): class IAutoFactory(Inlining[_IAuto], Generic[_IAuto]):
def __init__( def __init__(
self, self,
typed: Type[_IAuto], typed: Type[_IAuto],

View File

@ -5,7 +5,7 @@ from rainbowadn.core import *
__all__ = ('Inlining',) __all__ = ('Inlining',)
Inlined = TypeVar('Inlined') Inlined = TypeVar('Inlined', bound=Mentionable, covariant=True)
_FTuple: TypeAlias = tuple[int, Callable[[bytes, HashResolver], HashPoint], int] _FTuple: TypeAlias = tuple[int, Callable[[bytes, HashResolver], HashPoint], int]
_HTuple: TypeAlias = tuple[int, Callable[[], Coroutine[Any, Any, bytes]]] _HTuple: TypeAlias = tuple[int, Callable[[], Coroutine[Any, Any, bytes]]]

View File

@ -1,12 +1,13 @@
from typing import Generic, TypeVar from typing import Generic, TypeVar
from rainbowadn.core import * from rainbowadn.core import *
from .iauto import * from .iauto import *
__all__ = ('IPair',) __all__ = ('IPair',)
E0 = TypeVar('E0') E0 = TypeVar('E0', bound=Mentionable)
E1 = TypeVar('E1') E1 = TypeVar('E1', bound=Mentionable)
class IPair(IAuto, Generic[E0, E1]): class IPair(IAuto, Generic[E0, E1]):

View File

@ -1,11 +1,12 @@
from typing import Generic, Iterable, Optional, TypeVar from typing import Generic, Iterable, Optional, TypeVar
from rainbowadn.core import * from rainbowadn.core import *
from .inlining import * from .inlining import *
__all__ = ('IRef',) __all__ = ('IRef',)
TRef = TypeVar('TRef') TRef = TypeVar('TRef', bound=Mentionable)
class IRef(RecursiveMentionable, Generic[TRef]): class IRef(RecursiveMentionable, Generic[TRef]):

View File

@ -2,11 +2,12 @@ import abc
from typing import Generic, Optional, Type, TypeVar from typing import Generic, Optional, Type, TypeVar
from rainbowadn.core import * from rainbowadn.core import *
from .inlining import * from .inlining import *
__all__ = ('IStatic', 'IStaticFactory',) __all__ = ('IStatic', 'IStaticFactory',)
StaticInlined = TypeVar('StaticInlined') StaticInlined = TypeVar('StaticInlined', bound='IStatic')
class IStatic(Mentionable, abc.ABC): class IStatic(Mentionable, abc.ABC):

View File

@ -1,4 +1,5 @@
from rainbowadn.core import * from rainbowadn.core import *
from .iatomic import * from .iatomic import *
__all__ = ('IUnit',) __all__ = ('IUnit',)

View File

@ -4,7 +4,7 @@ from .nullable import *
__all__ = ('NotNull',) __all__ = ('NotNull',)
NullableType = TypeVar('NullableType') NullableType = TypeVar('NullableType', covariant=True)
class NotNull(Nullable[NullableType], Generic[NullableType]): class NotNull(Nullable[NullableType], Generic[NullableType]):

View File

@ -4,7 +4,7 @@ from .nullable import *
__all__ = ('Null',) __all__ = ('Null',)
NullableType = TypeVar('NullableType') NullableType = TypeVar('NullableType', covariant=True)
class Null(Nullable[NullableType], Generic[NullableType]): class Null(Nullable[NullableType], Generic[NullableType]):

View File

@ -3,7 +3,7 @@ from typing import Generic, TypeVar
__all__ = ('Nullable',) __all__ = ('Nullable',)
NullableType = TypeVar('NullableType') NullableType = TypeVar('NullableType', covariant=True)
class Nullable(Generic[NullableType], abc.ABC): class Nullable(Generic[NullableType], abc.ABC):

View File

@ -2,13 +2,15 @@ from typing import Generic, Iterable, Optional, TypeVar
from rainbowadn.core import * from rainbowadn.core import *
from rainbowadn.inlining import * from rainbowadn.inlining import *
from .notnull import * from .notnull import *
from .null import * from .null import *
from .nullable import * from .nullable import *
__all__ = ('NullableReference', 'NullableReferenceFactory',) __all__ = ('NullableReference', 'NullableReferenceFactory',)
Referenced = TypeVar('Referenced') Referenced = TypeVar('Referenced', bound=Mentionable, covariant=True)
ReferencedI = TypeVar('ReferencedI', bound=Mentionable)
class NullableReference(RecursiveMentionable, Generic[Referenced]): class NullableReference(RecursiveMentionable, Generic[Referenced]):
@ -41,7 +43,7 @@ class NullableReference(RecursiveMentionable, Generic[Referenced]):
return cls(NotNull(hash_point), hash_point.factory) return cls(NotNull(hash_point), hash_point.factory)
@classmethod @classmethod
def off(cls, value: Referenced) -> 'NullableReference[Referenced]': def off(cls, value: ReferencedI) -> 'NullableReference[ReferencedI]':
assert isinstance(value, Mentionable) assert isinstance(value, Mentionable)
return cls.of(HashPoint.of(value)) return cls.of(HashPoint.of(value))

View File

@ -4,7 +4,7 @@ from rainbowadn.core import *
__all__ = ('CachingResolver',) __all__ = ('CachingResolver',)
Mentioned = TypeVar('Mentioned') Mentioned = TypeVar('Mentioned', bound=Mentionable)
class CachingResolver(ExtendableResolver): class CachingResolver(ExtendableResolver):

View File

@ -5,7 +5,7 @@ from rainbowadn.core import *
__all__ = ('DelayedResolver',) __all__ = ('DelayedResolver',)
Mentioned = TypeVar('Mentioned') Mentioned = TypeVar('Mentioned', bound=Mentionable)
class DelayedResolver(ExtendableResolver): class DelayedResolver(ExtendableResolver):

View File

@ -5,7 +5,7 @@ from rainbowadn.core import *
__all__ = ('DictResolver',) __all__ = ('DictResolver',)
Mentioned = TypeVar('Mentioned') Mentioned = TypeVar('Mentioned', bound=Mentionable)
class DictResolver(ExtendableResolver): class DictResolver(ExtendableResolver):

View File

@ -9,9 +9,9 @@ from rainbowadn.atomic import *
from rainbowadn.collection.comparison import * from rainbowadn.collection.comparison import *
from rainbowadn.collection.trees.binary import * from rainbowadn.collection.trees.binary import *
from rainbowadn.core import * from rainbowadn.core import *
from rainbowadn.flow13 import *
from rainbowadn.flow.bridge import * from rainbowadn.flow.bridge import *
from rainbowadn.flow.primitive import * from rainbowadn.flow.primitive import *
from rainbowadn.flow13 import *
from rainbowadn.v13 import * from rainbowadn.v13 import *

View File

@ -3,6 +3,7 @@ import unittest
from rainbowadn.atomic import * from rainbowadn.atomic import *
from rainbowadn.core import * from rainbowadn.core import *
from rainbowadn.inlining import * from rainbowadn.inlining import *
from .resolvers import * from .resolvers import *

View File

@ -1,11 +1,12 @@
from typing import Generic, Iterable, TypeVar from typing import Generic, Iterable, TypeVar
from rainbowadn.core import * from rainbowadn.core import *
from .thresholdprotocol import * from .thresholdprotocol import *
__all__ = ('ValidReference', 'ValidReferenceFactory') __all__ = ('ValidReference', 'ValidReferenceFactory')
Referenced = TypeVar('Referenced') Referenced = TypeVar('Referenced', bound=Mentionable)
class ValidReference(RecursiveMentionable, Generic[Referenced]): class ValidReference(RecursiveMentionable, Generic[Referenced]):

View File

@ -4,6 +4,7 @@ import nacl.signing
from rainbowadn.core import * from rainbowadn.core import *
from rainbowadn.inlining import * from rainbowadn.inlining import *
from .subject import * from .subject import *
__all__ = ('BadSignature', 'Signature',) __all__ = ('BadSignature', 'Signature',)

View File

@ -2,6 +2,7 @@ import bisect
from typing import AsyncIterable, Iterable, Sequence from typing import AsyncIterable, Iterable, Sequence
from rainbowadn.core import * from rainbowadn.core import *
from .wrisbtparametres import * from .wrisbtparametres import *
__all__ = ('WeakReferenceIndexSetBTree', 'WrisbtFactory',) __all__ = ('WeakReferenceIndexSetBTree', 'WrisbtFactory',)

View File

@ -1,6 +1,7 @@
from typing import Iterable from typing import Iterable
from rainbowadn.core import * from rainbowadn.core import *
from .wrisbtparametres import * from .wrisbtparametres import *
from .wrisbtroot import * from .wrisbtroot import *

View File

@ -2,6 +2,7 @@ from typing import Iterable
from rainbowadn.atomic import * from rainbowadn.atomic import *
from rainbowadn.core import * from rainbowadn.core import *
from .weakreferenceindexsetbtree import * from .weakreferenceindexsetbtree import *
from .wrisbtparametres import * from .wrisbtparametres import *

View File

@ -29,6 +29,8 @@ def target_str(target) -> str:
return name return name
case object(__class__=type(__name__=name)): case object(__class__=type(__name__=name)):
return name return name
case _:
raise TypeError
def jsonify(dumped: Instrumentation) -> dict: def jsonify(dumped: Instrumentation) -> dict:

View File

@ -4,8 +4,9 @@ from contextlib import ExitStack
from typing import Any, Callable, Coroutine from typing import Any, Callable, Coroutine
from nacl.signing import SigningKey, VerifyKey from nacl.signing import SigningKey, VerifyKey
from plot import * from plot import *
from trace_common import *
from rainbowadn.collection.trees.binary import * from rainbowadn.collection.trees.binary import *
from rainbowadn.core import * from rainbowadn.core import *
from rainbowadn.flow13 import * from rainbowadn.flow13 import *
@ -13,7 +14,6 @@ from rainbowadn.flow13 import FlowCoin
from rainbowadn.instrument import * from rainbowadn.instrument import *
from rainbowadn.testing.resolvers import * from rainbowadn.testing.resolvers import *
from rainbowadn.v13 import * from rainbowadn.v13 import *
from trace_common import *
def get_instrumentations() -> list[Instrumentation]: 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]: async def _instrument(process: Callable[[], Coroutine[Any, Any, None]]) -> list[Instrumentation]:
with ExitStack() as estack:
instrumentations: list[Instrumentation] = get_instrumentations() instrumentations: list[Instrumentation] = get_instrumentations()
with ExitStack() as estack:
for stacked in instrumentations: for stacked in instrumentations:
stacked.enter(estack) stacked.enter(estack)
try: try:
@ -167,7 +167,7 @@ if __name__ == '__main__':
try: try:
asyncio.run( asyncio.run(
trace( trace(
preset_long preset_short
) )
) )
except KeyboardInterrupt: except KeyboardInterrupt: