update import paths and add __init__.py to make it testable

This commit is contained in:
Youngjoon Lee 2024-07-19 13:37:06 +09:00
parent 3bf199bd9f
commit bf41a367d0
No known key found for this signature in database
GPG Key ID: B4253AFBA618BF4D
19 changed files with 37 additions and 33 deletions

View File

View File

@ -2,7 +2,7 @@ from typing import TypeAlias
import blspy
from mixnet.utils import random_bytes
from deprecated.mixnet_v1.utils import random_bytes
BlsPrivateKey: TypeAlias = blspy.PrivateKey
BlsPublicKey: TypeAlias = blspy.G1Element

View File

@ -4,10 +4,10 @@ import asyncio
from contextlib import suppress
from typing import Self
from mixnet.config import MixClientConfig, MixnetTopology
from mixnet.node import PacketQueue
from mixnet.packet import PacketBuilder
from mixnet.poisson import poisson_interval_sec
from deprecated.mixnet_v1.config import MixClientConfig, MixnetTopology
from deprecated.mixnet_v1.node import PacketQueue
from deprecated.mixnet_v1.packet import PacketBuilder
from deprecated.mixnet_v1.poisson import poisson_interval_sec
class MixClient:

View File

@ -10,8 +10,8 @@ from cryptography.hazmat.primitives.asymmetric.x25519 import (
)
from pysphinx.node import Node
from mixnet.bls import BlsPrivateKey, BlsPublicKey
from mixnet.fisheryates import FisherYates
from deprecated.mixnet_v1.bls import BlsPrivateKey, BlsPublicKey
from deprecated.mixnet_v1.fisheryates import FisherYates
@dataclass

View File

@ -4,9 +4,13 @@ import asyncio
from contextlib import suppress
from typing import Self, TypeAlias
from mixnet.client import MixClient
from mixnet.config import MixnetConfig, MixnetTopology, MixnetTopologyConfig
from mixnet.node import MixNode
from deprecated.mixnet_v1.client import MixClient
from deprecated.mixnet_v1.config import (
MixnetConfig,
MixnetTopology,
MixnetTopologyConfig,
)
from deprecated.mixnet_v1.node import MixNode
EntropyQueue: TypeAlias = "asyncio.Queue[bytes]"

View File

@ -15,8 +15,8 @@ from pysphinx.sphinx import (
UnknownHeaderTypeError,
)
from mixnet.config import MixNodeConfig, NodeAddress
from mixnet.poisson import poisson_interval_sec
from deprecated.mixnet_v1.config import MixNodeConfig, NodeAddress
from deprecated.mixnet_v1.poisson import poisson_interval_sec
PacketQueue: TypeAlias = "asyncio.Queue[Tuple[NodeAddress, SphinxPacket]]"
PacketPayloadQueue: TypeAlias = (

View File

@ -9,7 +9,7 @@ from typing import Dict, List, Self, Tuple, TypeAlias
from pysphinx.payload import Payload
from pysphinx.sphinx import SphinxPacket
from mixnet.config import MixnetTopology, MixNodeInfo
from deprecated.mixnet_v1.config import MixnetTopology, MixNodeInfo
class MessageFlag(Enum):

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -3,13 +3,13 @@ from unittest import IsolatedAsyncioTestCase
import numpy
from mixnet.client import MixClient
from mixnet.poisson import poisson_mean_interval_sec
from mixnet.test_utils import (
from deprecated.mixnet_v1.client import MixClient
from deprecated.mixnet_v1.poisson import poisson_mean_interval_sec
from deprecated.mixnet_v1.test_utils import (
init_mixnet_config,
with_test_timeout,
)
from mixnet.utils import random_bytes
from deprecated.mixnet_v1.utils import random_bytes
class TestMixClient(IsolatedAsyncioTestCase):

View File

@ -1,6 +1,6 @@
from unittest import TestCase
from mixnet.fisheryates import FisherYates
from deprecated.mixnet_v1.fisheryates import FisherYates
class TestFisherYates(TestCase):

View File

@ -1,8 +1,8 @@
import asyncio
from unittest import IsolatedAsyncioTestCase
from mixnet.mixnet import Mixnet
from mixnet.test_utils import init_mixnet_config
from deprecated.mixnet_v1.mixnet import Mixnet
from deprecated.mixnet_v1.test_utils import init_mixnet_config
class TestMixnet(IsolatedAsyncioTestCase):

View File

@ -5,10 +5,10 @@ from unittest import IsolatedAsyncioTestCase
import numpy
from pysphinx.sphinx import SphinxPacket
from mixnet.node import MixNode, NodeAddress, PacketQueue
from mixnet.packet import PacketBuilder
from mixnet.poisson import poisson_interval_sec, poisson_mean_interval_sec
from mixnet.test_utils import (
from deprecated.mixnet_v1.node import MixNode, NodeAddress, PacketQueue
from deprecated.mixnet_v1.packet import PacketBuilder
from deprecated.mixnet_v1.poisson import poisson_interval_sec, poisson_mean_interval_sec
from deprecated.mixnet_v1.test_utils import (
init_mixnet_config,
with_test_timeout,
)

View File

@ -3,15 +3,15 @@ from unittest import TestCase
from pysphinx.sphinx import ProcessedFinalHopPacket, SphinxPacket
from mixnet.config import MixNodeInfo
from mixnet.packet import (
from deprecated.mixnet_v1.config import MixNodeInfo
from deprecated.mixnet_v1.packet import (
Fragment,
MessageFlag,
MessageReconstructor,
PacketBuilder,
)
from mixnet.test_utils import init_mixnet_config
from mixnet.utils import random_bytes
from deprecated.mixnet_v1.test_utils import init_mixnet_config
from deprecated.mixnet_v1.utils import random_bytes
class TestPacket(TestCase):

View File

@ -2,17 +2,17 @@ import asyncio
from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey
from mixnet.bls import generate_bls
from mixnet.config import (
from deprecated.mixnet_v1.bls import generate_bls
from deprecated.mixnet_v1.config import (
MixClientConfig,
MixNodeConfig,
MixnetConfig,
MixNodeInfo,
MixnetTopology,
MixnetTopologyConfig,
MixnetTopologySize,
MixNodeConfig,
MixNodeInfo,
)
from mixnet.utils import random_bytes
from deprecated.mixnet_v1.utils import random_bytes
def with_test_timeout(t):