Commits

Szymon Wróblewski committed 72d8b20

more pythonic variable names

Comments (0)

Files changed (2)

ppenet/__init__.py

Empty file added.
 MAXIMUM_PACKET_SIZE = 1024 * 1024 * 1024
 MAXIMUM_FRAGMENT_COUNT = 1024 * 1024
 
+
 class Command:
     NONE, ACKNOWLEDGE, CONNECT, VERIFY_CONNECT, DISCONNECT, PING, \
     SEND_RELIABLE, SEND_UNRELIABLE, SEND_FRAGMENT, SEND_UNSEQUENCED, \
     COMMAND_FLAG_UNSEQUENCED = 1 << 6
 
     HEADER_FLAG_COMPRESSED = 1 << 14
-    HEADER_FLAG_SENT_TIME  = 1 << 15
-    HEADER_FLAG_MASK       = HEADER_FLAG_COMPRESSED | HEADER_FLAG_SENT_TIME
-    HEADER_SESSION_MASK    = 3 << 12
-    HEADER_SESSION_SHIFT   = 12
-    
+    HEADER_FLAG_SENT_TIME = 1 << 15
+    HEADER_FLAG_MASK = HEADER_FLAG_COMPRESSED | HEADER_FLAG_SENT_TIME
+    HEADER_SESSION_MASK = 3 << 12
+    HEADER_SESSION_SHIFT = 12
+
 
 Header = namedtuple('Header', (
     'peerID',
 
 CommandHeader = namedtuple('CommandHeader', (
     'command',
-    'channelID',
-    'reliableSequenceNumber',
+    'channel_id',
+    'reliable_sequence_number',
 ))
 CommandHeaderStruct = Struct('!BBH')
 
 Acknowledge = namedtuple('Acknowledge', (
     'header',
-    'receivedReliableSequenceNumber',
-    'receivedSentTime'
+    'received_reliable_sequence_number',
+    'received_sent_time'
 ))
 AcknowledgeStruct = Struct('!%dsHH' % CommandHeaderStruct.size)
 
 Connect = namedtuple('Connect', (
     'header',
-    'outgoingPeerID',
-    'incomingSessionID',
-    'outgoingSessionID',
+    'outgoing_peer_id',
+    'incoming_session_id',
+    'outgoing_session_id',
     'mtu',
-    'windowSize',
-    'channelCount',
-    'incomingBandwidth',
-    'outgoingBandwidth',
-    'packetThrottleInterval',
-    'packetThrottleAcceleration',
-    'packetThrottleDeceleration',
-    'connectID',
+    'window_size',
+    'channel_count',
+    'incoming_bandwidth',
+    'outgoing_bandwidth',
+    'packet_throttle_interval',
+    'packet_throttle_acceleration',
+    'packet_throttle_deceleration',
+    'connect_id',
     'data',
 ))
 ConnectStruct = Struct('!%dsHBB10I' % CommandHeaderStruct.size)
 
 VerifyConnect = namedtuple('VerifyConnect', (
     'header',
-    'outgoingPeerID',
-    'incomingSessionID',
-    'outgoingSessionID',
+    'outgoing_peer_id',
+    'incoming_session_id',
+    'outgoing_session_id',
     'mtu',
-    'windowSize',
-    'channelCount',
-    'incomingBandwidth',
-    'outgoingBandwidth',
-    'packetThrottleInterval',
-    'packetThrottleAcceleration',
-    'packetThrottleDeceleration',
-    'connectID',
+    'window_size',
+    'channel_count',
+    'incoming_bandwidth',
+    'outgoing_bandwidth',
+    'packet_throttle_interval',
+    'packet_throttle_acceleration',
+    'packet_throttle_deceleration',
+    'connect_id',
 ))
 VerifyConnectStruct = Struct('!%dsHBB9I' % CommandHeaderStruct.size)
 
 BandwidthLimit = namedtuple('BandwidthLimit', (
     'header',
-    'incomingBandwidth',
-    'outgoingBandwidth',
+    'incoming_bandwidth',
+    'outgoing_bandwidth',
 ))
 BandwidthLimitStruct = Struct('!%dsII' % CommandHeaderStruct.size)
 
 ThrottleConfigure = namedtuple('ThrottleConfigure', (
     'header',
-    'packetThrottleInterval',
-    'packetThrottleAcceleration',
-    'packetThrottleDeceleration',
+    'packet_throttle_interval',
+    'packet_throttle_acceleration',
+    'packet_throttle_deceleration',
 ))
 ThrottleConfigureStruct = Struct('!%dsIII' % CommandHeaderStruct.size)
 
 
 SendReliable = namedtuple('SendReliable', (
     'header',
-    'dataLength',
+    'data_length',
 ))
 SendReliableStruct = Struct('!%dsH' % CommandHeaderStruct.size)
 
 SendUnreliable = namedtuple('SendUnreliable', (
     'header',
-    'unreliableSequenceNumber',
-    'dataLength',
+    'unreliable_sequence_number',
+    'data_length',
 ))
 SendUnreliableStruct = Struct('!%dsHH' % CommandHeaderStruct.size)
 
 SendUnsequenced = namedtuple('SendUnsequenced', (
     'header',
-    'unsequencedGroup',
-    'dataLength',
+    'unsequenced_group',
+    'data_length',
 ))
 SendUnsequencedStruct = Struct('!%dsHH' % CommandHeaderStruct.size)
 
 SendFragment = namedtuple('SendFragment', (
     'header',
-    'startSequenceNumber',
-    'dataLength',
-    'fragmentCount',
-    'fragmentNumber',
-    'totalLength',
-    'fragmentOffset',
+    'start_sequence_number',
+    'data_length',
+    'fragment_count',
+    'fragment_number',
+    'total_length',
+    'fragment_offset',
 ))
 SendFragmentStruct = Struct('!%dsHH4I' % CommandHeaderStruct.size)
-