home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2012 January / maximum-cd-2012-01.iso / DiscContents / digsby_setup.exe / lib / UserList.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2011-10-05  |  5.7 KB  |  177 lines

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