(d, act_or_obs='act', normalized=False)
| 71 | |
| 72 | |
| 73 | def 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 | |
| 89 | class _PymgridDict(Dict): |
no test coverage detected