[Neo-report] r2656 gregory - /trunk/neo/lib/protocol.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Mar 1 15:54:14 CET 2011
Author: gregory
Date: Tue Mar 1 15:54:14 2011
New Revision: 2656
Log:
Remove trailing whitspaces.
Modified:
trunk/neo/lib/protocol.py
Modified: trunk/neo/lib/protocol.py
==============================================================================
--- trunk/neo/lib/protocol.py [iso-8859-1] (original)
+++ trunk/neo/lib/protocol.py [iso-8859-1] Tue Mar 1 15:54:14 2011
@@ -393,46 +393,46 @@ class PEnum(PStructItem):
raise ValueError, 'Invalid code for %s enum: %r' % (enum, code)
class PAddressIPGeneric(PStructItem):
-
+
def __init__(self, name, format):
- PStructItem.__init__(self, name, format)
-
+ PStructItem.__init__(self, name, format)
+
def encode(self, writer, address):
host, port = address
host = socket.inet_pton(self.af_type, host)
writer(self.pack(host, port))
-
+
def decode(self, reader):
data = reader(self.size)
- address = self.unpack(data)
+ address = self.unpack(data)
host, port = address
host = socket.inet_ntop(self.af_type, host)
- return (host, port)
+ return (host, port)
class PAddressIPv4(PAddressIPGeneric):
af_type = socket.AF_INET
-
+
def __init__(self, name):
PAddressIPGeneric.__init__(self, name, '!4sH')
-
+
class PAddressIPv6(PAddressIPGeneric):
af_type = socket.AF_INET6
def __init__(self, name):
- PAddressIPGeneric.__init__(self, name, '!16sH')
-
+ PAddressIPGeneric.__init__(self, name, '!16sH')
+
class PAddress(PStructItem):
"""
An host address (IPv4/IPv6)
"""
-
+
address_format_dict = {
- socket.AF_INET: PAddressIPv4('ipv4'),
+ socket.AF_INET: PAddressIPv4('ipv4'),
socket.AF_INET6: PAddressIPv6('ipv6'),
}
def __init__(self, name):
- PStructItem.__init__(self, name, '!L')
+ PStructItem.__init__(self, name, '!L')
def _encode(self, writer, address):
if address is None:
@@ -441,7 +441,7 @@ class PAddress(PStructItem):
writer(self.pack(af_type))
encoder = self.address_format_dict[af_type]
encoder.encode(writer, address)
-
+
def _decode(self, reader):
af_type = self.unpack(reader(self.size))[0]
decoder = self.address_format_dict[af_type]
More information about the Neo-report
mailing list