|
24 | 24 | from spock.backend.wrappers import Spockspace |
25 | 25 | from spock.exceptions import _SpockCryptoError, _SpockEvolveError, _SpockValueError |
26 | 26 | from spock.handlers import YAMLHandler |
| 27 | +from spock.helpers import to_dict |
27 | 28 | from spock.utils import ( |
28 | 29 | _C, |
29 | 30 | _T, |
@@ -635,32 +636,13 @@ def obj_2_dict(self, obj: Union[_C, List[_C], Tuple[_C, ...]]) -> Dict[str, Dict |
635 | 636 | """Converts spock classes from a Spockspace into their dictionary representations |
636 | 637 |
|
637 | 638 | Args: |
638 | | - objs: single spock class or an iterable of spock classes |
| 639 | + obj: single spock class or an iterable of spock classes |
639 | 640 |
|
640 | 641 | Returns: |
641 | 642 | dictionary where the class names are keys and the values are the dictionary representations |
642 | 643 | """ |
643 | | - |
644 | | - from spock.helpers import to_dict |
645 | | - |
646 | 644 | return to_dict(obj, self._saver_obj) |
647 | 645 |
|
648 | | - # if isinstance(obj, (List, Tuple)): |
649 | | - # obj_dict = {} |
650 | | - # for val in obj: |
651 | | - # if not _is_spock_instance(val): |
652 | | - # raise _SpockValueError( |
653 | | - # f"Object is not a @spock decorated class object -- currently `{type(val)}`" |
654 | | - # ) |
655 | | - # obj_dict.update({type(val).__name__: val}) |
656 | | - # elif _is_spock_instance(obj): |
657 | | - # obj_dict = {type(obj).__name__: obj} |
658 | | - # else: |
659 | | - # raise _SpockValueError( |
660 | | - # f"Object is not a @spock decorated class object -- currently `{type(obj)}`" |
661 | | - # ) |
662 | | - # return self.spockspace_2_dict(Spockspace(**obj_dict)) |
663 | | - |
664 | 646 | def evolve(self, *args: _C) -> Spockspace: |
665 | 647 | """Function that allows a user to evolve the underlying spock classes with |
666 | 648 | instantiated spock objects |
|
0 commit comments