diff options
author | Guido van Rossum <guido@python.org> | 1994-10-08 19:30:50 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1994-10-08 19:30:50 (GMT) |
commit | 705d517e3f4df74b8c04edf54ac73b087c982f32 (patch) | |
tree | 7b0543f1165fc1bdfc4717277f67d8e699dcbeb4 /Demo/dns/dnsclass.py | |
parent | 3dc44aba71305cd9be8cba7703a96b6528f34169 (diff) | |
download | cpython-705d517e3f4df74b8c04edf54ac73b087c982f32.zip cpython-705d517e3f4df74b8c04edf54ac73b087c982f32.tar.gz cpython-705d517e3f4df74b8c04edf54ac73b087c982f32.tar.bz2 |
initial checkin
Diffstat (limited to 'Demo/dns/dnsclass.py')
-rwxr-xr-x | Demo/dns/dnsclass.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Demo/dns/dnsclass.py b/Demo/dns/dnsclass.py new file mode 100755 index 0000000..f90b9e8 --- /dev/null +++ b/Demo/dns/dnsclass.py @@ -0,0 +1,23 @@ +# CLASS values (section 3.2.4) + +IN = 1 # the Internet +CS = 2 # the CSNET class (Obsolete - used only for examples in + # some obsolete RFCs) +CH = 3 # the CHAOS class +HS = 4 # Hesiod [Dyer 87] + +# QCLASS values (section 3.2.5) + +ANY = 255 # any class + + +# Construct reverse mapping dictionary + +_names = dir() +classmap = {} +for _name in _names: + if _name[0] != '_': classmap[eval(_name)] = _name + +def classstr(klass): + if classmap.has_key(klass): return classmap[klass] + else: return `klass` |