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

Function extract_builtins

src/pymgrid/utils/space/space.py:73–86  ·  view source on GitHub ↗
(d, act_or_obs='act', normalized=False)

Source from the content-addressed store, hash-verified

71
72
73def extract_builtins(d, act_or_obs='act', normalized=False):
74 try:
75 d = d.groupby(level=0, axis=0).agg(list).T
76 except AttributeError:
77 pass
78
79 if act_or_obs == 'act':
80 spaces = _extract_action_spaces(d)
81 elif act_or_obs == 'obs':
82 spaces = _extract_observation_spaces(d)
83 else:
84 raise NameError(act_or_obs)
85
86 return _transform_builtins(spaces, normalized=normalized)
87
88
89class _PymgridDict(Dict):

Callers 2

from_module_spacesMethod · 0.85

Calls 3

_extract_action_spacesFunction · 0.85
_transform_builtinsFunction · 0.85

Tested by

no test coverage detected