In
(class from pyomo.common.config
)
- class pyomo.common.config.In(domain, cast=None)[source]
Bases:
object
Domain validation class admitting a Container of possible values
This will admit any value that is in the domain Container (i.e., Container.__contains__() returns True). Most common domains are list, set, and dict objects. If specified, incoming values are first passed to cast() to convert them to the appropriate type before looking them up in domain.
- Parameters:
domain (Container) – The container that specifies the allowable values. Incoming values are passed to
domain.__contains__()
, and ifTrue
is returned, the value is accepted and returned.cast (Callable, optional) – A callable object. If specified, incoming values are first passed to cast, and the resulting object is checked for membership in domain
Note
For backwards compatibility, In accepts enum.Enum classes as domain Containers. If the domain is an Enum, then the constructor returns an instance of InEnum.
Methods
__init__
(domain[, cast])domain_name
()Member Documentation