home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 June / maximum-cd-2009-06.iso / DiscContents / digsby_setup.exe / lib / lxml / html / _setmixin.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-02-26  |  4.2 KB  |  154 lines

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