Ubuntu Pastebin

Paste from smoser at Tue, 31 Jan 2017 01:55:41 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/python


class PoorMansEnum(object):
    def __init__(self, **kwargs):
        for (k, v) in kwargs.items():
            setattr(self, k, v)

    def keys(self):
        return [k for k in dir(self)
                if (not k.startswith("__") and not
                    callable(getattr(self, k)))]

    def values(self):
        return [getattr(self, k) for k in self.keys()]

    def __str__(self):
        return str(dict(zip(self.keys(), self.values())))

Platforms = PoorMansEnum(
    GENUINE_AWS="GenuineAWS",
    ALIYUN="AliYun",
    UNKNOWN="Unknown",
)

print("Platforms:%s" % Platforms)
Download as text