#NEWLINE# def from_method( self , method , results ) : #NEWLINE# #INDENT# contracts = self . extract_contracts ( method ) #NEWLINE# if contracts : #NEWLINE# #INDENT# ( args , kwargs ) = get_spec ( Request . __init__ ) #NEWLINE# kwargs [ 'callback' ] = method #NEWLINE# for contract in contracts : #NEWLINE# #INDENT# kwargs = contract . adjust_request_args ( kwargs ) #NEWLINE# #UNINDENT# args . remove ( 'self' ) #NEWLINE# if set ( args ) . issubset ( set ( kwargs ) ) : #NEWLINE# #INDENT# request = Request ( ** kwargs ) #NEWLINE# for contract in reversed ( contracts ) : #NEWLINE# #INDENT# request = contract . add_pre_hook ( request , results ) #NEWLINE# #UNINDENT# for contract in contracts : #NEWLINE# #INDENT# request = contract . add_post_hook ( contract , results ) #NEWLINE# #UNINDENT# self . _clean_req ( request , method , results ) #NEWLINE# return request