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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import dns.exception as dns
  5. import dns.rdata as dns
  6. import dns.name as dns
  7.  
  8. class NSBase(dns.rdata.Rdata):
  9.     __slots__ = [
  10.         'target']
  11.     
  12.     def __init__(self, rdclass, rdtype, target):
  13.         super(NSBase, self).__init__(rdclass, rdtype)
  14.         self.target = target
  15.  
  16.     
  17.     def to_text(self, origin = None, relativize = True, **kw):
  18.         target = self.target.choose_relativity(origin, relativize)
  19.         return str(target)
  20.  
  21.     
  22.     def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
  23.         target = tok.get_name()
  24.         target = target.choose_relativity(origin, relativize)
  25.         tok.get_eol()
  26.         return cls(rdclass, rdtype, target)
  27.  
  28.     from_text = classmethod(from_text)
  29.     
  30.     def to_wire(self, file, compress = None, origin = None):
  31.         self.target.to_wire(file, compress, origin)
  32.  
  33.     
  34.     def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
  35.         (target, cused) = dns.name.from_wire(wire[:current + rdlen], current)
  36.         if cused != rdlen:
  37.             raise dns.exception.FormError
  38.         cused != rdlen
  39.         if origin is not None:
  40.             target = target.relativize(origin)
  41.         
  42.         return cls(rdclass, rdtype, target)
  43.  
  44.     from_wire = classmethod(from_wire)
  45.     
  46.     def choose_relativity(self, origin = None, relativize = True):
  47.         self.target = self.target.choose_relativity(origin, relativize)
  48.  
  49.     
  50.     def _cmp(self, other):
  51.         return cmp(self.target, other.target)
  52.  
  53.  
  54.  
  55. class UncompressedNS(NSBase):
  56.     
  57.     def to_wire(self, file, compress = None, origin = None):
  58.         super(UncompressedNS, self).to_wire(file, None, origin)
  59.  
  60.  
  61.