Home | Trees | Indices | Help |
|
---|
|
1 # Copyright (C) 2011 Nominum, Inc. 2 # 3 # Permission to use, copy, modify, and distribute this software and its 4 # documentation for any purpose with or without fee is hereby granted, 5 # provided that the above copyright notice and this permission notice 6 # appear in all copies. 7 # 8 # THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES 9 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR 11 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 14 # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 16 """DNS Wire Data Helper""" 17 18 import sys 19 20 import dns.exception 2123 # WireData is a string with stricter slicing54 6025 try: 26 return WireData(super(WireData, self).__getitem__(key)) 27 except IndexError: 28 raise dns.exception.FormError30 try: 31 if j == sys.maxint: 32 # handle the case where the right bound is unspecified 33 j = len(self) 34 if i < 0 or j < 0: 35 raise dns.exception.FormError 36 # If it's not an empty slice, access left and right bounds 37 # to make sure they're valid 38 if i != j: 39 super(WireData, self).__getitem__(i) 40 super(WireData, self).__getitem__(j - 1) 41 return WireData(super(WireData, self).__getslice__(i, j)) 42 except IndexError: 43 raise dns.exception.FormError45 i = 0 46 while 1: 47 try: 48 yield self[i] 49 i += 1 50 except dns.exception.FormError: 51 raise StopIteration
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Mar 22 09:18:00 2013 | http://epydoc.sourceforge.net |