home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_1648 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  2.6 KB  |  71 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.tokenizer as dns
  7.  
  8. class HINFO(dns.rdata.Rdata):
  9.     __slots__ = [
  10.         'cpu',
  11.         'os']
  12.     
  13.     def __init__(self, rdclass, rdtype, cpu, os):
  14.         super(HINFO, self).__init__(rdclass, rdtype)
  15.         self.cpu = cpu
  16.         self.os = os
  17.  
  18.     
  19.     def to_text(self, origin = None, relativize = True, **kw):
  20.         return '"%s" "%s"' % (dns.rdata._escapify(self.cpu), dns.rdata._escapify(self.os))
  21.  
  22.     
  23.     def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
  24.         cpu = tok.get_string()
  25.         os = tok.get_string()
  26.         tok.get_eol()
  27.         return cls(rdclass, rdtype, cpu, os)
  28.  
  29.     from_text = classmethod(from_text)
  30.     
  31.     def to_wire(self, file, compress = None, origin = None):
  32.         l = len(self.cpu)
  33.         byte = chr(l)
  34.         file.write(byte)
  35.         file.write(self.cpu)
  36.         l = len(self.os)
  37.         byte = chr(l)
  38.         file.write(byte)
  39.         file.write(self.os)
  40.  
  41.     
  42.     def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
  43.         l = ord(wire[current])
  44.         current += 1
  45.         rdlen -= 1
  46.         if l > rdlen:
  47.             raise dns.exception.FormError
  48.         l > rdlen
  49.         cpu = wire[current:current + l]
  50.         current += l
  51.         rdlen -= l
  52.         l = ord(wire[current])
  53.         current += 1
  54.         rdlen -= 1
  55.         if l != rdlen:
  56.             raise dns.exception.FormError
  57.         l != rdlen
  58.         os = wire[current:current + l]
  59.         return cls(rdclass, rdtype, cpu, os)
  60.  
  61.     from_wire = classmethod(from_wire)
  62.     
  63.     def _cmp(self, other):
  64.         v = cmp(self.cpu, other.cpu)
  65.         if v == 0:
  66.             v = cmp(self.os, other.os)
  67.         
  68.         return v
  69.  
  70.  
  71.