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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import dns.exception as dns
  5. import dns.ipv4 as dns
  6. import dns.rdata as dns
  7. import dns.tokenizer as dns
  8.  
  9. class A(dns.rdata.Rdata):
  10.     __slots__ = [
  11.         'address']
  12.     
  13.     def __init__(self, rdclass, rdtype, address):
  14.         super(A, self).__init__(rdclass, rdtype)
  15.         junk = dns.ipv4.inet_aton(address)
  16.         self.address = address
  17.  
  18.     
  19.     def to_text(self, origin = None, relativize = True, **kw):
  20.         return self.address
  21.  
  22.     
  23.     def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
  24.         (ttype, address) = tok.get()
  25.         if ttype != dns.tokenizer.IDENTIFIER:
  26.             raise dns.exception.SyntaxError
  27.         ttype != dns.tokenizer.IDENTIFIER
  28.         t = tok.get_eol()
  29.         return cls(rdclass, rdtype, address)
  30.  
  31.     from_text = classmethod(from_text)
  32.     
  33.     def to_wire(self, file, compress = None, origin = None):
  34.         file.write(dns.ipv4.inet_aton(self.address))
  35.  
  36.     
  37.     def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
  38.         address = dns.ipv4.inet_ntoa(wire[current:current + rdlen])
  39.         return cls(rdclass, rdtype, address)
  40.  
  41.     from_wire = classmethod(from_wire)
  42.     
  43.     def _cmp(self, other):
  44.         sa = dns.ipv4.inet_aton(self.address)
  45.         oa = dns.ipv4.inet_aton(other.address)
  46.         return cmp(sa, oa)
  47.  
  48.  
  49.