#2266 - Fixed some minor bugs that prevented basic networks without a default gateway from being parsed. Completed the basic client-server P2P network documentation, file and retrieval method.

This commit is contained in:
Chris McCarthy
2024-04-19 15:58:50 +01:00
parent 455c8cdcd5
commit 9a55b7b864
6 changed files with 97 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
"""Manages the observation space for the agent."""
from abc import ABC, abstractmethod
from typing import Any, Dict, Iterable, Type
from typing import Any, Dict, Iterable, Type, Optional, Union
from gymnasium import spaces
from gymnasium.core import ObsType
@@ -9,7 +9,7 @@ from pydantic import BaseModel, ConfigDict
from primaite import getLogger
_LOGGER = getLogger(__name__)
WhereType = Iterable[str | int] | None
WhereType = Optional[Iterable[Union[str, int]]]
class AbstractObservation(ABC):

View File

@@ -26,7 +26,7 @@ the structure:
```
"""
from abc import abstractmethod
from typing import Callable, Dict, Iterable, List, Optional, Tuple, Type, TYPE_CHECKING
from typing import Callable, Dict, Iterable, List, Optional, Tuple, Type, TYPE_CHECKING, Union
from typing_extensions import Never
@@ -37,7 +37,7 @@ if TYPE_CHECKING:
from primaite.game.agent.interface import AgentActionHistoryItem
_LOGGER = getLogger(__name__)
WhereType = Iterable[str | int] | None
WhereType = Optional[Iterable[Union[str, int]]]
class AbstractReward:

View File

@@ -244,7 +244,7 @@ class PrimaiteGame:
hostname=node_cfg["hostname"],
ip_address=node_cfg["ip_address"],
subnet_mask=IPv4Address(node_cfg.get("subnet_mask", "255.255.255.0")),
default_gateway=node_cfg["default_gateway"],
default_gateway=node_cfg.get("default_gateway"),
dns_server=node_cfg.get("dns_server", None),
operating_state=NodeOperatingState.ON
if not (p := node_cfg.get("operating_state"))
@@ -255,7 +255,7 @@ class PrimaiteGame:
hostname=node_cfg["hostname"],
ip_address=node_cfg["ip_address"],
subnet_mask=IPv4Address(node_cfg.get("subnet_mask", "255.255.255.0")),
default_gateway=node_cfg["default_gateway"],
default_gateway=node_cfg.get("default_gateway"),
dns_server=node_cfg.get("dns_server", None),
operating_state=NodeOperatingState.ON
if not (p := node_cfg.get("operating_state"))