#NEWLINE# def long_has_args( opt , longopts ) : #NEWLINE# #INDENT# possibilities = [ o for o in longopts if o . startswith ( opt ) ] #NEWLINE# if ( not possibilities ) : #NEWLINE# #INDENT# raise GetoptError ( ( 'option --%s not recognized' % opt ) , opt ) #NEWLINE# #UNINDENT# if ( opt in possibilities ) : #NEWLINE# #INDENT# return ( False , opt ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( opt + '=' ) in possibilities ) : #NEWLINE# #INDENT# return ( True , opt ) #NEWLINE# #UNINDENT# #UNINDENT# if ( len ( possibilities ) > 1 ) : #NEWLINE# #INDENT# raise GetoptError ( ( 'option --%s not a unique prefix' % opt ) , opt ) #NEWLINE# #UNINDENT# assert ( len ( o ) == 1 ) #NEWLINE# unique_match = possibilities [ 0 ] #NEWLINE# has_arg = unique_match . endswith ( '=' ) #NEWLINE# if has_arg : #NEWLINE# #INDENT# unique_match = unique_match [ : ( - 1 ) ] #NEWLINE# #UNINDENT# return ( has_arg , unique_match )