removed rtype and param typing from doc strings to help avoid maintaining duplicate information provided by type hints

This commit is contained in:
Blake Harnden 2020-01-16 11:00:57 -08:00
parent 9d89877b20
commit f4ddf310a8
32 changed files with 1091 additions and 1357 deletions

View file

@ -24,9 +24,9 @@ class ConfigGroup:
"""
Creates a ConfigGroup object.
:param str name: configuration group display name
:param int start: configurations start index for this group
:param int stop: configurations stop index for this group
:param name: configuration group display name
:param start: configurations start index for this group
:param stop: configurations stop index for this group
"""
self.name = name
self.start = start
@ -49,11 +49,11 @@ class Configuration:
"""
Creates a Configuration object.
:param str _id: unique name for configuration
:param core.enumerations.ConfigDataTypes _type: configuration data type
:param str label: configuration label for display
:param str default: default value for configuration
:param list options: list options if this is a configuration with a combobox
:param _id: unique name for configuration
:param _type: configuration data type
:param label: configuration label for display
:param default: default value for configuration
:param options: list options if this is a configuration with a combobox
"""
self.id = _id
self.type = _type
@ -84,7 +84,6 @@ class ConfigurableOptions:
Provides the configurations for this class.
:return: configurations
:rtype: list[Configuration]
"""
return cls.options
@ -94,7 +93,6 @@ class ConfigurableOptions:
Defines how configurations are grouped.
:return: configuration group definition
:rtype: list[ConfigGroup]
"""
return [ConfigGroup("Options", 1, len(cls.configurations()))]
@ -104,7 +102,6 @@ class ConfigurableOptions:
Provides an ordered mapping of configuration keys to default values.
:return: ordered configuration mapping default values
:rtype: OrderedDict
"""
return OrderedDict(
[(config.id, config.default) for config in cls.configurations()]
@ -121,9 +118,8 @@ class ConfigShim:
"""
Converts a TLV key/value string into an ordered mapping.
:param str key_values:
:param key_values:
:return: ordered mapping of key/value pairs
:rtype: OrderedDict
"""
key_values = key_values.split("|")
values = OrderedDict()
@ -137,9 +133,8 @@ class ConfigShim:
"""
Converts configuration groups to a TLV formatted string.
:param list[ConfigGroup] config_groups: configuration groups to format
:param config_groups: configuration groups to format
:return: TLV configuration group string
:rtype: str
"""
group_strings = []
for config_group in config_groups:
@ -163,13 +158,12 @@ class ConfigShim:
by the class, but node number, conf type flags, and values must
be passed in.
:param int flags: message flags
:param int node_id: node id
:param int type_flags: type flags
:param ConfigurableOptions configurable_options: options to create config data for
:param dict config: configuration values for options
:param flags: message flags
:param node_id: node id
:param type_flags: type flags
:param configurable_options: options to create config data for
:param config: configuration values for options
:return: configuration data object
:rtype: ConfigData
"""
key_values = None
captions = None
@ -232,7 +226,6 @@ class ConfigurableManager:
Retrieves the ids of all node configurations known by this manager.
:return: list of node ids
:rtype: list
"""
return [x for x in self.node_configurations if x != self._default_node]
@ -240,7 +233,7 @@ class ConfigurableManager:
"""
Clears all configurations or configuration for a specific node.
:param int node_id: node id to clear configurations for, default is None and clears all configurations
:param node_id: node id to clear configurations for, default is None and clears all configurations
:return: nothing
"""
if not node_id:
@ -258,10 +251,10 @@ class ConfigurableManager:
"""
Set a specific configuration value for a node and configuration type.
:param str _id: configuration key
:param str value: configuration value
:param int node_id: node id to store configuration for
:param str config_type: configuration type to store configuration for
:param _id: configuration key
:param value: configuration value
:param node_id: node id to store configuration for
:param config_type: configuration type to store configuration for
:return: nothing
"""
node_configs = self.node_configurations.setdefault(node_id, OrderedDict())
@ -277,9 +270,9 @@ class ConfigurableManager:
"""
Set configurations for a node and configuration type.
:param dict config: configurations to set
:param int node_id: node id to store configuration for
:param str config_type: configuration type to store configuration for
:param config: configurations to set
:param node_id: node id to store configuration for
:param config_type: configuration type to store configuration for
:return: nothing
"""
logging.debug(
@ -298,12 +291,11 @@ class ConfigurableManager:
"""
Retrieves a specific configuration for a node and configuration type.
:param str _id: specific configuration to retrieve
:param int node_id: node id to store configuration for
:param str config_type: configuration type to store configuration for
:param _id: specific configuration to retrieve
:param node_id: node id to store configuration for
:param config_type: configuration type to store configuration for
:param default: default value to return when value is not found
:return: configuration value
:rtype str
"""
result = default
node_type_configs = self.get_configs(node_id, config_type)
@ -317,10 +309,9 @@ class ConfigurableManager:
"""
Retrieve configurations for a node and configuration type.
:param int node_id: node id to store configuration for
:param str config_type: configuration type to store configuration for
:param node_id: node id to store configuration for
:param config_type: configuration type to store configuration for
:return: configurations
:rtype: dict
"""
result = None
node_configs = self.node_configurations.get(node_id)
@ -332,9 +323,8 @@ class ConfigurableManager:
"""
Retrieve all current configuration types for a node.
:param int node_id: node id to retrieve configurations for
:param node_id: node id to retrieve configurations for
:return: all configuration types for a node
:rtype: dict
"""
return self.node_configurations.get(node_id)
@ -358,9 +348,9 @@ class ModelManager(ConfigurableManager):
"""
Set configuration data for a model.
:param int node_id: node id to set model configuration for
:param str model_name: model to set configuration for
:param dict config: configuration data to set for model
:param node_id: node id to set model configuration for
:param model_name: model to set configuration for
:param config: configuration data to set for model
:return: nothing
"""
# get model class to configure
@ -386,10 +376,9 @@ class ModelManager(ConfigurableManager):
"""
Retrieve configuration data for a model.
:param int node_id: node id to set model configuration for
:param str model_name: model to set configuration for
:param node_id: node id to set model configuration for
:param model_name: model to set configuration for
:return: current model configuration for node
:rtype: dict
"""
# get model class to configure
model_class = self.models.get(model_name)
@ -415,7 +404,7 @@ class ModelManager(ConfigurableManager):
:param node: node to set model for
:param model_class: model class to set for node
:param dict config: model configuration, None for default configuration
:param config: model configuration, None for default configuration
:return: nothing
"""
logging.debug(
@ -434,7 +423,6 @@ class ModelManager(ConfigurableManager):
:param node: network node to get models for
:return: list of model and values tuples for the network node
:rtype: list
"""
all_configs = self.get_all_configs(node.id)
if not all_configs: