home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_2007 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  4.5 KB  |  151 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4.  
  5. class SetMixin(object):
  6.     
  7.     def __len__(self):
  8.         length = 0
  9.         for item in self:
  10.             length += 1
  11.         
  12.         return length
  13.  
  14.     
  15.     def __contains__(self, item):
  16.         for has_item in self:
  17.             if item == has_item:
  18.                 return True
  19.         
  20.         return False
  21.  
  22.     
  23.     def issubset(self, other):
  24.         for item in other:
  25.             if item not in self:
  26.                 return False
  27.         
  28.         return True
  29.  
  30.     __le__ = issubset
  31.     
  32.     def issuperset(self, other):
  33.         for item in self:
  34.             if item not in other:
  35.                 return False
  36.         
  37.         return True
  38.  
  39.     __ge__ = issuperset
  40.     
  41.     def union(self, other):
  42.         return self | other
  43.  
  44.     
  45.     def __or__(self, other):
  46.         new = self.copy()
  47.         new |= other
  48.         return new
  49.  
  50.     
  51.     def intersection(self, other):
  52.         return self & other
  53.  
  54.     
  55.     def __and__(self, other):
  56.         new = self.copy()
  57.         new &= other
  58.         return new
  59.  
  60.     
  61.     def difference(self, other):
  62.         return self - other
  63.  
  64.     
  65.     def __sub__(self, other):
  66.         new = self.copy()
  67.         new -= other
  68.         return new
  69.  
  70.     
  71.     def symmetric_difference(self, other):
  72.         return self ^ other
  73.  
  74.     
  75.     def __xor__(self, other):
  76.         new = self.copy()
  77.         new ^= other
  78.         return new
  79.  
  80.     
  81.     def copy(self):
  82.         return set(self)
  83.  
  84.     
  85.     def update(self, other):
  86.         for item in other:
  87.             self.add(item)
  88.         
  89.  
  90.     
  91.     def __ior__(self, other):
  92.         self.update(other)
  93.         return self
  94.  
  95.     
  96.     def intersection_update(self, other):
  97.         for item in self:
  98.             if item not in other:
  99.                 self.remove(item)
  100.                 continue
  101.         
  102.  
  103.     
  104.     def __iand__(self, other):
  105.         self.intersection_update(other)
  106.         return self
  107.  
  108.     
  109.     def difference_update(self, other):
  110.         for item in other:
  111.             if item in self:
  112.                 self.remove(item)
  113.                 continue
  114.         
  115.  
  116.     
  117.     def __isub__(self, other):
  118.         self.difference_update(other)
  119.         return self
  120.  
  121.     
  122.     def symmetric_difference_update(self, other):
  123.         for item in other:
  124.             if item in self:
  125.                 self.remove(item)
  126.                 continue
  127.             self.add(item)
  128.         
  129.  
  130.     
  131.     def __ixor__(self, other):
  132.         self.symmetric_difference_update(other)
  133.         return self
  134.  
  135.     
  136.     def discard(self, item):
  137.         
  138.         try:
  139.             self.remove(item)
  140.         except KeyError:
  141.             pass
  142.  
  143.  
  144.     
  145.     def clear(self):
  146.         for item in list(self):
  147.             self.remove(item)
  148.         
  149.  
  150.  
  151.