diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2013-10-31 15:06:05 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2013-10-31 15:06:05 -0700 |
commit | be870a6ed796af00a3c1c2f23cd189bf33fc6a4c (patch) | |
tree | 6d5a7b3efbe833d0eed0067107ff5e9a2eb1d6b0 /src/common | |
parent | 6c389b7f9eb0f40a017951e55834223ac9d7f707 (diff) | |
download | tmwa-be870a6ed796af00a3c1c2f23cd189bf33fc6a4c.tar.gz tmwa-be870a6ed796af00a3c1c2f23cd189bf33fc6a4c.tar.bz2 tmwa-be870a6ed796af00a3c1c2f23cd189bf33fc6a4c.tar.xz tmwa-be870a6ed796af00a3c1c2f23cd189bf33fc6a4c.zip |
Add some more pretty printers
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/ip.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/common/ip.py b/src/common/ip.py new file mode 100644 index 0000000..e6a8183 --- /dev/null +++ b/src/common/ip.py @@ -0,0 +1,14 @@ +class IP4Address(object): + ''' print an IP4Address + ''' + __slots__ = ('_value') + name = 'IP4Address' + enabled = True + + def __init__(self, value): + self._value = value + + def to_string(self): + addr = self._value['_addr'] + addr = tuple(int(addr[i]) for i in range(4)) + return '%d.%d.%d.%d' % addr |