# Path: IndexedRedis/fields/null.py
# IR_NULL_STR = 'IRNullType()'
# IR_NULL_BYTES = b'IRNullType()'
# IR_NULL_UNICODE = u'IRNullType()'
# 	IR_NULL_STRINGS = (IR_NULL_STR, IR_NULL_BYTES)
# 	IR_NULL_STRINGS = (IR_NULL_STR, )
# class IRNullType(IrNullBaseType):
# 	def __new__(self, val=''):
# 	def __eq__(self, otherVal):
# 	def __ne__(self, otherVal):
# 	def __str__(self):
# 	def __bool__(self):
# 	def __nonzero__(self):
# 	def __repr__(self):
# 
# Path: IndexedRedis/compat_str.py
# def to_unicode(x, encoding=None):
# 	'''
# 		to_unicode - Ensure a given value is decoded into unicode type
# 
# 		@param x - Value
# 		@param encoding <None/str> (default None) - None to use defaultIREncoding, otherwise an explicit encoding
# 
# 		@return - "x" as a unicode type
# 	'''
# 	if encoding is None:
# 		global defaultIREncoding
# 		encoding = defaultIREncoding
# 
# 	if isinstance(x, unicode):
# 		return x
# 	elif isinstance(x, str):
# 		return x.decode(encoding)
# 	else:
# 		return str(x).decode(encoding)


import json
from . import irNull, IRNullType
from datetime import datetime
from ..compat_str import to_unicode
                return irNull

            try:
                jsonObj = json.loads(theArg)
            except Exception as e:
                raise ValueError('Cannot decode json [%s]: %s%s' %(str(e), str(type(theArg)), repr(theArg)))

            if isinstance(jsonObj, dict):
                myRet = _IRJsonDict()
                myRet.update(jsonObj)
                return myRet
            elif issubclass(jsonObj.__class__, (list, tuple, set)):
                myRet = _IRJsonArray(jsonObj)
                return myRet
            elif isinstance(jsonObj, (int, float)):
                myRet = _IRJsonNumber(jsonObj)
                return myRet
            elif isinstance(jsonObj, bool):
                if jsonObj is False:
                    val = 0
                else:
                    val = 1
                myRet = _IRJsonNumber(val)
                return myRet
            elif jsonObj is None:
                return _IRJsonNull()
            else:
                myRet = _IRJsonString(jsonObj)
                return myRet


# Path: IndexedRedis/fields/null.py
# IR_NULL_STR = 'IRNullType()'
# IR_NULL_BYTES = b'IRNullType()'
# IR_NULL_UNICODE = u'IRNullType()'
# 	IR_NULL_STRINGS = (IR_NULL_STR, IR_NULL_BYTES)
# 	IR_NULL_STRINGS = (IR_NULL_STR, )
# class IRNullType(IrNullBaseType):
# 	def __new__(self, val=''):
# 	def __eq__(self, otherVal):
# 	def __ne__(self, otherVal):
# 	def __str__(self):
# 	def __bool__(self):
# 	def __nonzero__(self):
# 	def __repr__(self):
# 
# Path: IndexedRedis/compat_str.py
# def to_unicode(x, encoding=None):
# 	'''
# 		to_unicode - Ensure a given value is decoded into unicode type
# 
# 		@param x - Value
# 		@param encoding <None/str> (default None) - None to use defaultIREncoding, otherwise an explicit encoding
# 
# 		@return - "x" as a unicode type
# 	'''
# 	if encoding is None:
# 		global defaultIREncoding
# 		encoding = defaultIREncoding
# 
# 	if isinstance(x, unicode):
# 		return x
# 	elif isinstance(x, str):
# 		return x.decode(encoding)
# 	else:
# 		return str(x).decode(encoding)


# Path: IndexedRedis/fields/FieldValueTypes.py
import json
from . import irNull, IRNullType
from datetime import datetime
from ..compat_str import to_unicode

                return irNull

            try:
                jsonObj = json.loads(theArg)
            except Exception as e:
                raise ValueError('Cannot decode json [%s]: %s%s' %(str(e), str(type(theArg)), repr(theArg)))

            if isinstance(jsonObj, dict):
                myRet = _IRJsonDict()
                myRet.update(jsonObj)
                return myRet
            elif issubclass(jsonObj.__class__, (list, tuple, set)):
                myRet = _IRJsonArray(jsonObj)
                return myRet
            elif isinstance(jsonObj, (int, float)):
                myRet = _IRJsonNumber(jsonObj)
                return myRet
            elif isinstance(jsonObj, bool):
                if jsonObj is False:
                    val = 0
                else:
                    val = 1
                myRet = _IRJsonNumber(val)
                return myRet
            elif jsonObj is None:
                return _IRJsonNull()
            else:
                myRet = _IRJsonString(jsonObj)
                return myRet


        return irNull