tfchain/encoders/rivine.py
def add(self, value):
        """
        Add a value, after encoding it as specified by the rivbin encoding specification,
        automatically matching the value's type with a matching rivbin type.

        Use a specific encoding function if you want to make sure you
        encode in a specific way.

        NOTE: an integer will always be encoded as an 64-bit integer,
              use a specific add_intx method if this is not desireable.

        @param value: the value to be rivbin-encoded
        """

        # if the value implements the RivineBinaryObjectEncoderBase class,
        # we ignore the underlying type and use the custom-defined logic
        # as provided by the RivineBinaryObjectEncoder.
        if isinstance(value, RivineBinaryObjectEncoderBase):
            value.rivine_binary_encode(encoder=self)
            return

        # try to rivbin-encode the value based on its python type
        if isinstance(value, bool):
            if value:
                self._data += bytearray([1])
            else:
                self._data += bytearray([0])
        elif isinstance(value, int) or hasattr(value, '__int__'):
            self.add_int64(value)
        else:
            # try to rivbin-encode the value as a slice
            te = None
            try:
                self.add_slice(value)
                return
            except TypeError as e:
                te = e
            raise ValueError(
                "cannot rivbin-encode value with unsupported type {}: {}".format(type(value), te))

        Add a value, after encoding it as specified by the rivbin encoding specification,
        automatically matching the value's type with a matching rivbin type.

        Use a specific encoding function if you want to make sure you
        encode in a specific way.

        NOTE: an integer will always be encoded as an 64-bit integer,
              use a specific add_intx method if this is not desireable.

        @param value: the value to be rivbin-encoded
        
Add a value, after encoding it as specified by the rivbin encoding specification,
automatically matching the value's type with a matching rivbin type.

Use a specific encoding function if you want to make sure you
encode in a specific way.

an integer will always be encoded as an 64-bit integer,
use a specific add_intx method if this is not desireable.
Add a value after encoding it as specified by the rivbin encoding specification automatically matching the value ' s type with a matching rivbin type . Use a specific encoding function if you want to make sure you encode in a specific way . an integer will always be encoded as an 64 - bit integer use a specific add_intx method if this is not desireable .
def add(self, value):
        if isinstance(value, RivineBinaryObjectEncoderBase):
            value.rivine_binary_encode(encoder=self)
            return
        if isinstance(value, bool):
            if value:
                self._data += bytearray([1])
            else:
                self._data += bytearray([0])
        elif isinstance(value, int) or hasattr(value, '__int__'):
            self.add_int64(value)
        else:
            te = None
            try:
                self.add_slice(value)
                return
            except TypeError as e:
                te = e
            raise ValueError(
                "cannot rivbin-encode value with unsupported type {}: {}".format(type(value), te))
def add ( self , value ) : if isinstance ( value , RivineBinaryObjectEncoderBase ) : value . rivine_binary_encode ( encoder = self ) return if isinstance ( value , bool ) : if value : self . _data += bytearray ( [ 1 ] ) else : self . _data += bytearray ( [ 0 ] ) elif isinstance ( value , int ) or hasattr ( value , '__int__' ) : self . add_int64 ( value ) else : te = None try : self . add_slice ( value ) return except TypeError as e : te = e raise ValueError ( "cannot rivbin-encode value with unsupported type {}: {}" . format ( type ( value ) , te ) )
Add a value, after encoding it as specified by the rivbin encoding specification,
automatically matching the value's type with a matching rivbin type.
Add a value after encoding it as specified by the rivbin encoding specification automatically matching the value ' s type with a matching rivbin type .
"""
        Add a value, after encoding it as specified by the rivbin encoding specification,
        automatically matching the value's type with a matching rivbin type.

        Use a specific encoding function if you want to make sure you
        encode in a specific way.

        NOTE: an integer will always be encoded as an 64-bit integer,
              use a specific add_intx method if this is not desireable.

        @param value: the value to be rivbin-encoded
        """ # if the value implements the RivineBinaryObjectEncoderBase class, # we ignore the underlying type and use the custom-defined logic # as provided by the RivineBinaryObjectEncoder. # try to rivbin-encode the value based on its python type # try to rivbin-encode the value as a slice
self
value
the value to be rivbin-encoded
the value to be rivbin - encoded