removed rtype and param typing from doc strings to help avoid maintaining duplicate information provided by type hints
This commit is contained in:
parent
9d89877b20
commit
f4ddf310a8
32 changed files with 1091 additions and 1357 deletions
|
@ -24,10 +24,9 @@ def is_external(config: Dict[str, str]) -> bool:
|
|||
"""
|
||||
Checks if the configuration is for an external transport.
|
||||
|
||||
:param dict config: configuration to check
|
||||
:param config: configuration to check
|
||||
:return: True if external, False otherwise
|
||||
:rtype: bool
|
||||
"""
|
||||
"""
|
||||
return config.get("external") == "1"
|
||||
|
||||
|
||||
|
@ -35,7 +34,7 @@ def _value_to_params(value: str) -> Optional[Tuple[str]]:
|
|||
"""
|
||||
Helper to convert a parameter to a parameter tuple.
|
||||
|
||||
:param str value: value string to convert to tuple
|
||||
:param value: value string to convert to tuple
|
||||
:return: parameter tuple, None otherwise
|
||||
"""
|
||||
try:
|
||||
|
@ -63,10 +62,10 @@ def create_file(
|
|||
"""
|
||||
Create xml file.
|
||||
|
||||
:param lxml.etree.Element xml_element: root element to write to file
|
||||
:param str doc_name: name to use in the emane doctype
|
||||
:param str file_path: file path to write xml file to
|
||||
:param core.emulator.distributed.DistributedServer server: remote server node
|
||||
:param xml_element: root element to write to file
|
||||
:param doc_name: name to use in the emane doctype
|
||||
:param file_path: file path to write xml file to
|
||||
:param server: remote server node
|
||||
will run on, default is None for localhost
|
||||
:return: nothing
|
||||
"""
|
||||
|
@ -87,9 +86,9 @@ def add_param(xml_element: etree.Element, name: str, value: str) -> None:
|
|||
"""
|
||||
Add emane configuration parameter to xml element.
|
||||
|
||||
:param lxml.etree.Element xml_element: element to append parameter to
|
||||
:param str name: name of parameter
|
||||
:param str value: value for parameter
|
||||
:param xml_element: element to append parameter to
|
||||
:param name: name of parameter
|
||||
:param value: value for parameter
|
||||
:return: nothing
|
||||
"""
|
||||
etree.SubElement(xml_element, "param", name=name, value=value)
|
||||
|
@ -104,10 +103,10 @@ def add_configurations(
|
|||
"""
|
||||
Add emane model configurations to xml element.
|
||||
|
||||
:param lxml.etree.Element xml_element: xml element to add emane configurations to
|
||||
:param list[core.config.Configuration] configurations: configurations to add to xml
|
||||
:param dict config: configuration values
|
||||
:param set config_ignore: configuration options to ignore
|
||||
:param xml_element: xml element to add emane configurations to
|
||||
:param configurations: configurations to add to xml
|
||||
:param config: configuration values
|
||||
:param config_ignore: configuration options to ignore
|
||||
:return:
|
||||
"""
|
||||
for configuration in configurations:
|
||||
|
@ -137,16 +136,15 @@ def build_node_platform_xml(
|
|||
"""
|
||||
Create platform xml for a specific node.
|
||||
|
||||
:param core.emane.emanemanager.EmaneManager emane_manager: emane manager with emane
|
||||
:param emane_manager: emane manager with emane
|
||||
configurations
|
||||
:param core.nodes.network.CtrlNet control_net: control net node for this emane
|
||||
:param control_net: control net node for this emane
|
||||
network
|
||||
:param core.emane.nodes.EmaneNet node: node to write platform xml for
|
||||
:param int nem_id: nem id to use for interfaces for this node
|
||||
:param dict platform_xmls: stores platform xml elements to append nem entries to
|
||||
:param node: node to write platform xml for
|
||||
:param nem_id: nem id to use for interfaces for this node
|
||||
:param platform_xmls: stores platform xml elements to append nem entries to
|
||||
:return: the next nem id that can be used for creating platform xml files
|
||||
:rtype: int
|
||||
"""
|
||||
"""
|
||||
logging.debug(
|
||||
"building emane platform xml for node(%s) nem_id(%s): %s",
|
||||
node,
|
||||
|
@ -258,9 +256,9 @@ def build_xml_files(emane_manager: "EmaneManager", node: EmaneNet) -> None:
|
|||
"""
|
||||
Generate emane xml files required for node.
|
||||
|
||||
:param core.emane.emanemanager.EmaneManager emane_manager: emane manager with emane
|
||||
:param emane_manager: emane manager with emane
|
||||
configurations
|
||||
:param core.emane.nodes.EmaneNet node: node to write platform xml for
|
||||
:param node: node to write platform xml for
|
||||
:return: nothing
|
||||
"""
|
||||
logging.debug("building all emane xml for node(%s): %s", node, node.name)
|
||||
|
@ -308,10 +306,10 @@ def build_transport_xml(
|
|||
"""
|
||||
Build transport xml file for node and transport type.
|
||||
|
||||
:param core.emane.emanemanager.EmaneManager emane_manager: emane manager with emane
|
||||
:param emane_manager: emane manager with emane
|
||||
configurations
|
||||
:param core.emane.nodes.EmaneNet node: node to write platform xml for
|
||||
:param str transport_type: transport type to build xml for
|
||||
:param node: node to write platform xml for
|
||||
:param transport_type: transport type to build xml for
|
||||
:return: nothing
|
||||
"""
|
||||
transport_element = etree.Element(
|
||||
|
@ -354,10 +352,10 @@ def create_phy_xml(
|
|||
"""
|
||||
Create the phy xml document.
|
||||
|
||||
:param core.emane.emanemodel.EmaneModel emane_model: emane model to create xml
|
||||
:param dict config: all current configuration values
|
||||
:param str file_path: path to write file to
|
||||
:param core.emulator.distributed.DistributedServer server: remote server node
|
||||
:param emane_model: emane model to create xml
|
||||
:param config: all current configuration values
|
||||
:param file_path: path to write file to
|
||||
:param server: remote server node
|
||||
will run on, default is None for localhost
|
||||
:return: nothing
|
||||
"""
|
||||
|
@ -387,10 +385,10 @@ def create_mac_xml(
|
|||
"""
|
||||
Create the mac xml document.
|
||||
|
||||
:param core.emane.emanemodel.EmaneModel emane_model: emane model to create xml
|
||||
:param dict config: all current configuration values
|
||||
:param str file_path: path to write file to
|
||||
:param core.emulator.distributed.DistributedServer server: remote server node
|
||||
:param emane_model: emane model to create xml
|
||||
:param config: all current configuration values
|
||||
:param file_path: path to write file to
|
||||
:param server: remote server node
|
||||
will run on, default is None for localhost
|
||||
:return: nothing
|
||||
"""
|
||||
|
@ -425,13 +423,13 @@ def create_nem_xml(
|
|||
"""
|
||||
Create the nem xml document.
|
||||
|
||||
:param core.emane.emanemodel.EmaneModel emane_model: emane model to create xml
|
||||
:param dict config: all current configuration values
|
||||
:param str nem_file: nem file path to write
|
||||
:param str transport_definition: transport file definition path
|
||||
:param str mac_definition: mac file definition path
|
||||
:param str phy_definition: phy file definition path
|
||||
:param core.emulator.distributed.DistributedServer server: remote server node
|
||||
:param emane_model: emane model to create xml
|
||||
:param config: all current configuration values
|
||||
:param nem_file: nem file path to write
|
||||
:param transport_definition: transport file definition path
|
||||
:param mac_definition: mac file definition path
|
||||
:param phy_definition: phy file definition path
|
||||
:param server: remote server node
|
||||
will run on, default is None for localhost
|
||||
:return: nothing
|
||||
"""
|
||||
|
@ -461,11 +459,11 @@ def create_event_service_xml(
|
|||
"""
|
||||
Create a emane event service xml file.
|
||||
|
||||
:param str group: event group
|
||||
:param str port: event port
|
||||
:param str device: event device
|
||||
:param str file_directory: directory to create file in
|
||||
:param core.emulator.distributed.DistributedServer server: remote server node
|
||||
:param group: event group
|
||||
:param port: event port
|
||||
:param device: event device
|
||||
:param file_directory: directory to create file in
|
||||
:param server: remote server node
|
||||
will run on, default is None for localhost
|
||||
:return: nothing
|
||||
"""
|
||||
|
@ -488,8 +486,8 @@ def transport_file_name(node_id: int, transport_type: str) -> str:
|
|||
"""
|
||||
Create name for a transport xml file.
|
||||
|
||||
:param int node_id: node id to generate transport file name for
|
||||
:param str transport_type: transport type to generate transport file
|
||||
:param node_id: node id to generate transport file name for
|
||||
:param transport_type: transport type to generate transport file
|
||||
:return:
|
||||
"""
|
||||
return f"n{node_id}trans{transport_type}.xml"
|
||||
|
@ -502,8 +500,7 @@ def _basename(emane_model: "EmaneModel", interface: CoreInterface = None) -> str
|
|||
:param emane_model: emane model to create name for
|
||||
:param interface: interface for this model
|
||||
:return: basename used for file creation
|
||||
:rtype: str
|
||||
"""
|
||||
"""
|
||||
name = f"n{emane_model.id}"
|
||||
|
||||
if interface:
|
||||
|
@ -518,11 +515,10 @@ def nem_file_name(emane_model: "EmaneModel", interface: CoreInterface = None) ->
|
|||
"""
|
||||
Return the string name for the NEM XML file, e.g. "n3rfpipenem.xml"
|
||||
|
||||
:param core.emane.emanemodel.EmaneModel emane_model: emane model to create file
|
||||
:param emane_model: emane model to create file
|
||||
:param interface: interface for this model
|
||||
:return: nem xml filename
|
||||
:rtype: str
|
||||
"""
|
||||
"""
|
||||
basename = _basename(emane_model, interface)
|
||||
append = ""
|
||||
if interface and interface.transport_type == "raw":
|
||||
|
@ -534,11 +530,10 @@ def shim_file_name(emane_model: "EmaneModel", interface: CoreInterface = None) -
|
|||
"""
|
||||
Return the string name for the SHIM XML file, e.g. "commeffectshim.xml"
|
||||
|
||||
:param core.emane.emanemodel.EmaneModel emane_model: emane model to create file
|
||||
:param emane_model: emane model to create file
|
||||
:param interface: interface for this model
|
||||
:return: shim xml filename
|
||||
:rtype: str
|
||||
"""
|
||||
"""
|
||||
name = _basename(emane_model, interface)
|
||||
return f"{name}shim.xml"
|
||||
|
||||
|
@ -547,11 +542,10 @@ def mac_file_name(emane_model: "EmaneModel", interface: CoreInterface = None) ->
|
|||
"""
|
||||
Return the string name for the MAC XML file, e.g. "n3rfpipemac.xml"
|
||||
|
||||
:param core.emane.emanemodel.EmaneModel emane_model: emane model to create file
|
||||
:param emane_model: emane model to create file
|
||||
:param interface: interface for this model
|
||||
:return: mac xml filename
|
||||
:rtype: str
|
||||
"""
|
||||
"""
|
||||
name = _basename(emane_model, interface)
|
||||
return f"{name}mac.xml"
|
||||
|
||||
|
@ -560,10 +554,9 @@ def phy_file_name(emane_model: "EmaneModel", interface: CoreInterface = None) ->
|
|||
"""
|
||||
Return the string name for the PHY XML file, e.g. "n3rfpipephy.xml"
|
||||
|
||||
:param core.emane.emanemodel.EmaneModel emane_model: emane model to create file
|
||||
:param emane_model: emane model to create file
|
||||
:param interface: interface for this model
|
||||
:return: phy xml filename
|
||||
:rtype: str
|
||||
"""
|
||||
"""
|
||||
name = _basename(emane_model, interface)
|
||||
return f"{name}phy.xml"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue