sob/model.py
def _marshal(self) -> "abc.OrderedDict[str, abc.JSONTypes]":
        """
        This method marshals an instance of `Dictionary` as built-in type
        `OrderedDict` which can be serialized into
        JSON/YAML.
        """
        # Check for hooks
        instance_hooks: Optional[abc.DictionaryHooks] = hooks.dictionary_read(
            self
        )
        # This variable is needed because before-marshal hooks are permitted to
        # return altered *copies* of `self`, so prior to marshalling--this
        # variable may no longer point to `self`
        data: abc.Model = self
        # Execute before-marshal hooks, if applicable
        if instance_hooks and instance_hooks.before_marshal:
            data = instance_hooks.before_marshal(data)
        assert isinstance(data, abc.Dictionary)
        # Get the metadata, if any has been assigned
        instance_meta: Optional[abc.DictionaryMeta] = meta.dictionary_read(
            data
        )
        # Check to see if value types are defined in the metadata
        value_types: Optional[abc.Types] = (
            instance_meta.value_types if instance_meta else None
        )
        # Recursively convert the data to generic, serializable, data types
        marshalled_data: "abc.OrderedDict[str, abc.JSONTypes]" = (
            collections.OrderedDict(
                [
                    (key, marshal(value, types=value_types))
                    for key, value in data.items()
                ]
            )
        )
        # Execute after-marshal hooks, if applicable
        if (instance_hooks is not None) and (
            instance_hooks.after_marshal is not None
        ):
            after_marshal_data: abc.JSONTypes = instance_hooks.after_marshal(
                marshalled_data
            )
            after_marshal_dictionary: "abc.OrderedDict[str, abc.JSONTypes]"
            if isinstance(after_marshal_data, collections.OrderedDict):
                after_marshal_dictionary = after_marshal_data
            elif isinstance(after_marshal_data, Reversible) and isinstance(
                after_marshal_data, (Mapping, abc.Dictionary)
            ):
                after_marshal_dictionary = collections.OrderedDict(
                    after_marshal_data.items()
                )
            else:
                assert isinstance(after_marshal_data, Mapping)
                after_marshal_dictionary = collections.OrderedDict(
                    sorted(
                        after_marshal_data.items(), key=lambda item: item[0]
                    )
                )
            marshalled_data = after_marshal_dictionary
        return marshalled_data

        This method marshals an instance of `Dictionary` as built-in type
        `OrderedDict` which can be serialized into
        JSON/YAML.
        
This method marshals an instance of `Dictionary` as built-in type
`OrderedDict` which can be serialized into
JSON/YAML.
This method marshals an instance of ` Dictionary ` as built - in type ` OrderedDict ` which can be serialized into JSON / YAML .
def _marshal(self) -> "abc.OrderedDict[str, abc.JSONTypes]":
        instance_hooks: Optional[abc.DictionaryHooks] = hooks.dictionary_read(
            self
        )
        data: abc.Model = self
        if instance_hooks and instance_hooks.before_marshal:
            data = instance_hooks.before_marshal(data)
        assert isinstance(data, abc.Dictionary)
        instance_meta: Optional[abc.DictionaryMeta] = meta.dictionary_read(
            data
        )
        value_types: Optional[abc.Types] = (
            instance_meta.value_types if instance_meta else None
        )
        marshalled_data: "abc.OrderedDict[str, abc.JSONTypes]" = (
            collections.OrderedDict(
                [
                    (key, marshal(value, types=value_types))
                    for key, value in data.items()
                ]
            )
        )
        if (instance_hooks is not None) and (
            instance_hooks.after_marshal is not None
        ):
            after_marshal_data: abc.JSONTypes = instance_hooks.after_marshal(
                marshalled_data
            )
            after_marshal_dictionary: "abc.OrderedDict[str, abc.JSONTypes]"
            if isinstance(after_marshal_data, collections.OrderedDict):
                after_marshal_dictionary = after_marshal_data
            elif isinstance(after_marshal_data, Reversible) and isinstance(
                after_marshal_data, (Mapping, abc.Dictionary)
            ):
                after_marshal_dictionary = collections.OrderedDict(
                    after_marshal_data.items()
                )
            else:
                assert isinstance(after_marshal_data, Mapping)
                after_marshal_dictionary = collections.OrderedDict(
                    sorted(
                        after_marshal_data.items(), key=lambda item: item[0]
                    )
                )
            marshalled_data = after_marshal_dictionary
        return marshalled_data
def _marshal ( self ) -> "abc.OrderedDict[str, abc.JSONTypes]" : instance_hooks : Optional [ abc . DictionaryHooks ] = hooks . dictionary_read ( self ) data : abc . Model = self if instance_hooks and instance_hooks . before_marshal : data = instance_hooks . before_marshal ( data ) assert isinstance ( data , abc . Dictionary ) instance_meta : Optional [ abc . DictionaryMeta ] = meta . dictionary_read ( data ) value_types : Optional [ abc . Types ] = ( instance_meta . value_types if instance_meta else None ) marshalled_data : "abc.OrderedDict[str, abc.JSONTypes]" = ( collections . OrderedDict ( [ ( key , marshal ( value , types = value_types ) ) for key , value in data . items ( ) ] ) ) if ( instance_hooks is not None ) and ( instance_hooks . after_marshal is not None ) : after_marshal_data : abc . JSONTypes = instance_hooks . after_marshal ( marshalled_data ) after_marshal_dictionary : "abc.OrderedDict[str, abc.JSONTypes]" if isinstance ( after_marshal_data , collections . OrderedDict ) : after_marshal_dictionary = after_marshal_data elif isinstance ( after_marshal_data , Reversible ) and isinstance ( after_marshal_data , ( Mapping , abc . Dictionary ) ) : after_marshal_dictionary = collections . OrderedDict ( after_marshal_data . items ( ) ) else : assert isinstance ( after_marshal_data , Mapping ) after_marshal_dictionary = collections . OrderedDict ( sorted ( after_marshal_data . items ( ) , key = lambda item : item [ 0 ] ) ) marshalled_data = after_marshal_dictionary return marshalled_data
This method marshals an instance of `Dictionary` as built-in type
`OrderedDict` which can be serialized into
JSON/YAML.
This method marshals an instance of ` Dictionary ` as built - in type ` OrderedDict ` which can be serialized into JSON / YAML .
"""
        This method marshals an instance of `Dictionary` as built-in type
        `OrderedDict` which can be serialized into
        JSON/YAML.
        """ # Check for hooks # This variable is needed because before-marshal hooks are permitted to # return altered *copies* of `self`, so prior to marshalling--this # variable may no longer point to `self` # Execute before-marshal hooks, if applicable # Get the metadata, if any has been assigned # Check to see if value types are defined in the metadata # Recursively convert the data to generic, serializable, data types # Execute after-marshal hooks, if applicable
self