#NEWLINE# @ classmethod #NEWLINE# def parse( cls , header , updates_to = None , type = None ) : #NEWLINE# #INDENT# '\n        Parse the header, returning a CacheControl object.\n\n        The object is bound to the request or response object\n        ``updates_to``, if that is given.\n        ' #NEWLINE# if updates_to : #NEWLINE# #INDENT# props = cls . update_dict ( ) #NEWLINE# props . updated = updates_to #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# props = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# for match in token_re . finditer ( header ) : #NEWLINE# #INDENT# name = match . group ( 1 ) #NEWLINE# value = ( match . group ( 2 ) or match . group ( 3 ) or None ) #NEWLINE# if value : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# value = int ( value ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# props [ name ] = value #NEWLINE# #UNINDENT# obj = cls ( props , type = type ) #NEWLINE# if updates_to : #NEWLINE# #INDENT# props . updated_args = ( obj , ) #NEWLINE# #UNINDENT# return header