3 <_ ,@sddlmZmZmZmZmZmZmZdaddZ ddZ ddZ ej e ejeejeejeejeejeejeejeejeejeejeejeejeejeejeej e!ej"e!ej#e!ej$dej%dej&dej'diZ(d d Z)d d Z*d dZ+ddZ,e e,dS)) VFuncInfo FunctionInfo CallableInfo ObjectInfo StructInfo DirectionTypeTagNcCs|adS)zSet doc string generator function :param callable func: Callable which takes a GIInfoStruct and returns documentation for it. N)_generate_doc_string_func)funcr !/usr/lib64/python3.6/docstring.pyset_doc_string_generator%sr cCstS)z6Returns the currently registered doc string generator.)r r r r r get_doc_string_generator/srcCst|S)aEGenerate a doc string given a GIInfoStruct. :param gi.types.BaseInfo info: GI info instance to generate documentation for. :returns: Generated documentation as a string. :rtype: str This passes the info struct to the currently registered doc string generator and returns the result. )r )infor r r generate_doc_string4s rcCsf|j}tj|d}|r(t|dr(|jS|tjkr^|j}|j}|sN|j Sd|j |fS|j S)N__name__z%s.%s) Zget_tag_type_tag_to_py_typegethasattrrr INTERFACEZ get_interfaceget_nameZget_tag_as_stringZ get_namespace)Zgi_typeZtype_tagZpy_typeZifaceZ info_namer r r _get_pytype_hint\s  rc Csg}t|trdg}nt|tr.|jr.dg}|j}d }t}t}x:|D]2}|j|j|j|jj |j|j qLWxt |D]\}}|j t jkrq||krq|j}t|j} | |kr|d| 7}|js||kr|d7}n|jr|d7}|j|qWdj|} g} t|j} |j rf| rf| |krf| }|jr\|d7}| j|xlt |D]`\}}|j t jkrqp||krqp|j}t|j} | |kr|d| 7}| j|qpW| rd|j| dj| fSd |j| fSdS) Nselfvoid:z=Nonez =z, z or Nonez %s(%s) -> %sz%s(%s))r) isinstancerrZ is_methodZ get_argumentssetaddZ get_destroyZget_typeZget_array_lengthZ get_closure enumerateZ get_directionrZOUTrrZ may_be_nullZ is_optionalappendjoinZget_return_typeZ skip_returnZmay_return_nullINr) rZ in_args_strsargsZhint_blacklistZignore_indicesZuser_data_indicesargiZargstrZhintZ in_args_strZ out_args_strsZ return_hintr r r _generate_callable_info_docnsb               r%cCsd}d}t|tr4|jdkrH|d|jd7}n|d|jd7}x,|jD] }|jrR|dt|d7}qRW|r||SdSdS)Nz :Constructors: :: z z() z(**properties)  )rrZget_sizerZ get_methodsZis_constructorr%)rheaderdocZ method_infor r r _generate_class_info_docs  r+cCs,t|ttfrt|St|tr(t|SdS)Nr&)rrrr+rr%)rr r r _generate_doc_dispatchs  r,)-Z_girrrrrrrr r rrZBOOLEANboolZINT8intZUINT8ZINT16ZUINT16ZINT32ZUINT32ZINT64ZUINT64ZFLOATfloatZDOUBLEZGLISTlistZGSLISTZARRAYZGHASHdictZUTF8strZFILENAMEZUNICHARrZGTYPEZERRORZVOIDrrr%r+r,r r r r s>$   @