<s> from decimal import Decimal <EOL> from geolocation . client import ApiClient <EOL> class DistanceMatrixApiClient ( ApiClient ) : <EOL> """<STR_LIT>""" <EOL> API_URL = '<STR_LIT>' <EOL> ONE_MILE = Decimal ( <NUM_LIT> ) <EOL> ONE_FEET = Decimal ( <NUM_LIT> ) <EOL> ONE_KILOMETER = Decimal ( <NUM_LIT> ) <EOL> UNIT_KM = '<STR_LIT>' <EOL> UNIT_M = '<STR_LIT:m>' <EOL> MODE_DRIVING = '<STR_LIT>' <EOL> MODE_WALKING = '<STR_LIT>' <EOL> MODE_BICYCLING = '<STR_LIT>' <EOL> MODE_TRANSIT = '<STR_LIT>' <EOL> MODES = ( <EOL> ( MODE_DRIVING , '<STR_LIT>' ) , <EOL> ( MODE_WALKING , '<STR_LIT>' ) , <EOL> ( MODE_BICYCLING , '<STR_LIT>' ) , <EOL> ( MODE_TRANSIT , '<STR_LIT>' ) <EOL> ) <EOL> AVOID_TOLLS = '<STR_LIT>' <EOL> AVOID_HIGHWAYS = '<STR_LIT>' <EOL> AVOID_FERRIES = '<STR_LIT>' <EOL> AVOIDS = ( <EOL> ( AVOID_TOLLS , '<STR_LIT>' ) , <EOL> ( AVOID_HIGHWAYS , '<STR_LIT>' ) , <EOL> ( AVOID_FERRIES , '<STR_LIT>' ) <EOL> ) <EOL> query_parameters = { } <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % self . api_key <EOL> def set_query_parameters ( self , origins , destinations , mode = MODE_DRIVING , avoid = None ) : <EOL> """<STR_LIT>""" <EOL> def prepare_multi_params ( value ) : <EOL> return '<STR_LIT:|>' . join ( value ) if isinstance ( value , list ) else value <EOL> self . query_parameters [ '<STR_LIT>' ] = prepare_multi_params ( origins ) <EOL> self . query_parameters [ '<STR_LIT>' ] = prepare_multi_params ( destinations ) <EOL> self . query_parameters [ '<STR_LIT>' ] = mode <EOL> if avoid : <EOL> self . query_parameters [ '<STR_LIT>' ] = avoid <EOL> def get_data ( self , origins , destinations , mode = MODE_DRIVING , avoid = None ) : <EOL> """<STR_LIT>""" <EOL> self . set_query_parameters ( <EOL> origins = origins , <EOL> destinations = destinations , <EOL> mode = mode , <EOL> avoid = avoid <EOL> ) <EOL> return self . send_data ( self . API_URL , self . query_parameters ) </s>
