#NEWLINE# def convert( self , argval ) : #NEWLINE# #INDENT# '\n        Given an argument to --filter of the form "<name>=<value>", convert\n        the value to the appropriate type by calling self.type on it, then\n        return a (name, converted_value) tuple.  If the value\'s type conversion\n        doesn\'t work then an ArgumentTypeError will result.  If the conversion\n        succeeds but does not appear in self.choices when it exists, an\n        ArgumentTypeError will result as well.\n        ' #NEWLINE# if ( '=' not in argval ) : #NEWLINE# #INDENT# msg = "filter '{0}' must have format 'NAME=VALUE'" . format ( argval ) #NEWLINE# raise argparse . ArgumentTypeError ( msg ) #NEWLINE# #UNINDENT# ( name , value_str ) = argval . split ( '=' , 1 ) #NEWLINE# try : #NEWLINE# #INDENT# value = self . type ( value_str ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# msg = "{0} filter value '{1}' must have type {2}" . format ( name , value_str , self . type . __name__ ) #NEWLINE# raise argparse . ArgumentTypeError ( msg ) #NEWLINE# #UNINDENT# if ( choice . choices and ( value not in self . choices ) ) : #NEWLINE# #INDENT# msg = "{0} filter value '{1}' must match one of {2}" . format ( name , value , ', ' . join ( [ str ( choice ) for choice in self . choices ] ) ) #NEWLINE# raise argparse . ArgumentTypeError ( msg ) #NEWLINE# #UNINDENT# if ( value == '' ) : #NEWLINE# #INDENT# value = EMPTY #NEWLINE# #UNINDENT# return ( name , value )