#NEWLINE# def guess_args( obj , doc , op_name = None ) : #NEWLINE# #INDENT# args = [ ] #NEWLINE# for line in read_args ( doc ) : #NEWLINE# #INDENT# if ( not ( ':' in line ) ) : #NEWLINE# #INDENT# debug . log ( ( 'Malformated argument in doc: %r' % obj ) ) #NEWLINE# continue #NEWLINE# #UNINDENT# ( arg , descr ) = line . split ( ':' , 1 ) #NEWLINE# descr = descr . strip ( ) #NEWLINE# if ( arg == 'shape' ) : #NEWLINE# #INDENT# type_ = '(basic:List)' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( op_name is not None ) and ( ( op_name == 'assign' ) or op_name . startswith ( 'assign_' ) ) and ( arg == 'ref' ) ) : #NEWLINE# #INDENT# type_ = Variable #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( _re_arg_bool . search ( descr ) is not None ) : #NEWLINE# #INDENT# type_ = '(basic:Boolean)' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( _re_arg_int . search ( descr ) is not None ) : #NEWLINE# #INDENT# type_ = '(basic:Integer)' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if descr . lower ( ) . startswith ( 'A list ' ) : #NEWLINE# #INDENT# type_ = '(basic:List)' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( arg == 'dtype' ) or ( arg == 'name' ) ) : #NEWLINE# #INDENT# type_ = '(basic:String)' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# type_ = TFOperation #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# args . append ( ( arg , descr , type_ ) ) #NEWLINE# #UNINDENT# if ( not descr ) : #NEWLINE# #INDENT# debug . log ( ( "Didn't find 'Args:' in doc; skipping: %r" % obj ) ) #NEWLINE# #UNINDENT# return args