Exemple #1
0
 def __init__(self, value, arg1='', arg2=''):
     if value[0] == '(':
         args = utils.parens(value)
         self.value = args[0]
         self.arg1 = Number(args[1])
         self.arg2 = Number(args[2])
     else:
         self.value = value
         if arg1 != '':
             self.arg1 = isinstance(arg1, Number) and arg1 or Number(arg1)
         if arg2 != '':
             self.arg2 = isinstance(arg2, Number) and arg2 or Number(arg2)
Exemple #2
0
 def __init__(self, value, arg1='', arg2=''):
     self.arg1 = str(arg1)
     self.arg2 = str(arg2)
     try:
         self.value = str(float(value))
     except ValueError:
         if value[0] == '(':
             args = utils.parens(value)
             self.value = args[0]
             self.arg1 = Number(args[1])
             self.arg2 = Number(args[2])
         else:
             self.value = value
             if self.arg1 != '':
                 self.arg1 = isinstance(arg1, Number) and arg1 or Number(arg1)
             if self.arg2 != '':
                 self.arg2 = isinstance(arg2, Number) and arg2 or Number(arg2)
Exemple #3
0
 def __init__(self, value, arg1='', arg2=''):
     if isinstance(value, Number):
         self.value, self.arg1, self.arg2 = value.value, value.arg1, value.arg2
     else:
         self.arg1 = str(arg1)
         self.arg2 = str(arg2)
         try:
             self.value = str(float(value))
         except (ValueError, TypeError):
             if value[0] == '(':
                 args = utils.parens(value)
                 self.value = args[0]
                 self.arg1 = Number(args[1])
                 self.arg2 = Number(args[2])
             else:
                 self.value = value
                 if self.arg1 != '':
                     self.arg1 = Number(arg1)
                 if self.arg2 != '':
                     self.arg2 = Number(arg2)