Esempio n. 1
0
 def __iter__(self):
     """
     Magic method for in.
     """
     for rod_ in self._rods:
         rod__ = methods.decompress_rod(rod_)
         yield rod__
Esempio n. 2
0
 def _get_rod(self):
     """
         Returns the first rod in the queue
     """
     rod_ = self._rods.get()
     self._rods.put(methods.decompress_rod(rod_))
     return rod_
Esempio n. 3
0
 def __getitem__(self, rod_id):
     """
     Magic method for [].
     """
     self.fill_dicts()
     try:
         return methods.decompress_rod(self._rods_dict[rod_id])
     except KeyError:
         msg = str(rod_id)
         msg += " " + str(self._rods_dict.keys())
         raise IndexError(msg)
Esempio n. 4
0
 def __list__(self):
     """
     Returns a list of rods
     """
     output = [methods.decompress_rod(rod_) for rod_ in self]
     return output