diff options
author | Camil Staps | 2016-05-02 15:36:05 +0200 |
---|---|---|
committer | Camil Staps | 2016-05-02 15:36:05 +0200 |
commit | 7120add95d0c5b8a97af861785ec9fe1cfc7eaee (patch) | |
tree | 986d3801536e5d45937ee3d22474bc6eca120819 /project2/proj2_s4498062/dns/classes.py | |
parent | Assignment 5 (diff) |
dos2unix
Diffstat (limited to 'project2/proj2_s4498062/dns/classes.py')
-rw-r--r-- | project2/proj2_s4498062/dns/classes.py | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/project2/proj2_s4498062/dns/classes.py b/project2/proj2_s4498062/dns/classes.py index aeb1da7..767b2f6 100644 --- a/project2/proj2_s4498062/dns/classes.py +++ b/project2/proj2_s4498062/dns/classes.py @@ -1,43 +1,43 @@ -#!/usr/bin/env python2
-
-""" DNS CLASS and QCLASS values
-
-This module contains an Enum of CLASS and QCLASS values. The Enum also contains
-a method for converting values to strings. See sections 3.2.4 and 3.2.5 of RFC
-1035 for more information.
-"""
-
-
-class Class(object):
- """ Enum of CLASS and QCLASS values
-
- Usage:
- >>> Class.IN
- 1
- >>> Class.ANY
- 255
- """
-
- IN = 1
- CS = 2
- CH = 3
- HS = 4
- ANY = 255
-
- by_string = {
- "IN": IN,
- "CS": CS,
- "CH": CH,
- "HS": HS,
- "*": ANY
- }
-
- by_value = dict([(y, x) for x, y in by_string.items()])
-
- @staticmethod
- def to_string(class_):
- return Class.by_value[class_]
-
- @staticmethod
- def from_string(string):
- return Class.by_string[string]
+#!/usr/bin/env python2 + +""" DNS CLASS and QCLASS values + +This module contains an Enum of CLASS and QCLASS values. The Enum also contains +a method for converting values to strings. See sections 3.2.4 and 3.2.5 of RFC +1035 for more information. +""" + + +class Class(object): + """ Enum of CLASS and QCLASS values + + Usage: + >>> Class.IN + 1 + >>> Class.ANY + 255 + """ + + IN = 1 + CS = 2 + CH = 3 + HS = 4 + ANY = 255 + + by_string = { + "IN": IN, + "CS": CS, + "CH": CH, + "HS": HS, + "*": ANY + } + + by_value = dict([(y, x) for x, y in by_string.items()]) + + @staticmethod + def to_string(class_): + return Class.by_value[class_] + + @staticmethod + def from_string(string): + return Class.by_string[string] |