#NEWLINE# @ staticmethod #NEWLINE# def parse( value ) : #NEWLINE# #INDENT# '\n        Parse ``Accept-*`` style header.\n\n        Return iterator of ``(value, quality)`` pairs.\n        ``quality`` defaults to 1.\n        ' #NEWLINE# for match in part_re . finditer ( ( ',' + value ) ) : #NEWLINE# #INDENT# name = match . group ( 1 ) #NEWLINE# if ( name == 'q' ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# quality = ( match . group ( 2 ) or '' ) #NEWLINE# if quality : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# quality = max ( min ( float ( quality ) , 1 ) , 0 ) #NEWLINE# ( yield ( value , quality ) ) #NEWLINE# continue #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# ( yield ( name , 1 ) )