Exemple #1
0
 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
Exemple #2
0
 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
Exemple #3
0
    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
Exemple #4
0
    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