<s> from hazelcast . serialization . bits import * <EOL> from hazelcast . protocol . client_message import ClientMessage <EOL> from hazelcast . protocol . custom_codec import * <EOL> from hazelcast . util import ImmutableLazyDataList <EOL> from hazelcast . protocol . codec . client_message_type import * <EOL> REQUEST_TYPE = CLIENT_GETPARTITIONS <EOL> RESPONSE_TYPE = <NUM_LIT> <EOL> RETRYABLE = False <EOL> def calculate_size ( ) : <EOL> """<STR_LIT>""" <EOL> data_size = <NUM_LIT:0> <EOL> return data_size <EOL> def encode_request ( ) : <EOL> """<STR_LIT>""" <EOL> client_message = ClientMessage ( payload_size = calculate_size ( ) ) <EOL> client_message . set_message_type ( REQUEST_TYPE ) <EOL> client_message . set_retryable ( RETRYABLE ) <EOL> client_message . update_frame_length ( ) <EOL> return client_message <EOL> def decode_response ( client_message , to_object = None ) : <EOL> """<STR_LIT>""" <EOL> parameters = dict ( partitions = None ) <EOL> partitions_size = client_message . read_int ( ) <EOL> partitions = { } <EOL> for partitions_index in xrange ( <NUM_LIT:0> , partitions_size ) : <EOL> partitions_key = AddressCodec . decode ( client_message , to_object ) <EOL> partitions_val_size = client_message . read_int ( ) <EOL> partitions_val = [ ] <EOL> for partitions_val_index in xrange ( <NUM_LIT:0> , partitions_val_size ) : <EOL> partitions_val_item = client_message . read_int ( ) <EOL> partitions_val . append ( partitions_val_item ) <EOL> partitions [ partitions_key ] = partitions_val <EOL> parameters [ '<STR_LIT>' ] = partitions <EOL> return parameters </s>
