added type hinting to core.emane functions

This commit is contained in:
Blake Harnden 2020-01-14 16:27:08 -08:00
parent 49f09a25cc
commit fa095431fb
9 changed files with 147 additions and 108 deletions

View file

@ -1,4 +1,5 @@
import logging
from typing import Dict, List
from core.config import Configuration
from core.emulator.enumerations import ConfigDataTypes
@ -13,12 +14,12 @@ except ImportError:
logging.debug("compatible emane python bindings not installed")
def _type_value(config_type):
def _type_value(config_type: str) -> ConfigDataTypes:
"""
Convert emane configuration type to core configuration value.
:param str config_type: emane configuration type
:return:
:return: core config type
"""
config_type = config_type.upper()
if config_type == "DOUBLE":
@ -28,7 +29,7 @@ def _type_value(config_type):
return ConfigDataTypes[config_type]
def _get_possible(config_type, config_regex):
def _get_possible(config_type: str, config_regex: str) -> List[str]:
"""
Retrieve possible config value options based on emane regexes.
@ -47,7 +48,7 @@ def _get_possible(config_type, config_regex):
return []
def _get_default(config_type_name, config_value):
def _get_default(config_type_name: str, config_value: List[str]) -> str:
"""
Convert default configuration values to one used by core.
@ -72,7 +73,7 @@ def _get_default(config_type_name, config_value):
return config_default
def parse(manifest_path, defaults):
def parse(manifest_path: str, defaults: Dict[str, str]) -> List[Configuration]:
"""
Parses a valid emane manifest file and converts the provided configuration values into ones used by core.