daemon: updated core.emane to avoid using deprecated type hinting

This commit is contained in:
Blake Harnden 2023-04-13 12:18:24 -07:00
parent 3d722a7721
commit 4c222d1a7a
9 changed files with 73 additions and 78 deletions

View file

@ -2,7 +2,6 @@
EMANE Bypass model for CORE
"""
from pathlib import Path
from typing import List, Set
from core.config import ConfigBool, Configuration
from core.emane import emanemodel
@ -12,11 +11,11 @@ class EmaneBypassModel(emanemodel.EmaneModel):
name: str = "emane_bypass"
# values to ignore, when writing xml files
config_ignore: Set[str] = {"none"}
config_ignore: set[str] = {"none"}
# mac definitions
mac_library: str = "bypassmaclayer"
mac_config: List[Configuration] = [
mac_config: list[Configuration] = [
ConfigBool(
id="none",
default="0",
@ -26,7 +25,7 @@ class EmaneBypassModel(emanemodel.EmaneModel):
# phy definitions
phy_library: str = "bypassphylayer"
phy_config: List[Configuration] = []
phy_config: list[Configuration] = []
@classmethod
def load(cls, emane_prefix: Path) -> None:

View file

@ -4,7 +4,6 @@ commeffect.py: EMANE CommEffect model for CORE
import logging
from pathlib import Path
from typing import Dict, List
from lxml import etree
@ -42,12 +41,12 @@ class EmaneCommEffectModel(emanemodel.EmaneModel):
name: str = "emane_commeffect"
shim_library: str = "commeffectshim"
shim_xml: str = "commeffectshim.xml"
shim_defaults: Dict[str, str] = {}
config_shim: List[Configuration] = []
shim_defaults: dict[str, str] = {}
config_shim: list[Configuration] = []
# comm effect does not need the default phy and external configurations
phy_config: List[Configuration] = []
external_config: List[Configuration] = []
phy_config: list[Configuration] = []
external_config: list[Configuration] = []
@classmethod
def load(cls, emane_prefix: Path) -> None:
@ -56,11 +55,11 @@ class EmaneCommEffectModel(emanemodel.EmaneModel):
cls.config_shim = emanemanifest.parse(shim_xml_path, cls.shim_defaults)
@classmethod
def configurations(cls) -> List[Configuration]:
def configurations(cls) -> list[Configuration]:
return cls.platform_config + cls.config_shim
@classmethod
def config_groups(cls) -> List[ConfigGroup]:
def config_groups(cls) -> list[ConfigGroup]:
platform_len = len(cls.platform_config)
return [
ConfigGroup("Platform Parameters", 1, platform_len),
@ -71,7 +70,7 @@ class EmaneCommEffectModel(emanemodel.EmaneModel):
),
]
def build_xml_files(self, config: Dict[str, str], iface: CoreInterface) -> None:
def build_xml_files(self, config: dict[str, str], iface: CoreInterface) -> None:
"""
Build the necessary nem and commeffect XMLs in the given path.
If an individual NEM has a nonstandard config, we need to build

View file

@ -4,7 +4,6 @@ tdma.py: EMANE TDMA model bindings for CORE
import logging
from pathlib import Path
from typing import Set
from core import constants, utils
from core.config import ConfigString
@ -28,7 +27,7 @@ class EmaneTdmaModel(emanemodel.EmaneModel):
default_schedule: Path = (
constants.CORE_DATA_DIR / "examples" / "tdma" / "schedule.xml"
)
config_ignore: Set[str] = {schedule_name}
config_ignore: set[str] = {schedule_name}
@classmethod
def load(cls, emane_prefix: Path) -> None: