# Path: kitty/core/kassert.py
# def is_of_types(obj, the_types):
# def is_int(obj):
# def is_in(obj, it):
# def not_none(obj):


import sys
import six
from struct import pack
from binascii import hexlify
from base64 import b64encode
from bitstring import Bits, BitArray
from kitty.core import kassert, KittyException
#
# You should have received a copy of the GNU General Public License
# along with Kitty.  If not, see <http://www.gnu.org/licenses/>.

'''
Encoders are used for encoding fields and containers.
The encoders are passed as an argument to the fields/container, during the field rendering,
the encoder's `encode` method is called.

There are four families of encoders:

:Bits Encoders: Used to encode fields/containers that their value is of type *Bits* (Container, ForEach etc.)

:String Encoders: Used to encode fields that their value is of type *str* (String, Delimiter, RandomBytes etc.)

:BitField Encoders:
    Used to encode fields that inherit from BitField or contain BitField (UInt8, Size, Checksum etc.)
    Those encoders are also refferred to as Int Encoders.

:FloatingPoint Encoders:
    Used to encode fields that inherit from FloatingPoint field (Float, Double)
    Those encoders are also refferred to as Float Encoders
'''


def strToBytes(value):
    '''
    :type value: ``str``
    :param value: value to encode
    '''

# Path: kitty/core/kassert.py
# def is_of_types(obj, the_types):
# def is_int(obj):
# def is_in(obj, it):
# def not_none(obj):


# Path: kitty/model/low_level/encoder.py
import sys
import six
from struct import pack
from binascii import hexlify
from base64 import b64encode
from bitstring import Bits, BitArray
from kitty.core import kassert, KittyException

#
# You should have received a copy of the GNU General Public License
# along with Kitty.  If not, see <http://www.gnu.org/licenses/>.

'''
Encoders are used for encoding fields and containers.
The encoders are passed as an argument to the fields/container, during the field rendering,
the encoder's `encode` method is called.

There are four families of encoders:

:Bits Encoders: Used to encode fields/containers that their value is of type *Bits* (Container, ForEach etc.)

:String Encoders: Used to encode fields that their value is of type *str* (String, Delimiter, RandomBytes etc.)

:BitField Encoders:
    Used to encode fields that inherit from BitField or contain BitField (UInt8, Size, Checksum etc.)
    Those encoders are also refferred to as Int Encoders.

:FloatingPoint Encoders:
    Used to encode fields that inherit from FloatingPoint field (Float, Double)
    Those encoders are also refferred to as Float Encoders
'''


def strToBytes(value):
    '''
    :type value: ``str``
    :param value: value to encode
    '''

    kassert.is_of_types(value, (bytes, bytearray, six.string_types))