Ejemplo n.º 1
0
 def __getitem__(self, index):
     """Support slices."""
     try:
         return deque.__getitem__(self, index)
     except TypeError:
         return type(self)(islice(self, index.start, index.stop,
                                  index.step))
Ejemplo n.º 2
0
 def lItem( self ):
     if self.mtx.acquire():
         if self.ilast == 0:
             item = None
         else:
             item = deque.__getitem__( self, self.ilast-1 )
         self.mtx.release()
     return item
Ejemplo n.º 3
0
 def get( self ):
     if self.mtx.acquire():
         if deque.__len__( self ) <= self.cItem:
             item = None
         else:
             item = deque.__getitem__( self, self.cItem )
         self.mtx.release()
     return item
Ejemplo n.º 4
0
 def __getitem__(self, index):
     if isinstance(index, slice):
         cut = islice(self, index.start, index.stop, index.step)
         return variant_interval(interval=cut,
                                 window_size=self.window_size,
                                 shift_method=self.shift_method,
                                 lower_bound=self.lower_bound,
                                 step_size=self.step_size)
     return deque.__getitem__(self, index)
Ejemplo n.º 5
0
 def __getitem__(self, index):
     if isinstance(index, slice):
         cut = islice(self, index.start, index.stop, index.step)
         return variant_interval(interval=cut,
                                 window_size=self.window_size,
                                 shift_method=self.shift_method,
                                 lower_bound=self.lower_bound,
                                 step_size=self.step_size)
     return deque.__getitem__(self, index)
Ejemplo n.º 6
0
 def __getitem__(self, idx):
     """
     Makes an iterator for this Pile and returns selected Cards from
     the Pile based on the value of idx.
     """
     # If idx is a slice, return a sub-Pile of this Pile.
     if isinstance(idx, slice):
         return Pile(itertools.islice(self, idx.start, idx.stop, idx.step))
     # Otherwise, return the Card at the specified idx.
     return deque.__getitem__(self, idx)
Ejemplo n.º 7
0
 def __getitem__(self, key):
     if type(key) == slice:
         name = self.name + "["
         if key.start is not None:
             name += str(key.start)
         if key.stop is not None:
             name += ":" + str(key.stop)
         if key.step is not None:
             name += ":" + str(key.step)
         name += "]"
         return Trajectory(name=name,
                     frame=list(itertools.islice(self, key.start, key.stop, key.step)),
                     as_copy=False)
     else:
         return deque.__getitem__(self, key)
Ejemplo n.º 8
0
 def __getitem__(self, index):
     """Support slices."""
     try:
         return deque.__getitem__(self, index)
     except TypeError:
         return type(self)(islice(self, index.start, index.stop, index.step))
 def __getitem__(self, index):
     try:
         return deque.__getitem__(self, index)
     except TypeError:
         return type(self)(itertools.islice(self, index.start, index.stop,
                                            index.step))
Ejemplo n.º 10
0
 def __getitem__(self, key):
     if isinstance(key, slice):
         return [x for x in self][key]
     else:
         return _deque.__getitem__(self, key)
Ejemplo n.º 11
0
 def __getitem__(self, index):
     if isinstance(index, slice):
         return type(self)(itertools.islice(self, index.start,
                                            index.stop, index.step))
     return deque.__getitem__(self, index)
Ejemplo n.º 12
0
 def __getitem__(self, index):
     if isinstance(index, slice):
         return type(self)(itertools.islice(self, index.start,
                                            index.stop, index.step))
     return deque.__getitem__(self, index)
Ejemplo n.º 13
0
 def __getitem__(self, ind):
     if type(ind) != slice:  #print('[{ind}]'.format(**locals()))
         self.indexSet.add(ind)
         return deque.__getitem__(self, ind)
     return list(self)[ind]
Ejemplo n.º 14
0
 def __getitem__(self, key):
     if isinstance(key, slice):
         return [x for x in self][key]
     else:
         return _deque.__getitem__(self, key)
Ejemplo n.º 15
0
 def __getitem__( self, key ):
     if self.mtx.acquire():
         values = deque.__getitem__( self, key )
         self.mtx.release()
     return values