MCPcopy Create free account
hub / github.com/ahalev/python-microgrid / contains

Method contains

src/pymgrid/utils/space/space.py:139–158  ·  view source on GitHub ↗

Check if `x` is a valid member of the space. .. note:: This method checks if `x` is a valid member of the space. Use :meth:`.ModuleSpace.normalized.contains` to check if a value is a member of the normalized space. Parameters ----------

(self, x)

Source from the content-addressed store, hash-verified

137 _spread: Union[np.ndarray, dict]
138
139 def contains(self, x):
140 """
141 Check if `x` is a valid member of the space.
142
143 .. note::
144 This method checks if `x` is a valid member of the space. Use :meth:`.ModuleSpace.normalized.contains` to
145 check if a value is a member of the normalized space.
146
147 Parameters
148 ----------
149 x : scalar or array-like
150 Value to check membership.
151
152 Returns
153 -------
154 containment : bool
155 Whether `x` is a valid member of the space.
156
157 """
158 return x in self._unnormalized
159
160 def sample(self, normalized=False):
161 if normalized:

Callers 3

get_logMethod · 0.80
__init__Method · 0.80
stepMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected