diff --git a/rainbowadn/atomic/__init__.py b/rainbowadn/atomic/__init__.py new file mode 100644 index 0000000..b31d819 --- /dev/null +++ b/rainbowadn/atomic/__init__.py @@ -0,0 +1,3 @@ +from .atomic import Atomic +from .integer import Integer +from .plain import Plain diff --git a/rainbowadn/data/atomic/atomic.py b/rainbowadn/atomic/atomic.py similarity index 80% rename from rainbowadn/data/atomic/atomic.py rename to rainbowadn/atomic/atomic.py index cef4da8..b269937 100644 --- a/rainbowadn/data/atomic/atomic.py +++ b/rainbowadn/atomic/atomic.py @@ -1,9 +1,7 @@ import abc from typing import Type, TypeVar -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.static import StaticMentionable +from rainbowadn.core import * __all__ = ('Atomic',) diff --git a/rainbowadn/data/atomic/integer.py b/rainbowadn/atomic/integer.py similarity index 91% rename from rainbowadn/data/atomic/integer.py rename to rainbowadn/atomic/integer.py index 0bcf44d..b915c4b 100644 --- a/rainbowadn/data/atomic/integer.py +++ b/rainbowadn/atomic/integer.py @@ -1,4 +1,4 @@ -from rainbowadn.data.atomic.atomic import Atomic +from .atomic import Atomic __all__ = ('Integer',) diff --git a/rainbowadn/data/atomic/plain.py b/rainbowadn/atomic/plain.py similarity index 89% rename from rainbowadn/data/atomic/plain.py rename to rainbowadn/atomic/plain.py index 9d52b9d..983cbb8 100644 --- a/rainbowadn/data/atomic/plain.py +++ b/rainbowadn/atomic/plain.py @@ -1,4 +1,4 @@ -from rainbowadn.data.atomic.atomic import Atomic +from .atomic import Atomic __all__ = ('Plain',) diff --git a/rainbowadn/chain/stages/derivation/__init__.py b/rainbowadn/bu6/processobject.py similarity index 100% rename from rainbowadn/chain/stages/derivation/__init__.py rename to rainbowadn/bu6/processobject.py diff --git a/rainbowadn/core/nullability/__init__.py b/rainbowadn/bu6/proof.py similarity index 100% rename from rainbowadn/core/nullability/__init__.py rename to rainbowadn/bu6/proof.py diff --git a/rainbowadn/data/__init__.py b/rainbowadn/bu6/sourceobject.py similarity index 100% rename from rainbowadn/data/__init__.py rename to rainbowadn/bu6/sourceobject.py diff --git a/rainbowadn/chain/__init__.py b/rainbowadn/chain/__init__.py index e69de29..bb61552 100644 --- a/rainbowadn/chain/__init__.py +++ b/rainbowadn/chain/__init__.py @@ -0,0 +1,5 @@ +from .blockchain import * +from .blockchainprotocol import BlockChainProtocol +from .chaincollectionfactory import ChainCollectionFactory +from .chaincollectioninterface import ChainCollectionInterface +from .reductionchainmetafactory import ReductionChainMetaFactory diff --git a/rainbowadn/chain/block.py b/rainbowadn/chain/block.py index aee7754..a97da96 100644 --- a/rainbowadn/chain/block.py +++ b/rainbowadn/chain/block.py @@ -1,12 +1,7 @@ from typing import Generic, Iterable, TypeVar -from rainbowadn.core.hash_point_format import hash_point_format, tabulate -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.nullability.nullablereference import NullableReference, NullableReferenceFactory -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.recursivementionable import RecursiveMentionable -from rainbowadn.core.resolverorigin import ResolverOrigin +from rainbowadn.core import * +from rainbowadn.nullability import * __all__ = ('Block', 'BlockFactory',) diff --git a/rainbowadn/chain/blockchain.py b/rainbowadn/chain/blockchain.py index a0ed3c7..035d4c2 100644 --- a/rainbowadn/chain/blockchain.py +++ b/rainbowadn/chain/blockchain.py @@ -1,15 +1,12 @@ import asyncio from typing import Generic, TypeVar -from rainbowadn.chain.block import Block, BlockFactory -from rainbowadn.chain.blockchainprotocol import BlockChainProtocol -from rainbowadn.chain.chaincollectionfactory import ChainCollectionFactory -from rainbowadn.chain.chaincollectioninterface import ChainCollectionInterface -from rainbowadn.core.asserts import assert_eq, assert_true -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.nullability.null import Null -from rainbowadn.core.nullability.nullablereference import NullableReference -from rainbowadn.core.rainbow_factory import RainbowFactory +from rainbowadn.core import * +from rainbowadn.nullability import * +from .block import * +from .blockchainprotocol import BlockChainProtocol +from .chaincollectionfactory import ChainCollectionFactory +from .chaincollectioninterface import ChainCollectionInterface __all__ = ('BlockChain', 'BlockChainFactory',) diff --git a/rainbowadn/chain/blockchainprotocol.py b/rainbowadn/chain/blockchainprotocol.py index 2216f07..d1d00c9 100644 --- a/rainbowadn/chain/blockchainprotocol.py +++ b/rainbowadn/chain/blockchainprotocol.py @@ -1,8 +1,7 @@ from typing import Generic, TypeVar -from rainbowadn.chain.states.activestateprotocol import ActiveStateProtocol -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.rainbow_factory import RainbowFactory +from rainbowadn.core import * +from .states import * __all__ = ('BlockChainProtocol',) diff --git a/rainbowadn/chain/blockcollectioninterface.py b/rainbowadn/chain/blockcollectioninterface.py index 8b3d836..1f667d3 100644 --- a/rainbowadn/chain/blockcollectioninterface.py +++ b/rainbowadn/chain/blockcollectioninterface.py @@ -1,10 +1,8 @@ from typing import Generic, TypeVar -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.nullability.null import Null -from rainbowadn.core.nullability.nullablereference import NullableReference -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.data.collection.collection_interface.collectioninterface import CollectionInterface +from rainbowadn.collection.collectioninterface import CollectionInterface +from rainbowadn.core import * +from rainbowadn.nullability import * __all__ = ('BlockCollectionInterface',) diff --git a/rainbowadn/chain/chaincollectionfactory.py b/rainbowadn/chain/chaincollectionfactory.py index ab4a84c..4fab8e8 100644 --- a/rainbowadn/chain/chaincollectionfactory.py +++ b/rainbowadn/chain/chaincollectionfactory.py @@ -1,7 +1,7 @@ from typing import Generic, TypeVar -from rainbowadn.chain.chaincollectioninterface import ChainCollectionInterface -from rainbowadn.core.nullability.nullablereference import NullableReference +from rainbowadn.nullability import * +from .chaincollectioninterface import ChainCollectionInterface __all__ = ('ChainCollectionFactory',) diff --git a/rainbowadn/chain/chaincollectioninterface.py b/rainbowadn/chain/chaincollectioninterface.py index b5d8d3a..7cf9110 100644 --- a/rainbowadn/chain/chaincollectioninterface.py +++ b/rainbowadn/chain/chaincollectioninterface.py @@ -1,8 +1,8 @@ import abc from typing import Generic, TypeVar -from rainbowadn.chain.blockcollectioninterface import BlockCollectionInterface -from rainbowadn.core.hashpoint import HashPoint +from rainbowadn.core import * +from .blockcollectioninterface import BlockCollectionInterface __all__ = ('ChainCollectionInterface',) diff --git a/rainbowadn/chain/derivation/__init__.py b/rainbowadn/chain/derivation/__init__.py new file mode 100644 index 0000000..d174e3c --- /dev/null +++ b/rainbowadn/chain/derivation/__init__.py @@ -0,0 +1,5 @@ +from .activestageprotocol import ActiveStageProtocol +from .activestagestateprotocol import ActiveStageStateProtocol +from .derived import Derived +from .derivedstage import DerivedStage +from .derivedstate import DerivedState diff --git a/rainbowadn/chain/stages/derivation/activestageprotocol.py b/rainbowadn/chain/derivation/activestageprotocol.py similarity index 89% rename from rainbowadn/chain/stages/derivation/activestageprotocol.py rename to rainbowadn/chain/derivation/activestageprotocol.py index 75cb2ca..1d6d736 100644 --- a/rainbowadn/chain/stages/derivation/activestageprotocol.py +++ b/rainbowadn/chain/derivation/activestageprotocol.py @@ -1,15 +1,11 @@ from typing import Generic, TypeVar -from rainbowadn.chain.stages.derivation.derived import Derived -from rainbowadn.chain.stages.derivation.derivedstage import DerivedStage -from rainbowadn.chain.stages.derivation.derivedstate import DerivedState -from rainbowadn.chain.stages.stage import StageStage, StageStageFactory, StateStage -from rainbowadn.chain.stages.stageprotocol import StageProtocol -from rainbowadn.core.asserts import assert_eq -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.nullability.null import Null -from rainbowadn.core.nullability.nullablereference import NullableReference -from rainbowadn.core.rainbow_factory import RainbowFactory +from rainbowadn.chain.stages import * +from rainbowadn.core import * +from rainbowadn.nullability import * +from .derived import Derived +from .derivedstage import DerivedStage +from .derivedstate import DerivedState __all__ = ('ActiveStageProtocol',) diff --git a/rainbowadn/chain/stages/derivation/activestagestateprotocol.py b/rainbowadn/chain/derivation/activestagestateprotocol.py similarity index 79% rename from rainbowadn/chain/stages/derivation/activestagestateprotocol.py rename to rainbowadn/chain/derivation/activestagestateprotocol.py index 5fa7d8a..200ebe5 100644 --- a/rainbowadn/chain/stages/derivation/activestagestateprotocol.py +++ b/rainbowadn/chain/derivation/activestagestateprotocol.py @@ -1,11 +1,10 @@ from typing import TypeVar -from rainbowadn.chain.stages.derivation.activestageprotocol import ActiveStageProtocol -from rainbowadn.chain.stages.stage import StateStage -from rainbowadn.chain.states.activestateprotocol import ActiveStateProtocol -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.nullability.nullablereference import NullableReference -from rainbowadn.core.rainbow_factory import RainbowFactory +from rainbowadn.chain.stages import * +from rainbowadn.chain.states import * +from rainbowadn.core import * +from rainbowadn.nullability import * +from .activestageprotocol import ActiveStageProtocol __all__ = ('ActiveStageStateProtocol',) @@ -62,3 +61,10 @@ class ActiveStageStateProtocol( self.base_state_factory, self.stage_factory ) + + @classmethod + def stage_state_protocol(cls) -> StateProtocol[ + HeaderType, + StateStage[HeaderType, BaseStateType, StageType] + ]: + return StageStateProtocol() diff --git a/rainbowadn/chain/stages/derivation/derived.py b/rainbowadn/chain/derivation/derived.py similarity index 100% rename from rainbowadn/chain/stages/derivation/derived.py rename to rainbowadn/chain/derivation/derived.py diff --git a/rainbowadn/chain/stages/derivation/derivedstage.py b/rainbowadn/chain/derivation/derivedstage.py similarity index 76% rename from rainbowadn/chain/stages/derivation/derivedstage.py rename to rainbowadn/chain/derivation/derivedstage.py index 6fe9f81..2c6d2c9 100644 --- a/rainbowadn/chain/stages/derivation/derivedstage.py +++ b/rainbowadn/chain/derivation/derivedstage.py @@ -1,7 +1,7 @@ from typing import Generic, TypeVar -from rainbowadn.chain.stages.derivation.derived import Derived -from rainbowadn.core.hashpoint import HashPoint +from rainbowadn.core import * +from .derived import Derived __all__ = ('DerivedStage',) diff --git a/rainbowadn/chain/stages/derivation/derivedstate.py b/rainbowadn/chain/derivation/derivedstate.py similarity index 76% rename from rainbowadn/chain/stages/derivation/derivedstate.py rename to rainbowadn/chain/derivation/derivedstate.py index 36e8a2f..dfbf59f 100644 --- a/rainbowadn/chain/stages/derivation/derivedstate.py +++ b/rainbowadn/chain/derivation/derivedstate.py @@ -1,7 +1,7 @@ from typing import Generic, TypeVar -from rainbowadn.chain.stages.derivation.derived import Derived -from rainbowadn.core.hashpoint import HashPoint +from rainbowadn.core import * +from .derived import Derived __all__ = ('DerivedState',) diff --git a/rainbowadn/chain/reduction/__init__.py b/rainbowadn/chain/reduction/__init__.py index e69de29..d0daf91 100644 --- a/rainbowadn/chain/reduction/__init__.py +++ b/rainbowadn/chain/reduction/__init__.py @@ -0,0 +1,6 @@ +from .abstractreductionchainmetafactory import AbstractReductionChainMetaFactory +from .reduced import Reduced +from .reducible import Reducible +from .reductionchainprotocol import ReductionChainProtocol +from .reductionprotocol import ReductionProtocol +from .reductionresult import ReductionResult diff --git a/rainbowadn/chain/abstractreductionchainmetafactory.py b/rainbowadn/chain/reduction/abstractreductionchainmetafactory.py similarity index 84% rename from rainbowadn/chain/abstractreductionchainmetafactory.py rename to rainbowadn/chain/reduction/abstractreductionchainmetafactory.py index f9089e1..5390669 100644 --- a/rainbowadn/chain/abstractreductionchainmetafactory.py +++ b/rainbowadn/chain/reduction/abstractreductionchainmetafactory.py @@ -1,8 +1,8 @@ from typing import Generic, TypeVar from rainbowadn.chain.chaincollectionfactory import ChainCollectionFactory -from rainbowadn.chain.reduction.reductionprotocol import ReductionProtocol -from rainbowadn.core.rainbow_factory import RainbowFactory +from rainbowadn.core import * +from .reductionprotocol import ReductionProtocol __all__ = ('AbstractReductionChainMetaFactory',) diff --git a/rainbowadn/chain/reduction/reduced.py b/rainbowadn/chain/reduction/reduced.py index 8bc0642..536b6b6 100644 --- a/rainbowadn/chain/reduction/reduced.py +++ b/rainbowadn/chain/reduction/reduced.py @@ -1,7 +1,7 @@ from typing import Generic, TypeVar -from rainbowadn.chain.reduction.reductionresult import ReductionResult -from rainbowadn.core.hashpoint import HashPoint +from rainbowadn.core import * +from .reductionresult import ReductionResult __all__ = ('Reduced',) diff --git a/rainbowadn/chain/reduction/reduction.py b/rainbowadn/chain/reduction/reducible.py similarity index 72% rename from rainbowadn/chain/reduction/reduction.py rename to rainbowadn/chain/reduction/reducible.py index 81ace99..ac36cdd 100644 --- a/rainbowadn/chain/reduction/reduction.py +++ b/rainbowadn/chain/reduction/reducible.py @@ -1,20 +1,15 @@ from typing import Generic, Iterable, TypeVar -from rainbowadn.chain.reduction.reductionresult import ReductionResult -from rainbowadn.core.hash_point_format import hash_point_format, tabulate -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.recursivementionable import RecursiveMentionable -from rainbowadn.core.resolverorigin import ResolverOrigin +from rainbowadn.core import * +from .reductionresult import ReductionResult -__all__ = ('Reduction', 'ReductionFactory',) +__all__ = ('Reducible', 'ReductionFactory',) ReductorType = TypeVar('ReductorType') AccumulatorType = TypeVar('AccumulatorType') -class Reduction( +class Reducible( ReductionResult[ReductorType, AccumulatorType], RecursiveMentionable, Generic[ReductorType, AccumulatorType] @@ -31,7 +26,7 @@ class Reduction( def __bytes__(self): return bytes(self.reductor) + bytes(self.accumulator) - def __factory__(self) -> RainbowFactory['Reduction[ReductorType, AccumulatorType]']: + def __factory__(self) -> RainbowFactory['Reducible[ReductorType, AccumulatorType]']: return ReductionFactory(self.reductor.factory, self.accumulator.factory) async def str(self, tab: int) -> str: @@ -41,7 +36,7 @@ class Reduction( class ReductionFactory( - RainbowFactory[Reduction[ReductorType, AccumulatorType]], + RainbowFactory[Reducible[ReductorType, AccumulatorType]], Generic[ReductorType, AccumulatorType] ): def __init__( @@ -54,10 +49,10 @@ class ReductionFactory( self.reductor_factory = reductor_factory self.accumulator_factory = accumulator_factory - def from_bytes(self, source: bytes, resolver: HashResolver) -> Reduction[ReductorType, AccumulatorType]: + def from_bytes(self, source: bytes, resolver: HashResolver) -> Reducible[ReductorType, AccumulatorType]: assert isinstance(source, bytes) assert isinstance(resolver, HashResolver) - return Reduction( + return Reducible( ResolverOrigin(self.reductor_factory, source[:HashPoint.HASH_LENGTH], resolver).hash_point(), ResolverOrigin(self.accumulator_factory, source[HashPoint.HASH_LENGTH:], resolver).hash_point(), ) diff --git a/rainbowadn/chain/reduction/reductionchainprotocol.py b/rainbowadn/chain/reduction/reductionchainprotocol.py index 250d8c2..8f3a982 100644 --- a/rainbowadn/chain/reduction/reductionchainprotocol.py +++ b/rainbowadn/chain/reduction/reductionchainprotocol.py @@ -1,14 +1,12 @@ from typing import TypeVar from rainbowadn.chain.blockchainprotocol import BlockChainProtocol -from rainbowadn.chain.reduction.reduction import Reduction, ReductionFactory -from rainbowadn.chain.reduction.reductionprotocol import ReductionProtocol -from rainbowadn.chain.reduction.reductionstageprotocol import ReductionStageProtocol -from rainbowadn.chain.stages.derivation.activestageprotocol import ActiveStageProtocol -from rainbowadn.chain.stages.derivation.activestagestateprotocol import ActiveStageStateProtocol -from rainbowadn.chain.stages.stage import StateStage, StateStageFactory -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.rainbow_factory import RainbowFactory +from rainbowadn.chain.derivation import * +from rainbowadn.chain.stages import * +from rainbowadn.core import * +from .reducible import * +from .reductionprotocol import ReductionProtocol +from .reductionstageprotocol import ReductionStageProtocol __all__ = ('ReductionChainProtocol',) @@ -19,7 +17,7 @@ AccumulatorType = TypeVar('AccumulatorType') class ReductionChainProtocol( BlockChainProtocol[ ReductorType, - StateStage[ReductorType, AccumulatorType, Reduction[ReductorType, AccumulatorType]], + StateStage[ReductorType, AccumulatorType, Reducible[ReductorType, AccumulatorType]], AccumulatorType ] ): @@ -34,7 +32,7 @@ class ReductionChainProtocol( assert isinstance(accumulator_factory, RainbowFactory) reduction_factory: RainbowFactory[ - Reduction[ReductorType, AccumulatorType] + Reducible[ReductorType, AccumulatorType] ] = ReductionFactory( reductor_factory, accumulator_factory ) @@ -42,7 +40,7 @@ class ReductionChainProtocol( stage_protocol: ActiveStageProtocol[ ReductorType, AccumulatorType, - Reduction[ReductorType, AccumulatorType] + Reducible[ReductorType, AccumulatorType] ] = ReductionStageProtocol(protocol) assert isinstance(stage_protocol, ActiveStageProtocol) @@ -71,7 +69,7 @@ class ReductionChainProtocol( state: StateStage[ ReductorType, AccumulatorType, - Reduction[ReductorType, AccumulatorType] + Reducible[ReductorType, AccumulatorType] ] ) -> HashPoint[AccumulatorType]: assert isinstance(state, StateStage) diff --git a/rainbowadn/chain/reduction/reductionprotocol.py b/rainbowadn/chain/reduction/reductionprotocol.py index 997916d..ce450c2 100644 --- a/rainbowadn/chain/reduction/reductionprotocol.py +++ b/rainbowadn/chain/reduction/reductionprotocol.py @@ -1,9 +1,8 @@ from typing import Generic, TypeVar -from rainbowadn.chain.reduction.reduction import Reduction -from rainbowadn.chain.reduction.reductionresult import ReductionResult -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.rainbow_factory import RainbowFactory +from rainbowadn.core import * +from .reducible import Reducible +from .reductionresult import ReductionResult __all__ = ('ReductionProtocol',) @@ -14,7 +13,7 @@ AccumulatorType = TypeVar('AccumulatorType') class ReductionProtocol(Generic[ReductorType, AccumulatorType]): async def reduce( self, - reduction: Reduction[ReductorType, AccumulatorType] + reduce: Reducible[ReductorType, AccumulatorType] ) -> ReductionResult[ReductorType, AccumulatorType]: raise NotImplementedError diff --git a/rainbowadn/chain/reduction/reductionstageprotocol.py b/rainbowadn/chain/reduction/reductionstageprotocol.py index e3fe5f9..5e8c55d 100644 --- a/rainbowadn/chain/reduction/reductionstageprotocol.py +++ b/rainbowadn/chain/reduction/reductionstageprotocol.py @@ -1,15 +1,12 @@ from typing import Generic, TypeVar -from rainbowadn.chain.reduction.reduced import Reduced -from rainbowadn.chain.reduction.reduction import Reduction -from rainbowadn.chain.reduction.reductionprotocol import ReductionProtocol -from rainbowadn.chain.reduction.reductionresult import ReductionResult -from rainbowadn.chain.stages.derivation.activestageprotocol import ActiveStageProtocol -from rainbowadn.chain.stages.derivation.derived import Derived -from rainbowadn.chain.stages.derivation.derivedstage import DerivedStage -from rainbowadn.chain.stages.derivation.derivedstate import DerivedState -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.nullability.nullablereference import NullableReference +from rainbowadn.chain.derivation import * +from rainbowadn.core import * +from rainbowadn.nullability import * +from .reduced import Reduced +from .reducible import Reducible +from .reductionprotocol import ReductionProtocol +from .reductionresult import ReductionResult __all__ = ('ReductionStageProtocol',) @@ -18,7 +15,7 @@ AccumulatorType = TypeVar('AccumulatorType') class ReductionStageProtocol( - ActiveStageProtocol[ReductorType, AccumulatorType, Reduction[ReductorType, AccumulatorType]], + ActiveStageProtocol[ReductorType, AccumulatorType, Reducible[ReductorType, AccumulatorType]], Generic[ReductorType, AccumulatorType] ): def __init__(self, protocol: ReductionProtocol[ReductorType, AccumulatorType]): @@ -40,11 +37,11 @@ class ReductionStageProtocol( self, previous: NullableReference[AccumulatorType], header: HashPoint[ReductorType] - ) -> HashPoint[Reduction[ReductorType, AccumulatorType]]: + ) -> HashPoint[Reducible[ReductorType, AccumulatorType]]: assert isinstance(previous, NullableReference) assert isinstance(header, HashPoint) return HashPoint.of( - Reduction( + Reducible( header, await self._derive_accumulator(previous) ) @@ -54,9 +51,9 @@ class ReductionStageProtocol( def _derived_from_reduced( cls, reduced: ReductionResult[ReductorType, AccumulatorType] - ) -> Derived[ReductorType, Reduction[ReductorType, AccumulatorType]]: + ) -> Derived[ReductorType, Reducible[ReductorType, AccumulatorType]]: assert isinstance(reduced, ReductionResult) - if isinstance(reduced, Reduction): + if isinstance(reduced, Reducible): return DerivedStage(HashPoint.of(reduced)) elif isinstance(reduced, Reduced): return DerivedState(reduced.reduced) @@ -65,7 +62,7 @@ class ReductionStageProtocol( async def derive_stage_or_state( self, - stage: HashPoint[Reduction[ReductorType, AccumulatorType]] - ) -> Derived[ReductorType, Reduction[ReductorType, AccumulatorType]]: + stage: HashPoint[Reducible[ReductorType, AccumulatorType]] + ) -> Derived[ReductorType, Reducible[ReductorType, AccumulatorType]]: assert isinstance(stage, HashPoint) return self._derived_from_reduced(await self.protocol.reduce(await stage.resolve())) diff --git a/rainbowadn/chain/reduction/reductionchainmetafactory.py b/rainbowadn/chain/reductionchainmetafactory.py similarity index 63% rename from rainbowadn/chain/reduction/reductionchainmetafactory.py rename to rainbowadn/chain/reductionchainmetafactory.py index 2ee1360..e95572f 100644 --- a/rainbowadn/chain/reduction/reductionchainmetafactory.py +++ b/rainbowadn/chain/reductionchainmetafactory.py @@ -1,14 +1,11 @@ from typing import Generic, TypeVar -from rainbowadn.chain.abstractreductionchainmetafactory import AbstractReductionChainMetaFactory -from rainbowadn.chain.block import Block -from rainbowadn.chain.blockchain import BlockChainFactory -from rainbowadn.chain.chaincollectionfactory import ChainCollectionFactory -from rainbowadn.chain.reduction.reduction import Reduction -from rainbowadn.chain.reduction.reductionchainprotocol import ReductionChainProtocol -from rainbowadn.chain.reduction.reductionprotocol import ReductionProtocol -from rainbowadn.chain.stages.stage import StateStage -from rainbowadn.core.rainbow_factory import RainbowFactory +from rainbowadn.core import * +from .block import Block +from .blockchain import BlockChainFactory +from .chaincollectionfactory import ChainCollectionFactory +from .reduction import * +from .stages import * __all__ = ('ReductionChainMetaFactory',) @@ -20,7 +17,7 @@ class ReductionChainMetaFactory( AbstractReductionChainMetaFactory[ Block[ ReductorType, - StateStage[ReductorType, AccumulatorType, Reduction[ReductorType, AccumulatorType]] + StateStage[ReductorType, AccumulatorType, Reducible[ReductorType, AccumulatorType]] ], ReductorType, AccumulatorType @@ -35,7 +32,7 @@ class ReductionChainMetaFactory( ) -> ChainCollectionFactory[ Block[ ReductorType, - StateStage[ReductorType, AccumulatorType, Reduction[ReductorType, AccumulatorType]] + StateStage[ReductorType, AccumulatorType, Reducible[ReductorType, AccumulatorType]] ], ReductorType, AccumulatorType @@ -54,7 +51,7 @@ class ReductionChainMetaFactory( def loose(self) -> AbstractReductionChainMetaFactory[ Block[ ReductorType, - StateStage[ReductorType, AccumulatorType, Reduction[ReductorType, AccumulatorType]] + StateStage[ReductorType, AccumulatorType, Reducible[ReductorType, AccumulatorType]] ], ReductorType, AccumulatorType diff --git a/rainbowadn/chain/stages/__init__.py b/rainbowadn/chain/stages/__init__.py index e69de29..9152258 100644 --- a/rainbowadn/chain/stages/__init__.py +++ b/rainbowadn/chain/stages/__init__.py @@ -0,0 +1,3 @@ +from .stageprotocol import StageProtocol +from .stagestate import * +from .stagestateprotocol import StageStateProtocol diff --git a/rainbowadn/chain/stages/stageprotocol.py b/rainbowadn/chain/stages/stageprotocol.py index 4621a77..f884cc5 100644 --- a/rainbowadn/chain/stages/stageprotocol.py +++ b/rainbowadn/chain/stages/stageprotocol.py @@ -1,7 +1,7 @@ from typing import Generic, TypeVar -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.nullability.nullablereference import NullableReference +from rainbowadn.core import * +from rainbowadn.nullability import * __all__ = ('StageProtocol',) diff --git a/rainbowadn/chain/stages/stage.py b/rainbowadn/chain/stages/stagestate.py similarity index 92% rename from rainbowadn/chain/stages/stage.py rename to rainbowadn/chain/stages/stagestate.py index 6c80b67..72cc4b9 100644 --- a/rainbowadn/chain/stages/stage.py +++ b/rainbowadn/chain/stages/stagestate.py @@ -1,15 +1,8 @@ from typing import Generic, Iterable, TypeVar -from rainbowadn.chain.stages.stageprotocol import StageProtocol -from rainbowadn.core.asserts import assert_true -from rainbowadn.core.hash_point_format import hash_point_format, tabulate -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.nullability.null import Null -from rainbowadn.core.nullability.nullablereference import NullableReference, NullableReferenceFactory -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.recursivementionable import RecursiveMentionable -from rainbowadn.core.resolverorigin import ResolverOrigin +from rainbowadn.core import * +from rainbowadn.nullability import * +from .stageprotocol import StageProtocol __all__ = ( 'StageStage', diff --git a/rainbowadn/chain/stages/stagestateprotocol.py b/rainbowadn/chain/stages/stagestateprotocol.py index 2bc7c12..05d825a 100644 --- a/rainbowadn/chain/stages/stagestateprotocol.py +++ b/rainbowadn/chain/stages/stagestateprotocol.py @@ -1,10 +1,9 @@ from typing import Generic, TypeVar -from rainbowadn.chain.stages.stage import StateStage -from rainbowadn.chain.states.stateprotocol import StateProtocol -from rainbowadn.core.asserts import assert_true -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.nullability.nullablereference import NullableReference +from rainbowadn.chain.states import * +from rainbowadn.core import * +from rainbowadn.nullability import * +from .stagestate import StateStage __all__ = ('StageStateProtocol',) diff --git a/rainbowadn/chain/states/__init__.py b/rainbowadn/chain/states/__init__.py index e69de29..3fb61f1 100644 --- a/rainbowadn/chain/states/__init__.py +++ b/rainbowadn/chain/states/__init__.py @@ -0,0 +1,3 @@ +from .activestateprotocol import ActiveStateProtocol +from .metareductionstateprotocol import MetaReductionStateProtocol +from .stateprotocol import StateProtocol diff --git a/rainbowadn/chain/states/activestateprotocol.py b/rainbowadn/chain/states/activestateprotocol.py index cd81930..c57137b 100644 --- a/rainbowadn/chain/states/activestateprotocol.py +++ b/rainbowadn/chain/states/activestateprotocol.py @@ -1,9 +1,8 @@ from typing import TypeVar -from rainbowadn.chain.states.stateprotocol import StateProtocol -from rainbowadn.core.asserts import assert_eq -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.nullability.nullablereference import NullableReference +from rainbowadn.core import * +from rainbowadn.nullability import * +from .stateprotocol import StateProtocol __all__ = ('ActiveStateProtocol',) diff --git a/rainbowadn/chain/states/metareductionstateprotocol.py b/rainbowadn/chain/states/metareductionstateprotocol.py index d827662..fc632bf 100644 --- a/rainbowadn/chain/states/metareductionstateprotocol.py +++ b/rainbowadn/chain/states/metareductionstateprotocol.py @@ -1,9 +1,8 @@ from typing import TypeVar -from rainbowadn.chain.states.activestateprotocol import ActiveStateProtocol -from rainbowadn.core.asserts import assert_eq -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.nullability.nullablereference import NullableReference +from rainbowadn.core import * +from rainbowadn.nullability import * +from .activestateprotocol import ActiveStateProtocol __all__ = ('MetaReductionStateProtocol',) diff --git a/rainbowadn/chain/states/stateprotocol.py b/rainbowadn/chain/states/stateprotocol.py index 352e362..1b4a0a4 100644 --- a/rainbowadn/chain/states/stateprotocol.py +++ b/rainbowadn/chain/states/stateprotocol.py @@ -1,7 +1,7 @@ from typing import Generic, TypeVar -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.nullability.nullablereference import NullableReference +from rainbowadn.core import * +from rainbowadn.nullability import * __all__ = ('StateProtocol',) diff --git a/rainbowadn/data/atomic/__init__.py b/rainbowadn/collection/__init__.py similarity index 100% rename from rainbowadn/data/atomic/__init__.py rename to rainbowadn/collection/__init__.py diff --git a/rainbowadn/data/collection/collection_interface/collectioninterface.py b/rainbowadn/collection/collectioninterface.py similarity index 82% rename from rainbowadn/data/collection/collection_interface/collectioninterface.py rename to rainbowadn/collection/collectioninterface.py index e0d9356..95599b3 100644 --- a/rainbowadn/data/collection/collection_interface/collectioninterface.py +++ b/rainbowadn/collection/collectioninterface.py @@ -1,6 +1,6 @@ from typing import Generic, TypeVar -from rainbowadn.core.nullability.nullablereference import NullableReference +from rainbowadn.nullability import * __all__ = ('CollectionInterface',) diff --git a/rainbowadn/collection/comparison/__init__.py b/rainbowadn/collection/comparison/__init__.py new file mode 100644 index 0000000..55bbc56 --- /dev/null +++ b/rainbowadn/collection/comparison/__init__.py @@ -0,0 +1,4 @@ +from .comparator import * +from .hashcomparator import HashComparator +from .keyedcomparator import KeyedComparator +from .plaincomparator import PlainComparator diff --git a/rainbowadn/data/collection/trees/comparison/comparator.py b/rainbowadn/collection/comparison/comparator.py similarity index 92% rename from rainbowadn/data/collection/trees/comparison/comparator.py rename to rainbowadn/collection/comparison/comparator.py index d483479..b45e9a5 100644 --- a/rainbowadn/data/collection/trees/comparison/comparator.py +++ b/rainbowadn/collection/comparison/comparator.py @@ -1,7 +1,7 @@ import abc from typing import Generic, TypeVar -from rainbowadn.core.hashpoint import HashPoint +from rainbowadn.core import * __all__ = ( 'Comparison', diff --git a/rainbowadn/data/collection/trees/comparison/hashcomparator.py b/rainbowadn/collection/comparison/hashcomparator.py similarity index 69% rename from rainbowadn/data/collection/trees/comparison/hashcomparator.py rename to rainbowadn/collection/comparison/hashcomparator.py index aa07d95..95d3587 100644 --- a/rainbowadn/data/collection/trees/comparison/hashcomparator.py +++ b/rainbowadn/collection/comparison/hashcomparator.py @@ -1,8 +1,8 @@ from typing import Generic, TypeVar -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.data.collection.trees.comparison.comparator import Comparison, Left, Right -from rainbowadn.data.collection.trees.comparison.protocolcomparator import ProtocolComparator +from rainbowadn.core import * +from .comparator import * +from .protocolcomparator import ProtocolComparator __all__ = ('HashComparator',) diff --git a/rainbowadn/data/collection/trees/comparison/keyedcomparator.py b/rainbowadn/collection/comparison/keyedcomparator.py similarity index 80% rename from rainbowadn/data/collection/trees/comparison/keyedcomparator.py rename to rainbowadn/collection/comparison/keyedcomparator.py index 070435a..db482a9 100644 --- a/rainbowadn/data/collection/trees/comparison/keyedcomparator.py +++ b/rainbowadn/collection/comparison/keyedcomparator.py @@ -1,8 +1,8 @@ from typing import Generic, TypeVar -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.data.collection.keyed import Keyed -from rainbowadn.data.collection.trees.comparison.comparator import Comparator, Comparison +from rainbowadn.collection.keyed import Keyed +from rainbowadn.core import * +from .comparator import * __all__ = ('KeyedComparator',) diff --git a/rainbowadn/data/collection/trees/comparison/plaincomparator.py b/rainbowadn/collection/comparison/plaincomparator.py similarity index 70% rename from rainbowadn/data/collection/trees/comparison/plaincomparator.py rename to rainbowadn/collection/comparison/plaincomparator.py index 77845d2..d91c513 100644 --- a/rainbowadn/data/collection/trees/comparison/plaincomparator.py +++ b/rainbowadn/collection/comparison/plaincomparator.py @@ -1,7 +1,7 @@ -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.data.atomic.plain import Plain -from rainbowadn.data.collection.trees.comparison.comparator import Comparison, Left, Right -from rainbowadn.data.collection.trees.comparison.protocolcomparator import ProtocolComparator +from rainbowadn.atomic.plain import Plain +from rainbowadn.core import * +from .comparator import * +from .protocolcomparator import ProtocolComparator __all__ = ('PlainComparator',) diff --git a/rainbowadn/data/collection/trees/comparison/protocolcomparator.py b/rainbowadn/collection/comparison/protocolcomparator.py similarity index 77% rename from rainbowadn/data/collection/trees/comparison/protocolcomparator.py rename to rainbowadn/collection/comparison/protocolcomparator.py index ad5df13..f3ec3d2 100644 --- a/rainbowadn/data/collection/trees/comparison/protocolcomparator.py +++ b/rainbowadn/collection/comparison/protocolcomparator.py @@ -1,7 +1,7 @@ import abc from typing import Generic, TypeVar -from rainbowadn.data.collection.trees.comparison.comparator import Comparator, Equal +from .comparator import * __all__ = ('ProtocolComparator',) diff --git a/rainbowadn/data/collection/keyed.py b/rainbowadn/collection/keyed.py similarity index 70% rename from rainbowadn/data/collection/keyed.py rename to rainbowadn/collection/keyed.py index bf942c5..9e9d966 100644 --- a/rainbowadn/data/collection/keyed.py +++ b/rainbowadn/collection/keyed.py @@ -1,8 +1,7 @@ import abc from typing import Generic, TypeVar -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.recursivementionable import RecursiveMentionable +from rainbowadn.core import * __all__ = ('Keyed',) diff --git a/rainbowadn/data/collection/keymetadata.py b/rainbowadn/collection/keymetadata.py similarity index 85% rename from rainbowadn/data/collection/keymetadata.py rename to rainbowadn/collection/keymetadata.py index 46a8fec..2f585f0 100644 --- a/rainbowadn/data/collection/keymetadata.py +++ b/rainbowadn/collection/keymetadata.py @@ -1,11 +1,7 @@ from typing import Generic, Iterable, TypeVar -from rainbowadn.core.hash_point_format import hash_point_format, tabulate -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.resolverorigin import ResolverOrigin -from rainbowadn.data.collection.keyed import Keyed +from rainbowadn.core import * +from .keyed import Keyed __all__ = ('KeyMetadata', 'KeyMetadataFactory',) diff --git a/rainbowadn/data/collection/keyvalue.py b/rainbowadn/collection/keyvalue.py similarity index 85% rename from rainbowadn/data/collection/keyvalue.py rename to rainbowadn/collection/keyvalue.py index 94763a1..404284f 100644 --- a/rainbowadn/data/collection/keyvalue.py +++ b/rainbowadn/collection/keyvalue.py @@ -1,10 +1,7 @@ from typing import Generic, Iterable, TypeVar -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.resolverorigin import ResolverOrigin -from rainbowadn.data.collection.keyed import Keyed +from rainbowadn.core import * +from .keyed import Keyed __all__ = ('KeyValue', 'KeyValueFactory',) diff --git a/rainbowadn/collection/linear/__init__.py b/rainbowadn/collection/linear/__init__.py new file mode 100644 index 0000000..28ec67c --- /dev/null +++ b/rainbowadn/collection/linear/__init__.py @@ -0,0 +1,2 @@ +from .array import * +from .stack import * diff --git a/rainbowadn/data/collection/array/array.py b/rainbowadn/collection/linear/array.py similarity index 82% rename from rainbowadn/data/collection/array/array.py rename to rainbowadn/collection/linear/array.py index 5c29366..3e0d573 100644 --- a/rainbowadn/data/collection/array/array.py +++ b/rainbowadn/collection/linear/array.py @@ -1,11 +1,6 @@ from typing import Generic, Iterable, TypeVar -from rainbowadn.core.hash_point_format import hash_point_format, tabulate -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.recursivementionable import RecursiveMentionable -from rainbowadn.core.resolverorigin import ResolverOrigin +from rainbowadn.core import * __all__ = ('Array', 'ArrayFactory',) diff --git a/rainbowadn/data/collection/stack/stack.py b/rainbowadn/collection/linear/stack.py similarity index 86% rename from rainbowadn/data/collection/stack/stack.py rename to rainbowadn/collection/linear/stack.py index 30f2743..db04f0b 100644 --- a/rainbowadn/data/collection/stack/stack.py +++ b/rainbowadn/collection/linear/stack.py @@ -1,13 +1,7 @@ from typing import AsyncIterable, Generic, Iterable, TypeVar -from rainbowadn.core.hash_point_format import hash_point_format, tabulate -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.nullability.null import Null -from rainbowadn.core.nullability.nullablereference import NullableReference, NullableReferenceFactory -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.recursivementionable import RecursiveMentionable -from rainbowadn.core.resolverorigin import ResolverOrigin +from rainbowadn.core import * +from rainbowadn.nullability import * __all__ = ('Stack', 'StackFactory',) diff --git a/rainbowadn/data/collection/pair.py b/rainbowadn/collection/pair.py similarity index 84% rename from rainbowadn/data/collection/pair.py rename to rainbowadn/collection/pair.py index 178b874..29df9f0 100644 --- a/rainbowadn/data/collection/pair.py +++ b/rainbowadn/collection/pair.py @@ -1,11 +1,6 @@ from typing import Generic, Iterable, TypeVar -from rainbowadn.core.hash_point_format import hash_point_format, tabulate -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.recursivementionable import RecursiveMentionable -from rainbowadn.core.resolverorigin import ResolverOrigin +from rainbowadn.core import * __all__ = ('Pair', 'PairFactory',) diff --git a/rainbowadn/data/collection/__init__.py b/rainbowadn/collection/trees/__init__.py similarity index 100% rename from rainbowadn/data/collection/__init__.py rename to rainbowadn/collection/trees/__init__.py diff --git a/rainbowadn/collection/trees/binary/__init__.py b/rainbowadn/collection/trees/binary/__init__.py new file mode 100644 index 0000000..9fc14df --- /dev/null +++ b/rainbowadn/collection/trees/binary/__init__.py @@ -0,0 +1,3 @@ +from .activebinarytree import ActiveBinaryTree +from .avl import AVL +from .binarytree import * diff --git a/rainbowadn/collection/trees/binary/actions/__init__.py b/rainbowadn/collection/trees/binary/actions/__init__.py new file mode 100644 index 0000000..a35fba2 --- /dev/null +++ b/rainbowadn/collection/trees/binary/actions/__init__.py @@ -0,0 +1,3 @@ +from .binaryaction import BinaryAction +from .stdactions import * +from .symmetric import * diff --git a/rainbowadn/data/collection/trees/binary/actions/binaryaction.py b/rainbowadn/collection/trees/binary/actions/binaryaction.py similarity index 83% rename from rainbowadn/data/collection/trees/binary/actions/binaryaction.py rename to rainbowadn/collection/trees/binary/actions/binaryaction.py index e42411b..ba8446c 100644 --- a/rainbowadn/data/collection/trees/binary/actions/binaryaction.py +++ b/rainbowadn/collection/trees/binary/actions/binaryaction.py @@ -1,11 +1,9 @@ from typing import Generic, TypeVar -from rainbowadn.data.collection.trees.binary.binaryprotocolized import BinaryProtocolized +from rainbowadn.collection.trees.binary.core import * __all__ = ('BinaryAction',) -from rainbowadn.data.collection.trees.binary.protocolizedbinarysplit import ProtocolizedBinarySplit - TreeType = TypeVar('TreeType') ActiveKeyType = TypeVar('ActiveKeyType') MetaDataType = TypeVar('MetaDataType') diff --git a/rainbowadn/data/collection/trees/binary/actions/compareaction.py b/rainbowadn/collection/trees/binary/actions/compareaction.py similarity index 84% rename from rainbowadn/data/collection/trees/binary/actions/compareaction.py rename to rainbowadn/collection/trees/binary/actions/compareaction.py index 01c0413..d3d7f1b 100644 --- a/rainbowadn/data/collection/trees/binary/actions/compareaction.py +++ b/rainbowadn/collection/trees/binary/actions/compareaction.py @@ -1,10 +1,10 @@ import abc from typing import Generic, TypeVar -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.data.collection.trees.binary.actions.binaryaction import BinaryAction -from rainbowadn.data.collection.trees.binary.protocolizedbinarysplit import ProtocolizedBinarySplit -from rainbowadn.data.collection.trees.comparison.comparator import Comparison, Equal, Left, Right +from rainbowadn.collection.comparison import * +from rainbowadn.collection.trees.binary.core import * +from rainbowadn.core import * +from .binaryaction import BinaryAction __all__ = ('CompareAction',) diff --git a/rainbowadn/data/collection/trees/binary/actions/stdactions.py b/rainbowadn/collection/trees/binary/actions/stdactions.py similarity index 89% rename from rainbowadn/data/collection/trees/binary/actions/stdactions.py rename to rainbowadn/collection/trees/binary/actions/stdactions.py index cdf2ce1..8f3f8bf 100644 --- a/rainbowadn/data/collection/trees/binary/actions/stdactions.py +++ b/rainbowadn/collection/trees/binary/actions/stdactions.py @@ -1,10 +1,9 @@ from typing import Generic, TypeVar -from rainbowadn.data.collection.trees.binary.actions.binaryaction import BinaryAction -from rainbowadn.data.collection.trees.binary.actions.compareaction import CompareAction -from rainbowadn.data.collection.trees.binary.binaryprotocolized import BinaryProtocolized -from rainbowadn.data.collection.trees.binary.protocolizedbinarysplit import ProtocolizedBinarySplit -from rainbowadn.data.collection.trees.comparison.comparator import Equal, Replace +from rainbowadn.collection.comparison import * +from rainbowadn.collection.trees.binary.core import * +from .binaryaction import BinaryAction +from .compareaction import CompareAction __all__ = ('AddAction', 'RemoveAction', 'ContainsAction',) @@ -57,7 +56,7 @@ class AddAction( protocolized: BinaryProtocolized[ActiveKeyType, MetaDataType, TreeType], ) -> TreeType: assert isinstance(protocolized, BinaryProtocolized) - return await protocolized.protocol.tree(protocolized.tree, protocolized.tree, self.key) + return await protocolized.creation.tree(protocolized.tree, protocolized.tree, self.key) class MergeAction( diff --git a/rainbowadn/data/collection/trees/binary/actions/symmetric.py b/rainbowadn/collection/trees/binary/actions/symmetric.py similarity index 89% rename from rainbowadn/data/collection/trees/binary/actions/symmetric.py rename to rainbowadn/collection/trees/binary/actions/symmetric.py index 82a3090..1b0be6a 100644 --- a/rainbowadn/data/collection/trees/binary/actions/symmetric.py +++ b/rainbowadn/collection/trees/binary/actions/symmetric.py @@ -1,9 +1,7 @@ from typing import Generic, TypeVar -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.data.collection.trees.binary.binarycreation import BinaryCreation -from rainbowadn.data.collection.trees.binary.binaryprotocolized import BinaryProtocolized -from rainbowadn.data.collection.trees.binary.binarysplit import BinarySplit +from rainbowadn.collection.trees.binary.core import * +from rainbowadn.core import * __all__ = ('Symmetric', 'InnerOuter', 'OuterInner',) diff --git a/rainbowadn/data/collection/trees/binary/activebinarytree.py b/rainbowadn/collection/trees/binary/activebinarytree.py similarity index 81% rename from rainbowadn/data/collection/trees/binary/activebinarytree.py rename to rainbowadn/collection/trees/binary/activebinarytree.py index 1b37c86..4051991 100644 --- a/rainbowadn/data/collection/trees/binary/activebinarytree.py +++ b/rainbowadn/collection/trees/binary/activebinarytree.py @@ -1,18 +1,12 @@ from typing import Generic, Optional, TypeVar -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.nullability.null import Null -from rainbowadn.core.nullability.nullablereference import NullableReference -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.data.collection.collection_interface.collectioninterface import CollectionInterface -from rainbowadn.data.collection.keymetadata import KeyMetadata, KeyMetadataFactory -from rainbowadn.data.collection.trees.binary.actions.stdactions import AddAction, ContainsAction, RemoveAction -from rainbowadn.data.collection.trees.binary.balancedcreation import BalancedCreation -from rainbowadn.data.collection.trees.binary.binarybalancing import BinaryBalancing -from rainbowadn.data.collection.trees.binary.binarycreation import BinaryCreation -from rainbowadn.data.collection.trees.binary.binaryprotocolized import BinaryProtocolized -from rainbowadn.data.collection.trees.binary.binarysplit import BinarySplit -from rainbowadn.data.collection.trees.binary.binarytree import BinaryTree, BinaryTreeFactory +from rainbowadn.collection.collectioninterface import CollectionInterface +from rainbowadn.collection.keymetadata import * +from rainbowadn.core import * +from rainbowadn.nullability import * +from .actions import * +from .binarytree import * +from .core import * __all__ = ('ActiveBinaryTree',) diff --git a/rainbowadn/data/collection/trees/binary/avl.py b/rainbowadn/collection/trees/binary/avl.py similarity index 59% rename from rainbowadn/data/collection/trees/binary/avl.py rename to rainbowadn/collection/trees/binary/avl.py index 5af011e..6329f1c 100644 --- a/rainbowadn/data/collection/trees/binary/avl.py +++ b/rainbowadn/collection/trees/binary/avl.py @@ -1,14 +1,9 @@ from typing import Generic, TypeVar -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.data.atomic.integer import Integer -from rainbowadn.data.collection.trees.binary.actions.binaryaction import BinaryAction -from rainbowadn.data.collection.trees.binary.actions.symmetric import InnerOuter, OuterInner, Symmetric -from rainbowadn.data.collection.trees.binary.binarybalancing import BinaryBalancing -from rainbowadn.data.collection.trees.binary.binarycreation import BinaryCreation -from rainbowadn.data.collection.trees.binary.binaryprotocolized import BinaryProtocolized -from rainbowadn.data.collection.trees.binary.binarysplit import BinarySplit -from rainbowadn.data.collection.trees.binary.protocolizedbinarysplit import ProtocolizedBinarySplit +from rainbowadn.atomic import * +from rainbowadn.core import * +from .actions import * +from .core import * __all__ = ('AVL',) @@ -25,16 +20,16 @@ class AVL(BinaryBalancing[ActiveKeyType, Integer, TreeType]): treel: TreeType, treer: TreeType, key: HashPoint[ActiveKeyType], - protocol: BinaryCreation[ActiveKeyType, Integer, TreeType] + creation: BinaryCreation[ActiveKeyType, Integer, TreeType] ) -> HashPoint[Integer]: - assert isinstance(protocol, BinaryCreation) + assert isinstance(creation, BinaryCreation) return HashPoint.of( Integer( 1 + max( - await self.height(BinaryProtocolized(protocol, treel)), - await self.height(BinaryProtocolized(protocol, treer)) + await self.height(BinaryProtocolized(creation, treel)), + await self.height(BinaryProtocolized(creation, treer)) ) ) ) @@ -97,26 +92,26 @@ class BalanceAction( @classmethod async def on_symmetric( cls, - symmetric: Symmetric[ActiveKeyType, Integer, TreeType], + symmetry: Symmetric[ActiveKeyType, Integer, TreeType], split: BinarySplit[ActiveKeyType, Integer, TreeType] ) -> TreeType: - assert isinstance(symmetric, Symmetric) + assert isinstance(symmetry, Symmetric) assert isinstance(split, BinarySplit) - splito = await symmetric.protocol.fsplit(symmetric.outer(split)) + splito = await symmetry.protocol.fsplit(symmetry.outer(split)) if ( - (await AVL.height(symmetric.protocolizedi(splito))) + (await AVL.height(symmetry.protocolizedi(splito))) > - (await AVL.height(symmetric.protocolizedo(splito))) + (await AVL.height(symmetry.protocolizedo(splito))) ): - splitoi = await symmetric.protocol.fsplit(symmetric.inner(splito)) - return await symmetric.tree( - await symmetric.tree(symmetric.inner(split), symmetric.inner(splitoi), split.key), - await symmetric.tree(symmetric.outer(splitoi), symmetric.outer(splito), splito.key), + splitoi = await symmetry.protocol.fsplit(symmetry.inner(splito)) + return await symmetry.tree( + await symmetry.tree(symmetry.inner(split), symmetry.inner(splitoi), split.key), + await symmetry.tree(symmetry.outer(splitoi), symmetry.outer(splito), splito.key), splitoi.key ) else: - return await symmetric.tree( - await symmetric.tree(symmetric.inner(split), symmetric.inner(splito), split.key), - symmetric.outer(splito), + return await symmetry.tree( + await symmetry.tree(symmetry.inner(split), symmetry.inner(splito), split.key), + symmetry.outer(splito), splito.key ) diff --git a/rainbowadn/data/collection/trees/binary/binarytree.py b/rainbowadn/collection/trees/binary/binarytree.py similarity index 83% rename from rainbowadn/data/collection/trees/binary/binarytree.py rename to rainbowadn/collection/trees/binary/binarytree.py index 8e38405..321aa87 100644 --- a/rainbowadn/data/collection/trees/binary/binarytree.py +++ b/rainbowadn/collection/trees/binary/binarytree.py @@ -1,12 +1,7 @@ from typing import Generic, Iterable, TypeVar -from rainbowadn.core.hash_point_format import hash_point_format, tabulate -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.nullability.nullablereference import NullableReference, NullableReferenceFactory -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.recursivementionable import RecursiveMentionable -from rainbowadn.core.resolverorigin import ResolverOrigin +from rainbowadn.core import * +from rainbowadn.nullability import * __all__ = ('BinaryTree', 'BinaryTreeFactory',) diff --git a/rainbowadn/collection/trees/binary/core/__init__.py b/rainbowadn/collection/trees/binary/core/__init__.py new file mode 100644 index 0000000..3b31f8c --- /dev/null +++ b/rainbowadn/collection/trees/binary/core/__init__.py @@ -0,0 +1,6 @@ +from .balancedcreation import BalancedCreation +from .binarybalancing import BinaryBalancing +from .binarycreation import BinaryCreation +from .binaryprotocolized import BinaryProtocolized +from .binarysplit import BinarySplit +from .protocolizedbinarysplit import ProtocolizedBinarySplit diff --git a/rainbowadn/data/collection/trees/binary/balancedcreation.py b/rainbowadn/collection/trees/binary/core/balancedcreation.py similarity index 80% rename from rainbowadn/data/collection/trees/binary/balancedcreation.py rename to rainbowadn/collection/trees/binary/core/balancedcreation.py index 8a5a50c..ad9b605 100644 --- a/rainbowadn/data/collection/trees/binary/balancedcreation.py +++ b/rainbowadn/collection/trees/binary/core/balancedcreation.py @@ -1,14 +1,13 @@ import abc from typing import Generic, TypeVar -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.data.collection.trees.binary.binarybalancing import BinaryBalancing -from rainbowadn.data.collection.trees.binary.binarycreation import BinaryCreation +from rainbowadn.core import * +from .binarybalancing import BinaryBalancing +from .binarycreation import BinaryCreation +from .binaryprotocolized import BinaryProtocolized __all__ = ('BalancedCreation',) -from rainbowadn.data.collection.trees.binary.binaryprotocolized import BinaryProtocolized - TreeType = TypeVar('TreeType') ActiveKeyType = TypeVar('ActiveKeyType') MetaDataType = TypeVar('MetaDataType') diff --git a/rainbowadn/data/collection/trees/binary/binarybalancing.py b/rainbowadn/collection/trees/binary/core/binarybalancing.py similarity index 58% rename from rainbowadn/data/collection/trees/binary/binarybalancing.py rename to rainbowadn/collection/trees/binary/core/binarybalancing.py index 0e7d269..f214ae4 100644 --- a/rainbowadn/data/collection/trees/binary/binarybalancing.py +++ b/rainbowadn/collection/trees/binary/core/binarybalancing.py @@ -1,9 +1,9 @@ from typing import Generic, TypeVar -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.data.collection.trees.binary.binarycreation import BinaryCreation -from rainbowadn.data.collection.trees.binary.binaryprotocolized import BinaryProtocolized -from rainbowadn.data.collection.trees.comparison.comparator import Comparator +from rainbowadn.collection.comparison import * +from rainbowadn.core import * +from .binarycreation import BinaryCreation +from .binaryprotocolized import BinaryProtocolized __all__ = ('BinaryBalancing',) @@ -13,12 +13,9 @@ MetaDataType = TypeVar('MetaDataType') class BinaryBalancing(Generic[ActiveKeyType, MetaDataType, TreeType]): - def __init__( - self, - comparator: Comparator[ActiveKeyType] - ): - assert isinstance(comparator, Comparator) - self.comparator = comparator + def __init__(self, comparator_: Comparator[ActiveKeyType]): + assert isinstance(comparator_, Comparator) + self.comparator = comparator_ def empty_metadata(self) -> HashPoint[MetaDataType]: raise NotImplementedError @@ -28,7 +25,7 @@ class BinaryBalancing(Generic[ActiveKeyType, MetaDataType, TreeType]): treel: TreeType, treer: TreeType, key: HashPoint[ActiveKeyType], - protocol: BinaryCreation[ActiveKeyType, MetaDataType, TreeType] + creation: BinaryCreation[ActiveKeyType, MetaDataType, TreeType] ) -> HashPoint[MetaDataType]: raise NotImplementedError diff --git a/rainbowadn/data/collection/trees/binary/binarycreation.py b/rainbowadn/collection/trees/binary/core/binarycreation.py similarity index 75% rename from rainbowadn/data/collection/trees/binary/binarycreation.py rename to rainbowadn/collection/trees/binary/core/binarycreation.py index da09c55..8e5cf2f 100644 --- a/rainbowadn/data/collection/trees/binary/binarycreation.py +++ b/rainbowadn/collection/trees/binary/core/binarycreation.py @@ -1,8 +1,8 @@ from typing import Generic, Optional, TypeVar -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.data.collection.trees.binary.binarysplit import BinarySplit -from rainbowadn.data.collection.trees.comparison.comparator import Comparator +from rainbowadn.collection.comparison import * +from rainbowadn.core import * +from .binarysplit import BinarySplit __all__ = ('BinaryCreation',) @@ -12,8 +12,9 @@ MetaDataType = TypeVar('MetaDataType') class BinaryCreation(Generic[ActiveKeyType, MetaDataType, TreeType]): - def __init__(self, comparator: Comparator[ActiveKeyType]): - self.comparator = comparator + def __init__(self, comparator_: Comparator[ActiveKeyType]): + assert isinstance(comparator_, Comparator) + self.comparator = comparator_ async def split(self, tree: TreeType) -> Optional[ BinarySplit[ActiveKeyType, MetaDataType, TreeType] diff --git a/rainbowadn/data/collection/trees/binary/binaryprotocolized.py b/rainbowadn/collection/trees/binary/core/binaryprotocolized.py similarity index 57% rename from rainbowadn/data/collection/trees/binary/binaryprotocolized.py rename to rainbowadn/collection/trees/binary/core/binaryprotocolized.py index f3c9e67..0f6674b 100644 --- a/rainbowadn/data/collection/trees/binary/binaryprotocolized.py +++ b/rainbowadn/collection/trees/binary/core/binaryprotocolized.py @@ -1,7 +1,7 @@ from typing import Generic, Optional, TypeVar -from rainbowadn.data.collection.trees.binary.binarycreation import BinaryCreation -from rainbowadn.data.collection.trees.binary.binarysplit import BinarySplit +from .binarycreation import BinaryCreation +from .binarysplit import BinarySplit __all__ = ('BinaryProtocolized',) @@ -15,12 +15,12 @@ class BinaryProtocolized( ): def __init__( self, - protocol: BinaryCreation[ActiveKeyType, MetaDataType, TreeType], + creation: BinaryCreation[ActiveKeyType, MetaDataType, TreeType], tree: TreeType ): - assert isinstance(protocol, BinaryCreation) - self.protocol = protocol + assert isinstance(creation, BinaryCreation) + self.creation = creation self.tree = tree async def split(self) -> Optional[BinarySplit[ActiveKeyType, MetaDataType, TreeType]]: - return await self.protocol.split(self.tree) + return await self.creation.split(self.tree) diff --git a/rainbowadn/data/collection/trees/binary/binarysplit.py b/rainbowadn/collection/trees/binary/core/binarysplit.py similarity index 93% rename from rainbowadn/data/collection/trees/binary/binarysplit.py rename to rainbowadn/collection/trees/binary/core/binarysplit.py index df34572..1a9c12e 100644 --- a/rainbowadn/data/collection/trees/binary/binarysplit.py +++ b/rainbowadn/collection/trees/binary/core/binarysplit.py @@ -1,6 +1,6 @@ from typing import Generic, TypeVar -from rainbowadn.core.hashpoint import HashPoint +from rainbowadn.core import * __all__ = ('BinarySplit',) diff --git a/rainbowadn/data/collection/trees/binary/protocolizedbinarysplit.py b/rainbowadn/collection/trees/binary/core/protocolizedbinarysplit.py similarity index 82% rename from rainbowadn/data/collection/trees/binary/protocolizedbinarysplit.py rename to rainbowadn/collection/trees/binary/core/protocolizedbinarysplit.py index 866152f..2ccaf08 100644 --- a/rainbowadn/data/collection/trees/binary/protocolizedbinarysplit.py +++ b/rainbowadn/collection/trees/binary/core/protocolizedbinarysplit.py @@ -1,8 +1,8 @@ from typing import Generic, Optional, TypeVar -from rainbowadn.data.collection.trees.binary.binarycreation import BinaryCreation -from rainbowadn.data.collection.trees.binary.binaryprotocolized import BinaryProtocolized -from rainbowadn.data.collection.trees.binary.binarysplit import BinarySplit +from .binarycreation import BinaryCreation +from .binaryprotocolized import BinaryProtocolized +from .binarysplit import BinarySplit __all__ = ('ProtocolizedBinarySplit',) @@ -45,4 +45,4 @@ class ProtocolizedBinarySplit( if (split := await protocolized.split()) is None: return None else: - return ProtocolizedBinarySplit(protocolized.protocol, split, protocolized.tree) + return ProtocolizedBinarySplit(protocolized.creation, split, protocolized.tree) diff --git a/rainbowadn/core/__init__.py b/rainbowadn/core/__init__.py index e69de29..ad61c0e 100644 --- a/rainbowadn/core/__init__.py +++ b/rainbowadn/core/__init__.py @@ -0,0 +1,15 @@ +from .asserts import * +from .extendableresolver import ExtendableResolver +from .hash_point_format import * +from .hashpoint import HashPoint +from .hashresolver import HashResolver +from .localmetaorigin import LocalMetaOrigin +from .localorigin import LocalOrigin +from .mentionable import Mentionable +from .metaorigin import MetaOrigin +from .origin import Origin +from .rainbow_factory import RainbowFactory +from .recursivementionable import RecursiveMentionable +from .resolvermetaorigin import ResolverMetaOrigin +from .resolverorigin import ResolverOrigin +from .static import * diff --git a/rainbowadn/core/asserts.py b/rainbowadn/core/asserts.py index c9d2bbf..051c862 100644 --- a/rainbowadn/core/asserts.py +++ b/rainbowadn/core/asserts.py @@ -1,5 +1,7 @@ from typing import Optional, TypeVar +__all__ = ('assert_true', 'assert_false', 'assert_none', 'assert_eq',) + def assert_true(value: bool) -> bool: assert value is True diff --git a/rainbowadn/core/extendableresolver.py b/rainbowadn/core/extendableresolver.py index 9c1b8fc..a07c41c 100644 --- a/rainbowadn/core/extendableresolver.py +++ b/rainbowadn/core/extendableresolver.py @@ -1,9 +1,11 @@ import abc from typing import TypeVar -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.resolvermetaorigin import ResolverMetaOrigin +from .hashpoint import HashPoint +from .hashresolver import HashResolver +from .resolvermetaorigin import ResolverMetaOrigin + +__all__ = ('ExtendableResolver',) Mentioned = TypeVar('Mentioned') diff --git a/rainbowadn/core/hash_point_format.py b/rainbowadn/core/hash_point_format.py index f6838de..7e85fab 100644 --- a/rainbowadn/core/hash_point_format.py +++ b/rainbowadn/core/hash_point_format.py @@ -1,6 +1,6 @@ -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.mentionable import Mentionable -from rainbowadn.core.recursivementionable import RecursiveMentionable +from .hashpoint import HashPoint +from .mentionable import Mentionable +from .recursivementionable import RecursiveMentionable __all__ = ('hash_point_format', 'tabulate',) diff --git a/rainbowadn/core/hashpoint.py b/rainbowadn/core/hashpoint.py index 0914421..a8a6b49 100644 --- a/rainbowadn/core/hashpoint.py +++ b/rainbowadn/core/hashpoint.py @@ -1,11 +1,11 @@ import hashlib from typing import Generic, TypeVar -from rainbowadn.core.asserts import assert_eq -from rainbowadn.core.localorigin import LocalOrigin -from rainbowadn.core.mentionable import Mentionable -from rainbowadn.core.origin import Origin -from rainbowadn.core.rainbow_factory import RainbowFactory +from .asserts import * +from .localorigin import LocalOrigin +from .mentionable import Mentionable +from .origin import Origin +from .rainbow_factory import RainbowFactory __all__ = ('HashPoint',) diff --git a/rainbowadn/core/localmetaorigin.py b/rainbowadn/core/localmetaorigin.py index 46eb247..86e58a9 100644 --- a/rainbowadn/core/localmetaorigin.py +++ b/rainbowadn/core/localmetaorigin.py @@ -1,10 +1,10 @@ from typing import Generic, TypeVar -from rainbowadn.core.asserts import assert_eq -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.metaorigin import MetaOrigin -from rainbowadn.core.origin import Origin -from rainbowadn.core.rainbow_factory import RainbowFactory +from .asserts import * +from .hashpoint import HashPoint +from .metaorigin import MetaOrigin +from .origin import Origin +from .rainbow_factory import RainbowFactory __all__ = ('LocalMetaOrigin',) diff --git a/rainbowadn/core/localorigin.py b/rainbowadn/core/localorigin.py index 520970a..85deff0 100644 --- a/rainbowadn/core/localorigin.py +++ b/rainbowadn/core/localorigin.py @@ -1,7 +1,7 @@ from typing import Generic, TypeVar -from rainbowadn.core.mentionable import Mentionable -from rainbowadn.core.origin import Origin +from .mentionable import Mentionable +from .origin import Origin __all__ = ('LocalOrigin',) diff --git a/rainbowadn/core/mentionable.py b/rainbowadn/core/mentionable.py index 6e05d21..c33cbd2 100644 --- a/rainbowadn/core/mentionable.py +++ b/rainbowadn/core/mentionable.py @@ -1,6 +1,6 @@ from typing import TypeVar -from rainbowadn.core.rainbow_factory import RainbowFactory +from .rainbow_factory import RainbowFactory __all__ = ('Mentionable',) diff --git a/rainbowadn/core/metaorigin.py b/rainbowadn/core/metaorigin.py index 751181d..708b179 100644 --- a/rainbowadn/core/metaorigin.py +++ b/rainbowadn/core/metaorigin.py @@ -1,9 +1,9 @@ from typing import Generic, TypeVar -from rainbowadn.core.asserts import assert_eq -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.origin import Origin -from rainbowadn.core.rainbow_factory import RainbowFactory +from .asserts import * +from .hashpoint import HashPoint +from .origin import Origin +from .rainbow_factory import RainbowFactory __all__ = ('MetaOrigin',) diff --git a/rainbowadn/core/origin.py b/rainbowadn/core/origin.py index 691409e..b9be1cb 100644 --- a/rainbowadn/core/origin.py +++ b/rainbowadn/core/origin.py @@ -1,6 +1,6 @@ from typing import Generic, TypeVar -from rainbowadn.core.rainbow_factory import RainbowFactory +from .rainbow_factory import RainbowFactory __all__ = ('Origin',) diff --git a/rainbowadn/core/rainbow_factory.py b/rainbowadn/core/rainbow_factory.py index 688b73e..9eecf32 100644 --- a/rainbowadn/core/rainbow_factory.py +++ b/rainbowadn/core/rainbow_factory.py @@ -1,6 +1,6 @@ from typing import Generic, TypeVar -from rainbowadn.core.hashresolver import HashResolver +from .hashresolver import HashResolver __all__ = ('RainbowFactory',) diff --git a/rainbowadn/core/recursivementionable.py b/rainbowadn/core/recursivementionable.py index 4a7a02c..70da2d7 100644 --- a/rainbowadn/core/recursivementionable.py +++ b/rainbowadn/core/recursivementionable.py @@ -1,8 +1,8 @@ import abc from typing import Iterable -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.mentionable import Mentionable +from .hashpoint import HashPoint +from .mentionable import Mentionable __all__ = ('RecursiveMentionable',) diff --git a/rainbowadn/core/resolvermetaorigin.py b/rainbowadn/core/resolvermetaorigin.py index 055050f..d6fb1f3 100644 --- a/rainbowadn/core/resolvermetaorigin.py +++ b/rainbowadn/core/resolvermetaorigin.py @@ -1,12 +1,12 @@ from typing import Generic, TypeVar -from rainbowadn.core.asserts import assert_eq -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.metaorigin import MetaOrigin -from rainbowadn.core.origin import Origin -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.resolverorigin import ResolverOrigin +from .asserts import * +from .hashpoint import HashPoint +from .hashresolver import HashResolver +from .metaorigin import MetaOrigin +from .origin import Origin +from .rainbow_factory import RainbowFactory +from .resolverorigin import ResolverOrigin __all__ = ('ResolverMetaOrigin',) diff --git a/rainbowadn/core/resolverorigin.py b/rainbowadn/core/resolverorigin.py index 3a4d407..a448a88 100644 --- a/rainbowadn/core/resolverorigin.py +++ b/rainbowadn/core/resolverorigin.py @@ -1,11 +1,11 @@ from typing import Generic, TypeVar -from rainbowadn.core.asserts import assert_eq -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.mentionable import Mentionable -from rainbowadn.core.origin import Origin -from rainbowadn.core.rainbow_factory import RainbowFactory +from .asserts import * +from .hashpoint import HashPoint +from .hashresolver import HashResolver +from .mentionable import Mentionable +from .origin import Origin +from .rainbow_factory import RainbowFactory __all__ = ('ResolverOrigin',) diff --git a/rainbowadn/core/static.py b/rainbowadn/core/static.py index bbbda75..b304279 100644 --- a/rainbowadn/core/static.py +++ b/rainbowadn/core/static.py @@ -1,9 +1,9 @@ import abc from typing import Generic, Type, TypeVar -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.mentionable import Mentionable -from rainbowadn.core.rainbow_factory import RainbowFactory +from .hashresolver import HashResolver +from .mentionable import Mentionable +from .rainbow_factory import RainbowFactory __all__ = ('StaticMentionable', 'StaticFactory',) diff --git a/rainbowadn/data/collection/array/__init__.py b/rainbowadn/data/collection/array/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/rainbowadn/data/collection/collection_interface/__init__.py b/rainbowadn/data/collection/collection_interface/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/rainbowadn/data/collection/stack/__init__.py b/rainbowadn/data/collection/stack/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/rainbowadn/data/collection/trees/__init__.py b/rainbowadn/data/collection/trees/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/rainbowadn/data/collection/trees/b/__init__.py b/rainbowadn/data/collection/trees/b/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/rainbowadn/data/collection/trees/binary/__init__.py b/rainbowadn/data/collection/trees/binary/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/rainbowadn/data/collection/trees/binary/actions/__init__.py b/rainbowadn/data/collection/trees/binary/actions/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/rainbowadn/data/collection/trees/comparison/__init__.py b/rainbowadn/data/collection/trees/comparison/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/rainbowadn/encryption/__init__.py b/rainbowadn/encryption/__init__.py index e69de29..6b79479 100644 --- a/rainbowadn/encryption/__init__.py +++ b/rainbowadn/encryption/__init__.py @@ -0,0 +1 @@ +from .encrypted import * diff --git a/rainbowadn/encryption/encrypted.py b/rainbowadn/encryption/encrypted.py index ab488c5..a07a5ec 100644 --- a/rainbowadn/encryption/encrypted.py +++ b/rainbowadn/encryption/encrypted.py @@ -3,14 +3,7 @@ from typing import Generic, Iterable, TypeVar from nacl.bindings import crypto_hash_sha256 from nacl.secret import SecretBox -from rainbowadn.core.asserts import assert_eq -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.mentionable import Mentionable -from rainbowadn.core.origin import Origin -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.recursivementionable import RecursiveMentionable -from rainbowadn.core.resolverorigin import ResolverOrigin +from rainbowadn.core import * __all__ = ('Encrypted', 'EncryptedFactory') @@ -49,9 +42,9 @@ class Encrypted(RecursiveMentionable, Generic[EncryptedType]): hashpoints = tuple(decrypted.points()) if isinstance(decrypted, RecursiveMentionable) else () resolution: tuple[HashPoint[Encrypted[EncryptedType]], ...] = tuple( [ - await cls.encrypt_hashpoint(hashpoint, key) + await cls.encrypt_hashpoint(hash_point, key) for - hashpoint + hash_point in hashpoints ] @@ -65,20 +58,20 @@ class Encrypted(RecursiveMentionable, Generic[EncryptedType]): @classmethod async def encrypt_hashpoint( - cls, hashpoint: HashPoint[EncryptedType], key: bytes + cls, hash_point: HashPoint[EncryptedType], key: bytes ) -> HashPoint['Encrypted[EncryptedType]']: - assert isinstance(hashpoint, HashPoint) + assert isinstance(hash_point, HashPoint) assert isinstance(key, bytes) - if isinstance(hashpoint.origin, ResolverOrigin): - resolver: HashResolver = hashpoint.origin.resolver + if isinstance(hash_point.origin, ResolverOrigin): + resolver: HashResolver = hash_point.origin.resolver assert isinstance(resolver, HashResolver) if isinstance(resolver, EncryptedResolver) and resolver.key == key: return ShortcutOrigin( - hashpoint.factory, - resolver.mapping[hashpoint.point], + hash_point.factory, + resolver.mapping[hash_point.point], key ).hash_point() - return HashPoint.of(await cls.encrypt(await hashpoint.resolve(), key)) + return HashPoint.of(await cls.encrypt(await hash_point.resolve(), key)) @classmethod def construct( @@ -89,7 +82,7 @@ class Encrypted(RecursiveMentionable, Generic[EncryptedType]): decrypted: EncryptedType ) -> 'Encrypted[EncryptedType]': mapping: dict[bytes, HashPoint[Encrypted]] = { - hashpoint.point: encrypted for hashpoint, encrypted in zip(hashpoints, resolution) + hash_point.point: encrypted for hash_point, encrypted in zip(hashpoints, resolution) } return Encrypted( key, @@ -136,12 +129,12 @@ class EncryptedFactory(RainbowFactory[Encrypted[EncryptedType]], Generic[Encrypt resolution: tuple[HashPoint[Encrypted], ...] = tuple( ResolverOrigin( EncryptedFactory( - hashpoint.factory, + hash_point.factory, self.key ), plain[8 + i * HashPoint.HASH_LENGTH: 8 + (i + 1) * HashPoint.HASH_LENGTH], resolver - ).hash_point() for i, hashpoint in enumerate(hashpoints) + ).hash_point() for i, hash_point in enumerate(hashpoints) ) return Encrypted.construct( self.key, @@ -165,13 +158,13 @@ class EncryptedResolver(HashResolver): class ShortcutOrigin(Origin[Encrypted[EncryptedType]], Generic[EncryptedType]): - def __init__(self, factory: RainbowFactory[EncryptedType], hashpoint: HashPoint[Encrypted], key: bytes): + def __init__(self, factory: RainbowFactory[EncryptedType], hash_point: HashPoint[Encrypted], key: bytes): assert isinstance(factory, RainbowFactory) - assert isinstance(hashpoint, HashPoint) + assert isinstance(hash_point, HashPoint) assert isinstance(key, bytes) self.factory: RainbowFactory[Encrypted[EncryptedType]] = EncryptedFactory(factory, key) assert isinstance(self.factory, RainbowFactory) - self.hashpoint = hashpoint + self.hashpoint = hash_point super().__init__(self.factory) async def resolve(self) -> Encrypted[EncryptedType]: @@ -191,7 +184,7 @@ class ShortcutResolver(HashResolver): def __init__(self, encrypted: Encrypted): assert isinstance(encrypted, Encrypted) self.mapping: dict[bytes, HashPoint[Encrypted]] = { - hashpoint.point: hashpoint for hashpoint in encrypted.resolution + hash_point.point: hash_point for hash_point in encrypted.resolution } async def resolve(self, point: bytes) -> tuple[bytes, 'HashResolver']: diff --git a/rainbowadn/node/__init__.py b/rainbowadn/node/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/rainbowadn/nullability/__init__.py b/rainbowadn/nullability/__init__.py new file mode 100644 index 0000000..9348d42 --- /dev/null +++ b/rainbowadn/nullability/__init__.py @@ -0,0 +1,4 @@ +from .notnull import NotNull +from .null import Null +from .nullable import Nullable +from .nullablereference import * diff --git a/rainbowadn/core/nullability/notnull.py b/rainbowadn/nullability/notnull.py similarity index 89% rename from rainbowadn/core/nullability/notnull.py rename to rainbowadn/nullability/notnull.py index d9044d3..6253336 100644 --- a/rainbowadn/core/nullability/notnull.py +++ b/rainbowadn/nullability/notnull.py @@ -1,6 +1,6 @@ from typing import Generic, TypeVar -from rainbowadn.core.nullability.nullable import Nullable +from .nullable import Nullable __all__ = ('NotNull',) diff --git a/rainbowadn/core/nullability/null.py b/rainbowadn/nullability/null.py similarity index 87% rename from rainbowadn/core/nullability/null.py rename to rainbowadn/nullability/null.py index 690f9e1..e5c8ec0 100644 --- a/rainbowadn/core/nullability/null.py +++ b/rainbowadn/nullability/null.py @@ -1,6 +1,6 @@ from typing import Generic, TypeVar -from rainbowadn.core.nullability.nullable import Nullable +from .nullable import Nullable __all__ = ('Null',) diff --git a/rainbowadn/core/nullability/nullable.py b/rainbowadn/nullability/nullable.py similarity index 100% rename from rainbowadn/core/nullability/nullable.py rename to rainbowadn/nullability/nullable.py diff --git a/rainbowadn/core/nullability/nullablereference.py b/rainbowadn/nullability/nullablereference.py similarity index 83% rename from rainbowadn/core/nullability/nullablereference.py rename to rainbowadn/nullability/nullablereference.py index 3662a8b..1c451e5 100644 --- a/rainbowadn/core/nullability/nullablereference.py +++ b/rainbowadn/nullability/nullablereference.py @@ -1,14 +1,9 @@ from typing import Generic, Iterable, TypeVar -from rainbowadn.core.hash_point_format import hash_point_format -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.nullability.notnull import NotNull -from rainbowadn.core.nullability.null import Null -from rainbowadn.core.nullability.nullable import Nullable -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.recursivementionable import RecursiveMentionable -from rainbowadn.core.resolverorigin import ResolverOrigin +from rainbowadn.core import * +from .notnull import NotNull +from .null import Null +from .nullable import Nullable __all__ = ('NullableReference', 'NullableReferenceFactory',) diff --git a/rainbowadn/testing/dictresolver.py b/rainbowadn/testing/dictresolver.py index cbe3010..b70df71 100644 --- a/rainbowadn/testing/dictresolver.py +++ b/rainbowadn/testing/dictresolver.py @@ -1,11 +1,11 @@ from collections import OrderedDict -from typing import MutableMapping +from typing import MutableMapping, TypeVar -from rainbowadn.core.extendableresolver import ExtendableResolver, Mentioned -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.mentionable import Mentionable -from rainbowadn.core.recursivementionable import RecursiveMentionable +from rainbowadn.core import * + +__all__ = ('DictResolver',) + +Mentioned = TypeVar('Mentioned') class DictResolver(ExtendableResolver): diff --git a/rainbowadn/testing/failresolver.py b/rainbowadn/testing/failresolver.py index 9d9cf20..97b19dc 100644 --- a/rainbowadn/testing/failresolver.py +++ b/rainbowadn/testing/failresolver.py @@ -1,4 +1,4 @@ -from rainbowadn.core.hashresolver import HashResolver +from rainbowadn.core import * class FailResolver(HashResolver): diff --git a/rainbowadn/testing/instrumentation.py b/rainbowadn/testing/instrumentation.py index 2ba4b91..cd98499 100644 --- a/rainbowadn/testing/instrumentation.py +++ b/rainbowadn/testing/instrumentation.py @@ -2,11 +2,13 @@ import functools class Instrumentation: + deinstrumentation = {} + def __init__(self, target, methodname: str): self.target = target self.methodname = methodname - def instrument(self, *args, **kwargs): + def instrument(self, method, *args, **kwargs): raise NotImplementedError def __enter__(self): @@ -15,24 +17,31 @@ class Instrumentation: @functools.wraps(self.method) def wrap(*args, **kwargs): - self.instrument(*args, **kwargs) - return self.method(*args, **kwargs) + return self.instrument(self.method, *args, **kwargs) self.wrap = wrap setattr(self.target, self.methodname, self.wrap) - def __exit__(self, exc_type, exc_val, exc_tb): - assert getattr(self.target, self.methodname) is self.wrap + def schedule_deinstrumentation(self): + self.deinstrumentation[self.wrap] = self.method del self.wrap - setattr(self.target, self.methodname, self.method) del self.method + def deinstrument(self): + while (method := getattr(self.target, self.methodname)) in self.deinstrumentation: + setattr(self.target, self.methodname, self.deinstrumentation.pop(method)) + + def __exit__(self, exc_type, exc_val, exc_tb): + self.schedule_deinstrumentation() + self.deinstrument() + class Counter(Instrumentation): def __init__(self, target, methodname: str): super().__init__(target, methodname) self.counter = 0 - def instrument(self, *args, **kwargs): + def instrument(self, method, *args, **kwargs): self.counter += 1 + return method(*args, **kwargs) diff --git a/rainbowadn/testing/test_all.py b/rainbowadn/testing/test_all.py index e4de283..11f32e5 100644 --- a/rainbowadn/testing/test_all.py +++ b/rainbowadn/testing/test_all.py @@ -6,30 +6,18 @@ from typing import Any import nacl.signing -from rainbowadn.chain.blockchain import BlockChainFactory -from rainbowadn.chain.chaincollectioninterface import ChainCollectionInterface -from rainbowadn.chain.reduction.reductionchainmetafactory import ReductionChainMetaFactory -from rainbowadn.core.asserts import assert_eq, assert_false, assert_true -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.nullability.notnull import NotNull -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.data.atomic.integer import Integer -from rainbowadn.data.atomic.plain import Plain -from rainbowadn.data.collection.pair import Pair, PairFactory -from rainbowadn.data.collection.trees.binary.activebinarytree import ActiveBinaryTree -from rainbowadn.data.collection.trees.binary.avl import AVL -from rainbowadn.data.collection.trees.comparison.comparator import Replace -from rainbowadn.data.collection.trees.comparison.plaincomparator import PlainComparator -from rainbowadn.encryption.encrypted import Encrypted -from rainbowadn.testing.dictresolver import DictResolver -from rainbowadn.testing.instrumentation import Counter -from rainbowadn.v13.algo import MINT_CONST -from rainbowadn.v13.bankchain import BankChain -from rainbowadn.v13.subject import Subject -from rainbowadn.v13.transaction import CoinData, Transaction -from rainbowadn.wrisbt.wrisbtchainprotocol import WrisbtChainProtocol -from rainbowadn.wrisbt.wrisbtparametres import WrisbtParametres -from rainbowadn.wrisbt.wrisbtroot import WrisbtRoot +from rainbowadn.atomic import * +from rainbowadn.chain import * +from rainbowadn.collection.comparison import * +from rainbowadn.collection.pair import * +from rainbowadn.collection.trees.binary import * +from rainbowadn.core import * +from rainbowadn.encryption import * +from rainbowadn.nullability import * +from rainbowadn.v13 import * +from rainbowadn.wrisbt import * +from .dictresolver import DictResolver +from .instrumentation import Counter class TestAll(unittest.IsolatedAsyncioTestCase): diff --git a/rainbowadn/toplevel/__init__.py b/rainbowadn/toplevel/__init__.py index e69de29..77f7f05 100644 --- a/rainbowadn/toplevel/__init__.py +++ b/rainbowadn/toplevel/__init__.py @@ -0,0 +1,2 @@ +from .thresholdprotocol import ThresholdProtocol +from .validreference import * diff --git a/rainbowadn/toplevel/validreference.py b/rainbowadn/toplevel/validreference.py index db3f89a..ef482fe 100644 --- a/rainbowadn/toplevel/validreference.py +++ b/rainbowadn/toplevel/validreference.py @@ -1,11 +1,7 @@ from typing import Generic, Iterable, TypeVar -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.recursivementionable import RecursiveMentionable -from rainbowadn.core.resolverorigin import ResolverOrigin -from rainbowadn.toplevel.thresholdprotocol import ThresholdProtocol +from rainbowadn.core import * +from .thresholdprotocol import ThresholdProtocol __all__ = ('ValidReference', 'ValidReferenceFactory') diff --git a/rainbowadn/v13/__init__.py b/rainbowadn/v13/__init__.py index e69de29..4c29f25 100644 --- a/rainbowadn/v13/__init__.py +++ b/rainbowadn/v13/__init__.py @@ -0,0 +1,5 @@ +from .algo import MINT_CONST +from .bankchain import BankChain +from .signature import Signature +from .subject import Subject +from .transaction import * diff --git a/rainbowadn/v13/bankchain.py b/rainbowadn/v13/bankchain.py index 128859a..0b2f89d 100644 --- a/rainbowadn/v13/bankchain.py +++ b/rainbowadn/v13/bankchain.py @@ -1,13 +1,13 @@ from typing import Generic, TypeVar -from rainbowadn.chain.abstractreductionchainmetafactory import AbstractReductionChainMetaFactory -from rainbowadn.chain.chaincollectioninterface import ChainCollectionInterface -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.nullability.nullablereference import NullableReference, NullableReferenceFactory -from rainbowadn.data.collection.stack.stack import Stack, StackFactory -from rainbowadn.v13.bankprotocol import BankProtocol -from rainbowadn.v13.bankstate import BankState -from rainbowadn.v13.transaction import Transaction +from rainbowadn.chain import * +from rainbowadn.chain.reduction import * +from rainbowadn.collection.linear import * +from rainbowadn.core import * +from rainbowadn.nullability import * +from .bankprotocol import BankProtocol +from .bankstate import BankState +from .transaction import * __all__ = ('BankChain',) @@ -62,10 +62,10 @@ class BankChain(Generic[BlockType]): ) ) - async def add(self, stack: NullableReference[Stack[Transaction]]) -> 'BankChain[BlockType]': - assert isinstance(stack, NullableReference) + async def add(self, transactions: NullableReference[Stack[Transaction]]) -> 'BankChain[BlockType]': + assert isinstance(transactions, NullableReference) return BankChain( - await self.chain.add(HashPoint.of(stack)) + await self.chain.add(HashPoint.of(transactions)) ) async def adds(self, transactions: list[Transaction]) -> 'BankChain[BlockType]': diff --git a/rainbowadn/v13/bankprotocol.py b/rainbowadn/v13/bankprotocol.py index c34d341..f1f8903 100644 --- a/rainbowadn/v13/bankprotocol.py +++ b/rainbowadn/v13/bankprotocol.py @@ -1,19 +1,13 @@ -from rainbowadn.chain.reduction.reduced import Reduced -from rainbowadn.chain.reduction.reduction import Reduction -from rainbowadn.chain.reduction.reductionprotocol import ReductionProtocol -from rainbowadn.chain.reduction.reductionresult import ReductionResult -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.nullability.null import Null -from rainbowadn.core.nullability.nullablereference import NullableReference -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.static import StaticFactory -from rainbowadn.data.atomic.integer import Integer -from rainbowadn.data.collection.keymetadata import KeyMetadataFactory -from rainbowadn.data.collection.stack.stack import Stack -from rainbowadn.data.collection.trees.binary.binarytree import BinaryTreeFactory -from rainbowadn.v13.bankstate import BankState -from rainbowadn.v13.subject import Subject -from rainbowadn.v13.transaction import Coin, Transaction +from rainbowadn.atomic import * +from rainbowadn.chain.reduction import * +from rainbowadn.collection.keymetadata import * +from rainbowadn.collection.linear import * +from rainbowadn.collection.trees.binary import * +from rainbowadn.core import * +from rainbowadn.nullability import * +from .bankstate import BankState +from .subject import Subject +from .transaction import * __all__ = ('BankProtocol',) @@ -21,20 +15,20 @@ __all__ = ('BankProtocol',) class BankProtocol(ReductionProtocol[NullableReference[Stack[Transaction]], BankState]): async def reduce( self, - reduction: Reduction[NullableReference[Stack[Transaction]], BankState] + reduce: Reducible[NullableReference[Stack[Transaction]], BankState] ) -> ReductionResult[NullableReference[Stack[Transaction]], BankState]: - assert isinstance(reduction, Reduction) - bank_state: BankState = await reduction.accumulator.resolve() + assert isinstance(reduce, Reducible) + bank_state: BankState = await reduce.accumulator.resolve() assert isinstance(bank_state, BankState) - reference: NullableReference[Stack[Transaction]] = await reduction.reductor.resolve() + reference: NullableReference[Stack[Transaction]] = await reduce.reductor.resolve() if reference.null(): return Reduced(HashPoint.of(bank_state.without_miner())) else: - stack: Stack[Transaction] = await reference.resolve() - assert isinstance(stack, Stack) - return Reduction( - HashPoint.of(stack.previous), - HashPoint.of(await bank_state.push(stack.element)) + transactions: Stack[Transaction] = await reference.resolve() + assert isinstance(transactions, Stack) + return Reducible( + HashPoint.of(transactions.previous), + HashPoint.of(await bank_state.push(transactions.element)) ) def initial(self, factory: RainbowFactory[BankState]) -> HashPoint[BankState]: diff --git a/rainbowadn/v13/bankstate.py b/rainbowadn/v13/bankstate.py index 50185a3..386cf3e 100644 --- a/rainbowadn/v13/bankstate.py +++ b/rainbowadn/v13/bankstate.py @@ -1,26 +1,14 @@ from typing import AsyncIterable, Iterable -from rainbowadn.core.asserts import assert_false, assert_true -from rainbowadn.core.hash_point_format import hash_point_format, tabulate -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.nullability.null import Null -from rainbowadn.core.nullability.nullable import Nullable -from rainbowadn.core.nullability.nullablereference import NullableReference, NullableReferenceFactory -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.recursivementionable import RecursiveMentionable -from rainbowadn.core.resolverorigin import ResolverOrigin -from rainbowadn.core.static import StaticFactory, StaticMentionable -from rainbowadn.data.atomic.integer import Integer -from rainbowadn.data.collection.keymetadata import KeyMetadata, KeyMetadataFactory -from rainbowadn.data.collection.trees.binary.activebinarytree import ActiveBinaryTree -from rainbowadn.data.collection.trees.binary.avl import AVL -from rainbowadn.data.collection.trees.binary.binarytree import BinaryTree, BinaryTreeFactory -from rainbowadn.data.collection.trees.comparison.comparator import Fail -from rainbowadn.data.collection.trees.comparison.hashcomparator import HashComparator -from rainbowadn.v13.algo import MINT_CONST -from rainbowadn.v13.subject import Subject -from rainbowadn.v13.transaction import Coin, Transaction +from rainbowadn.atomic import * +from rainbowadn.collection.comparison import * +from rainbowadn.collection.keymetadata import * +from rainbowadn.collection.trees.binary import * +from rainbowadn.core import * +from rainbowadn.nullability import * +from .algo import MINT_CONST +from .subject import Subject +from .transaction import * __all__ = ('BankState',) diff --git a/rainbowadn/v13/signature.py b/rainbowadn/v13/signature.py index 04f8fdb..53d14ba 100644 --- a/rainbowadn/v13/signature.py +++ b/rainbowadn/v13/signature.py @@ -2,10 +2,9 @@ import nacl.bindings import nacl.exceptions import nacl.signing -from rainbowadn.core.asserts import assert_eq -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.data.atomic.atomic import Atomic -from rainbowadn.v13.subject import Subject +from rainbowadn.atomic import * +from rainbowadn.core import * +from .subject import Subject __all__ = ('BadSignature', 'Signature',) diff --git a/rainbowadn/v13/subject.py b/rainbowadn/v13/subject.py index 6968fbb..8e66535 100644 --- a/rainbowadn/v13/subject.py +++ b/rainbowadn/v13/subject.py @@ -1,7 +1,7 @@ from nacl.public import PublicKey from nacl.signing import VerifyKey -from rainbowadn.data.atomic.atomic import Atomic +from rainbowadn.atomic import * __all__ = ('Subject',) diff --git a/rainbowadn/v13/transaction.py b/rainbowadn/v13/transaction.py index 19f60ff..8225871 100644 --- a/rainbowadn/v13/transaction.py +++ b/rainbowadn/v13/transaction.py @@ -2,21 +2,12 @@ from typing import AsyncIterable, Iterable import nacl.signing -from rainbowadn.core.asserts import assert_true -from rainbowadn.core.hash_point_format import hash_point_format, tabulate -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.nullability.notnull import NotNull -from rainbowadn.core.nullability.nullable import Nullable -from rainbowadn.core.nullability.nullablereference import NullableReference, NullableReferenceFactory -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.recursivementionable import RecursiveMentionable -from rainbowadn.core.resolverorigin import ResolverOrigin -from rainbowadn.core.static import StaticMentionable -from rainbowadn.data.atomic.integer import Integer -from rainbowadn.data.collection.stack.stack import Stack, StackFactory -from rainbowadn.v13.signature import Signature -from rainbowadn.v13.subject import Subject +from rainbowadn.atomic import * +from rainbowadn.collection.linear import * +from rainbowadn.core import * +from rainbowadn.nullability import * +from .signature import Signature +from .subject import Subject __all__ = ('CoinData', 'Coin', 'TransactionData', 'Transaction',) @@ -66,24 +57,24 @@ class Coin(RecursiveMentionable, StaticMentionable): def __init__( self, data: HashPoint[CoinData], - origin: HashPoint['Transaction'], + transaction: HashPoint['Transaction'], index: HashPoint[Integer] ): assert isinstance(data, HashPoint) - assert isinstance(origin, HashPoint) + assert isinstance(transaction, HashPoint) assert isinstance(index, HashPoint) self.data = data - self.origin = origin + self.transaction = transaction self.index = index async def data_resolved(self) -> CoinData: return await self.data.resolve() def points(self) -> Iterable[HashPoint]: - return [self.data, self.origin, self.index] + return [self.data, self.transaction, self.index] def __bytes__(self): - return bytes(self.data) + bytes(self.origin) + bytes(self.index) + return bytes(self.data) + bytes(self.transaction) + bytes(self.index) @classmethod def from_bytes(cls, source: bytes, resolver: HashResolver) -> 'Coin': diff --git a/rainbowadn/wrisbt/__init__.py b/rainbowadn/wrisbt/__init__.py index e69de29..e1614b0 100644 --- a/rainbowadn/wrisbt/__init__.py +++ b/rainbowadn/wrisbt/__init__.py @@ -0,0 +1,3 @@ +from .wrisbtchainprotocol import WrisbtChainProtocol +from .wrisbtparametres import WrisbtParametres +from .wrisbtroot import * diff --git a/rainbowadn/wrisbt/weakreferenceindexsetbtree.py b/rainbowadn/wrisbt/weakreferenceindexsetbtree.py index e8fd73c..c6050ca 100644 --- a/rainbowadn/wrisbt/weakreferenceindexsetbtree.py +++ b/rainbowadn/wrisbt/weakreferenceindexsetbtree.py @@ -1,17 +1,8 @@ import bisect from typing import AsyncIterable, Iterable, Sequence -from rainbowadn.core.asserts import assert_eq -from rainbowadn.core.hash_point_format import hash_point_format, tabulate -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.localmetaorigin import LocalMetaOrigin -from rainbowadn.core.localorigin import LocalOrigin -from rainbowadn.core.metaorigin import MetaOrigin -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.recursivementionable import RecursiveMentionable -from rainbowadn.core.resolvermetaorigin import ResolverMetaOrigin -from rainbowadn.wrisbt.wrisbtparametres import WrisbtParametres +from rainbowadn.core import * +from .wrisbtparametres import WrisbtParametres __all__ = ('WeakReferenceIndexSetBTree', 'WrisbtFactory',) diff --git a/rainbowadn/wrisbt/wrisbtchainprotocol.py b/rainbowadn/wrisbt/wrisbtchainprotocol.py index b630b3c..481d99f 100644 --- a/rainbowadn/wrisbt/wrisbtchainprotocol.py +++ b/rainbowadn/wrisbt/wrisbtchainprotocol.py @@ -1,12 +1,11 @@ from typing import Generic, TypeVar -from rainbowadn.chain.blockchainprotocol import BlockChainProtocol -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.wrisbt.wrisbtindex import WrisbtIndex, WrisbtIndexFactory -from rainbowadn.wrisbt.wrisbtparametres import WrisbtParametres -from rainbowadn.wrisbt.wrisbtprotocol import WrisbtProtocol -from rainbowadn.wrisbt.wrisbtroot import WrisbtRoot, WrisbtRootFactory +from rainbowadn.chain import * +from rainbowadn.core import * +from .wrisbtindex import * +from .wrisbtparametres import WrisbtParametres +from .wrisbtprotocol import WrisbtProtocol +from .wrisbtroot import * __all__ = ('WrisbtChainProtocol',) diff --git a/rainbowadn/wrisbt/wrisbtindex.py b/rainbowadn/wrisbt/wrisbtindex.py index c8ad102..dd7e041 100644 --- a/rainbowadn/wrisbt/wrisbtindex.py +++ b/rainbowadn/wrisbt/wrisbtindex.py @@ -1,13 +1,8 @@ from typing import Iterable -from rainbowadn.core.hash_point_format import hash_point_format, tabulate -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.recursivementionable import RecursiveMentionable -from rainbowadn.core.resolverorigin import ResolverOrigin -from rainbowadn.wrisbt.wrisbtparametres import WrisbtParametres -from rainbowadn.wrisbt.wrisbtroot import WrisbtRoot, WrisbtRootFactory +from rainbowadn.core import * +from .wrisbtparametres import WrisbtParametres +from .wrisbtroot import * __all__ = ('WrisbtIndex', 'WrisbtIndexFactory',) diff --git a/rainbowadn/wrisbt/wrisbtprotocol.py b/rainbowadn/wrisbt/wrisbtprotocol.py index 5fb2b45..d1cd5e5 100644 --- a/rainbowadn/wrisbt/wrisbtprotocol.py +++ b/rainbowadn/wrisbt/wrisbtprotocol.py @@ -1,10 +1,10 @@ from typing import TypeVar -from rainbowadn.chain.states.metareductionstateprotocol import MetaReductionStateProtocol -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.wrisbt.wrisbtindex import WrisbtIndex -from rainbowadn.wrisbt.wrisbtparametres import WrisbtParametres -from rainbowadn.wrisbt.wrisbtroot import WrisbtRoot +from rainbowadn.chain.states import * +from rainbowadn.core import * +from .wrisbtindex import WrisbtIndex +from .wrisbtparametres import WrisbtParametres +from .wrisbtroot import WrisbtRoot __all__ = ('WrisbtProtocol',) diff --git a/rainbowadn/wrisbt/wrisbtroot.py b/rainbowadn/wrisbt/wrisbtroot.py index 6242e87..7f6de43 100644 --- a/rainbowadn/wrisbt/wrisbtroot.py +++ b/rainbowadn/wrisbt/wrisbtroot.py @@ -1,18 +1,9 @@ from typing import Iterable -from rainbowadn.core.asserts import assert_eq -from rainbowadn.core.hash_point_format import hash_point_format, tabulate -from rainbowadn.core.hashpoint import HashPoint -from rainbowadn.core.hashresolver import HashResolver -from rainbowadn.core.localmetaorigin import LocalMetaOrigin -from rainbowadn.core.localorigin import LocalOrigin -from rainbowadn.core.mentionable import Mentionable -from rainbowadn.core.rainbow_factory import RainbowFactory -from rainbowadn.core.recursivementionable import RecursiveMentionable -from rainbowadn.core.resolverorigin import ResolverOrigin -from rainbowadn.data.atomic.integer import Integer -from rainbowadn.wrisbt.weakreferenceindexsetbtree import WeakReferenceIndexSetBTree, WrisbtFactory -from rainbowadn.wrisbt.wrisbtparametres import WrisbtParametres +from rainbowadn.atomic import * +from rainbowadn.core import * +from .weakreferenceindexsetbtree import * +from .wrisbtparametres import WrisbtParametres __all__ = ('WrisbtRoot', 'WrisbtRootFactory',)