def __call__(self, *args, **kwargs): ret = self.func(*args, **kwargs) if hasattr(ret, "cotf"): return ret elif type(ret) is str: return string(ret) elif type(ret) in (int, float, long): return number(ret) return null
def loads(self, string): type = string[0] string = string[1:] # List if type == "(": return self.handle_list(string) #return [self.loads(item) for item in string[:-1].split("\x1b")] elif type == "{": return self.handle_dict(string) elif type == '"': return interpreter.string( string ) elif type == "$": try: return interpreter.number( string ) except ValueError: return interpreter.number( int(string) ) return None
def loads(self, string): type = string[0] string = string[1:] # List if type == "(": return self.handle_list(string) #return [self.loads(item) for item in string[:-1].split("\x1b")] elif type == "{": return self.handle_dict(string) elif type == '"': return interpreter.string(string) elif type == "$": try: return interpreter.number(string) except ValueError: return interpreter.number(int(string)) return None