def __init__(self, values=()):
     for code in ARRAY_CODES:
         try:
             self.__underlying = array_or_list(code, values)
             break
         except OverflowError:
             pass
     else:  # pragma: no cover
         assert False, "Could not create storage for %r" % (values,)
     if isinstance(self.__underlying, list):
         for v in self.__underlying:
             if v < 0 or not isinstance(v, integer_types):
                 raise ValueError("Could not create IntList for %r" % (values,))
Esempio n. 2
0
 def __init__(self, values=()):
     for code in ARRAY_CODES:
         try:
             self.__underlying = array_or_list(code, values)
             break
         except OverflowError:
             pass
     else:  # pragma: no cover
         assert False, "Could not create storage for %r" % (values, )
     if isinstance(self.__underlying, list):
         for v in self.__underlying:
             if v < 0 or not isinstance(v, integer_types):
                 raise ValueError("Could not create IntList for %r" %
                                  (values, ))
Esempio n. 3
0
 def of_length(self, n):
     return IntList(array_or_list("B", [0]) * n)
Esempio n. 4
0
 def __upgrade(self):
     code = NEXT_ARRAY_CODE[self.__underlying.typecode]
     self.__underlying = array_or_list(code, self.__underlying)
 def of_length(self, n):
     return IntList(array_or_list("B", [0]) * n)
 def __upgrade(self):
     code = NEXT_ARRAY_CODE[self.__underlying.typecode]
     self.__underlying = array_or_list(code, self.__underlying)