intficpy/serializer.py
def serialize_attribute(self, value):
        """
        Recursively serialize an attribute
        Raises Unserializable in the event of unserializable attribute
        """
        if isinstance(value, IFPObject):
            return f"<IFP>{value.ix}"

        if isinstance(value, str):
            return value

        try:
            out = {}
            for sub_attr, sub_value in value.items():
                out[sub_attr] = self.serialize_attribute(sub_value)
            return out

        except AttributeError:
            pass

        try:
            out = []
            for sub_value in value:
                out.append(self.serialize_attribute(sub_value))
            return out

        except TypeError:
            pass

        if (
            hasattr(value, "__dict__")
            or isinstance(value, types.FunctionType)
            or isinstance(value, types.MethodType)
        ):
            raise Unserializable("Cannot serialize attribute.")

        return value

        Recursively serialize an attribute
        Raises Unserializable in the event of unserializable attribute
        
Recursively serialize an attribute
Raises Unserializable in the event of unserializable attribute
Recursively serialize an attribute Raises Unserializable in the event of unserializable attribute
def serialize_attribute(self, value):
        if isinstance(value, IFPObject):
            return f"<IFP>{value.ix}"
        if isinstance(value, str):
            return value
        try:
            out = {}
            for sub_attr, sub_value in value.items():
                out[sub_attr] = self.serialize_attribute(sub_value)
            return out
        except AttributeError:
            pass
        try:
            out = []
            for sub_value in value:
                out.append(self.serialize_attribute(sub_value))
            return out
        except TypeError:
            pass
        if (
            hasattr(value, "__dict__")
            or isinstance(value, types.FunctionType)
            or isinstance(value, types.MethodType)
        ):
            raise Unserializable("Cannot serialize attribute.")
        return value
def serialize_attribute ( self , value ) : if isinstance ( value , IFPObject ) : return f"<IFP>{value.ix}" if isinstance ( value , str ) : return value try : out = { } for sub_attr , sub_value in value . items ( ) : out [ sub_attr ] = self . serialize_attribute ( sub_value ) return out except AttributeError : pass try : out = [ ] for sub_value in value : out . append ( self . serialize_attribute ( sub_value ) ) return out except TypeError : pass if ( hasattr ( value , "__dict__" ) or isinstance ( value , types . FunctionType ) or isinstance ( value , types . MethodType ) ) : raise Unserializable ( "Cannot serialize attribute." ) return value
Recursively serialize an attribute
Raises Unserializable in the event of unserializable attribute
Recursively serialize an attribute Raises Unserializable in the event of unserializable attribute
"""
        Recursively serialize an attribute
        Raises Unserializable in the event of unserializable attribute
        """
self
value