Ejemplo n.º 1
0
 def _to_number_with_arithmetics(self, item):
     if is_number(item):
         return item
     number = eval(str(item), {})
     if not is_number(number):
         raise TypeError("Expected number, got %s." % type_name(item))
     return number
Ejemplo n.º 2
0
 def _convert_to_datetime(self, date, input_format):
     if isinstance(date, datetime):
         return date
     if is_number(date):
         return self._seconds_to_datetime(date)
     if is_string(date):
         return self._string_to_datetime(date, input_format)
     raise ValueError("Unsupported input '%s'." % date)
Ejemplo n.º 3
0
 def _convert_date_to_seconds(self, date, input_format):
     if is_string(date):
         return self._string_to_epoch(date, input_format)
     elif isinstance(date, datetime):
         return self._mktime_with_millis(date)
     elif is_number(date):
         return float(date)
     raise ValueError("Unsupported input '%s'." % date)
Ejemplo n.º 4
0
 def _convert_date_to_seconds(self, date, input_format):
     if is_string(date):
         return self._string_to_epoch(date, input_format)
     elif isinstance(date, datetime):
         return self._mktime_with_millis(date)
     elif is_number(date):
         return float(date)
     raise ValueError("Unsupported input '%s'." % date)
Ejemplo n.º 5
0
 def _variable_supports_extended_assign(self, var):
     return not (is_string(var) or is_number(var))
Ejemplo n.º 6
0
 def _validate_dictionary(self, dictionary, position=1):
     if is_string(dictionary) or is_number(dictionary):
         raise TypeError("Expected argument %d to be a dictionary or dictionary-like, "
                         "got %s instead." % (position, type_name(dictionary)))
Ejemplo n.º 7
0
 def _validate_dictionary(self, dictionary, position=1):
     if is_string(dictionary) or is_number(dictionary):
         raise TypeError(
             "Expected argument %d to be a dictionary or dictionary-like, "
             "got %s instead." % (position, type_name(dictionary)))
Ejemplo n.º 8
0
 def _is_number(self, arg):
     return is_number(arg)
Ejemplo n.º 9
0
Archivo: Remote.py Proyecto: Garjy/RIDE
 def _is_number(self, arg):
     return is_number(arg)
Ejemplo n.º 10
0
 def _variable_supports_extended_assign(self, var):
     return not (is_string(var) or is_number(var))