diff --git a/monkey/common/__init__.py b/monkey/common/__init__.py index 5dee4b146..ff871b4c4 100644 --- a/monkey/common/__init__.py +++ b/monkey/common/__init__.py @@ -1,7 +1,9 @@ """ Used for a common things between agent and island """ +from . import transforms from .di_container import DIContainer, UnresolvableDependencyError from .operating_system import OperatingSystem from . import types from . import base_models +from .agent_registration_message import AgentRegistrationMessage diff --git a/monkey/monkey_island/cc/models/transforms.py b/monkey/common/transforms.py similarity index 100% rename from monkey/monkey_island/cc/models/transforms.py rename to monkey/common/transforms.py diff --git a/monkey/monkey_island/cc/models/machine.py b/monkey/monkey_island/cc/models/machine.py index 1ead17cc6..a7c513484 100644 --- a/monkey/monkey_island/cc/models/machine.py +++ b/monkey/monkey_island/cc/models/machine.py @@ -5,10 +5,9 @@ from pydantic import Field, PositiveInt, validator from common import OperatingSystem from common.base_models import MutableBaseModel +from common.transforms import make_immutable_sequence from common.types import HardwareID -from .transforms import make_immutable_sequence - MachineID = PositiveInt diff --git a/monkey/monkey_island/cc/models/node.py b/monkey/monkey_island/cc/models/node.py index 136633aa6..74eb48964 100644 --- a/monkey/monkey_island/cc/models/node.py +++ b/monkey/monkey_island/cc/models/node.py @@ -3,9 +3,9 @@ from typing import Sequence, Tuple from pydantic import Field, validator from common.base_models import MutableBaseModel +from common.transforms import make_immutable_nested_sequence from . import CommunicationType, MachineID -from .transforms import make_immutable_nested_sequence ConnectionsSequence = Sequence[Tuple[MachineID, Sequence[CommunicationType]]] diff --git a/monkey/tests/unit_tests/monkey_island/cc/models/test_transforms.py b/monkey/tests/unit_tests/common/test_transforms.py similarity index 92% rename from monkey/tests/unit_tests/monkey_island/cc/models/test_transforms.py rename to monkey/tests/unit_tests/common/test_transforms.py index b0f71cee4..3163f5afb 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/models/test_transforms.py +++ b/monkey/tests/unit_tests/common/test_transforms.py @@ -3,10 +3,7 @@ from typing import MutableSequence, Sequence import pytest -from monkey_island.cc.models.transforms import ( - make_immutable_nested_sequence, - make_immutable_sequence, -) +from common.transforms import make_immutable_nested_sequence, make_immutable_sequence def test_make_immutable_sequence__list():