ConfigList
(class from pyomo.common.config
)
- class pyomo.common.config.ConfigList(default=None, domain=None, description=None, doc=None, visibility=0)[source]
Bases:
ConfigBase
,Sequence
Store and manipulate a list of configuration values.
- Parameters:
default (optional) – The default value that this ConfigList will take if no value is provided. If default is a list or ConfigList, then each member is cast to the ConfigList’s domain to build the default value, otherwise the default is cast to the domain and forms a default list with a single element.
domain (Callable, optional) – The domain can be any callable that accepts a candidate value and returns the value converted to the desired type, optionally performing any data validation. The result will be stored / added to the ConfigList. Examples include type constructors like int or float. More complex domain examples include callable objects; for example, the
In
class that ensures that the value falls into an acceptable set or even a completeConfigDict
instance.description (str, optional) – The short description of this list
doc (str, optional) – The long documentation string for this list
visibility (int, optional) – The visibility of this ConfigList when generating templates and documentation. Visibility supports specification of “advanced” or “developer” options. ConfigLists with visibility=0 (the default) will always be printed / included. ConfigLists with higher visibility values will only be included when the generation method specifies a visibility greater than or equal to the visibility of this object.
Methods
__init__
([default, domain, description, ...])add
([value])DEPRECATED.
append
([value])count
(value)declare_as_argument
(*args, **kwds)Map this Config item to an argparse argument.
display
([content_filter, indent_spacing, ...])domain_name
()generate_documentation
([block_start, ...])generate_yaml_template
([indent_spacing, ...])get
(key[, default])import_argparse
(parsed_args)index
(value, [start, [stop]])Raises ValueError if the value is not present.
initialize_argparse
(parser)name
([fully_qualified])reset
()set_default_value
(default)set_domain
(domain)set_value
(value)unused_user_values
()user_values
()value
([accessValue])Member Documentation
- add(value=NOTSET)[source]
DEPRECATED.
Append the specified value to the list, casting as necessary.
Deprecated since version 5.7.2: ConfigList.add() has been deprecated. Use append()
- count(value) integer -- return number of occurrences of value
- declare_as_argument(*args, **kwds)
Map this Config item to an argparse argument.
Valid arguments include all valid arguments to argparse’s ArgumentParser.add_argument() with the exception of ‘default’. In addition, you may provide a group keyword argument to either pass in a pre-defined option group or subparser, or else pass in the string name of a group, subparser, or (subparser, group).
- index(value[, start[, stop]]) integer -- return first index of value.
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.