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

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