#NEWLINE# def validate_common( self , selector_dict ) : #NEWLINE# #INDENT# if ( 'duration' not in selector_dict ) : #NEWLINE# #INDENT# raise SelectorParseError ( 'UnsupportedDuration' ) #NEWLINE# #UNINDENT# if ( ( 'metrics' not in selector_dict ) or ( type ( selector_dict [ 'metrics' ] ) != list ) ) : #NEWLINE# #INDENT# raise SelectorParseError ( 'MetricsRequiresList' ) #NEWLINE# #UNINDENT# if ( not selector_dict [ 'start_times' ] ) : #NEWLINE# #INDENT# raise SelectorParseError ( 'List of start times must be non-empty.' ) #NEWLINE# #UNINDENT# if ( not selector_dict [ 'metrics' ] ) : #NEWLINE# #INDENT# raise SelectorParseError ( 'List of metrics must be non-empty.' ) #NEWLINE# #UNINDENT# if ( 'client_countries' in selector_dict ) : #NEWLINE# #INDENT# for client_country in selector_dict [ 'client_countries' ] : #NEWLINE# #INDENT# if ( not re . match ( '^[a-zA-Z]{2}$' , client_country ) ) : #NEWLINE# #INDENT# raise SelectorParseError ( 'Requires ISO alpha-2 country code.' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# supported_metrics = ( 'upload_throughput' , 'download_throughput' , 'average_rtt' , 'minimum_rtt' , 'packet_retransmit_rate' ) #NEWLINE# for metric in selector_dict [ 'metrics' ] : #NEWLINE# #INDENT# if ( metric not in supported_metrics ) : #NEWLINE# #INDENT# raise SelectorParseError ( 'UnsupportedMetric' )