home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / Calibre / calibre-0.8.18.msi / file_262 / UserList.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2011-09-09  |  5.6 KB  |  176 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.7)
  3.  
  4. import collections
  5.  
  6. class UserList(collections.MutableSequence):
  7.     
  8.     def __init__(self, initlist = None):
  9.         self.data = []
  10.         if initlist is not None:
  11.             if type(initlist) == type(self.data):
  12.                 self.data[:] = initlist
  13.             elif isinstance(initlist, UserList):
  14.                 self.data[:] = initlist.data[:]
  15.             else:
  16.                 self.data = list(initlist)
  17.  
  18.     
  19.     def __repr__(self):
  20.         return repr(self.data)
  21.  
  22.     
  23.     def __lt__(self, other):
  24.         return self.data < self._UserList__cast(other)
  25.  
  26.     
  27.     def __le__(self, other):
  28.         return self.data <= self._UserList__cast(other)
  29.  
  30.     
  31.     def __eq__(self, other):
  32.         return self.data == self._UserList__cast(other)
  33.  
  34.     
  35.     def __ne__(self, other):
  36.         return self.data != self._UserList__cast(other)
  37.  
  38.     
  39.     def __gt__(self, other):
  40.         return self.data > self._UserList__cast(other)
  41.  
  42.     
  43.     def __ge__(self, other):
  44.         return self.data >= self._UserList__cast(other)
  45.  
  46.     
  47.     def __cast(self, other):
  48.         if isinstance(other, UserList):
  49.             return other.data
  50.         return None
  51.  
  52.     
  53.     def __cmp__(self, other):
  54.         return cmp(self.data, self._UserList__cast(other))
  55.  
  56.     __hash__ = None
  57.     
  58.     def __contains__(self, item):
  59.         return item in self.data
  60.  
  61.     
  62.     def __len__(self):
  63.         return len(self.data)
  64.  
  65.     
  66.     def __getitem__(self, i):
  67.         return self.data[i]
  68.  
  69.     
  70.     def __setitem__(self, i, item):
  71.         self.data[i] = item
  72.  
  73.     
  74.     def __delitem__(self, i):
  75.         del self.data[i]
  76.  
  77.     
  78.     def __getslice__(self, i, j):
  79.         i = max(i, 0)
  80.         j = max(j, 0)
  81.         return self.__class__(self.data[i:j])
  82.  
  83.     
  84.     def __setslice__(self, i, j, other):
  85.         i = max(i, 0)
  86.         j = max(j, 0)
  87.         if isinstance(other, UserList):
  88.             self.data[i:j] = other.data
  89.         elif isinstance(other, type(self.data)):
  90.             self.data[i:j] = other
  91.         else:
  92.             self.data[i:j] = list(other)
  93.  
  94.     
  95.     def __delslice__(self, i, j):
  96.         i = max(i, 0)
  97.         j = max(j, 0)
  98.         del self.data[i:j]
  99.  
  100.     
  101.     def __add__(self, other):
  102.         if isinstance(other, UserList):
  103.             return self.__class__(self.data + other.data)
  104.         if None(other, type(self.data)):
  105.             return self.__class__(self.data + other)
  106.         return None.__class__(self.data + list(other))
  107.  
  108.     
  109.     def __radd__(self, other):
  110.         if isinstance(other, UserList):
  111.             return self.__class__(other.data + self.data)
  112.         if None(other, type(self.data)):
  113.             return self.__class__(other + self.data)
  114.         return None.__class__(list(other) + self.data)
  115.  
  116.     
  117.     def __iadd__(self, other):
  118.         if isinstance(other, UserList):
  119.             self.data += other.data
  120.         elif isinstance(other, type(self.data)):
  121.             self.data += other
  122.         else:
  123.             self.data += list(other)
  124.         return self
  125.  
  126.     
  127.     def __mul__(self, n):
  128.         return self.__class__(self.data * n)
  129.  
  130.     __rmul__ = __mul__
  131.     
  132.     def __imul__(self, n):
  133.         self.data *= n
  134.         return self
  135.  
  136.     
  137.     def append(self, item):
  138.         self.data.append(item)
  139.  
  140.     
  141.     def insert(self, i, item):
  142.         self.data.insert(i, item)
  143.  
  144.     
  145.     def pop(self, i = -1):
  146.         return self.data.pop(i)
  147.  
  148.     
  149.     def remove(self, item):
  150.         self.data.remove(item)
  151.  
  152.     
  153.     def count(self, item):
  154.         return self.data.count(item)
  155.  
  156.     
  157.     def index(self, item, *args):
  158.         return self.data.index(item, *args)
  159.  
  160.     
  161.     def reverse(self):
  162.         self.data.reverse()
  163.  
  164.     
  165.     def sort(self, *args, **kwds):
  166.         self.data.sort(*args, **kwds)
  167.  
  168.     
  169.     def extend(self, other):
  170.         if isinstance(other, UserList):
  171.             self.data.extend(other.data)
  172.         else:
  173.             self.data.extend(other)
  174.  
  175.  
  176.