L i dZddlZddlZddlZddlZddlmZddlm Z m Z dejdejfdZ dejdejefd Zdejdefd Zdejdejej&eejeejeffd ZGd d ej*Zdej.eefde ddfdZy)zbAttribute docstrings parsing. .. seealso:: https://peps.python.org/pep-0257/#what-is-a-docstring N) ModuleType) DocstringDocstringParamnodereturnct|dS)z>0615 .Iy,&tzz2)DNN9 % +40 dS\\3::6 7   t $ 8r componentrci|_d|_ tjt j |}t j|}t j|r|j||jSt|t jrEt|jdt jr|j|jd|jS#t$rY|jSwxYw)zGet attribute docstrings from the given component. :param component: component to process (class or module) :returns: for each attribute docstring, a tuple with (description, type, default) Nr)r+r*textwrapdedentinspect getsourcerparseismoduler3rr-bodyr,OSError)r/r4sourcetrees r get_attr_docsz!AttributeDocstrings.get_attr_docsNs )__W%6%6y%ABF99V$D * 4 ~~ D#**-* ! cll3 499Q<(~~  ~~ s(C** DD)__name__ __module__ __qualname____doc__r+r*r3TAnyDictrTupleOptionalr@rr r'r'<s[@II % QWWS!**S/1::c?BCC Drr'obj docstringc  td|jD}tj|j D]>\}\}}}||vst d|g||||du|}|j j|@y)zAdd attribute docstrings found in the object's source code. :param obj: object from which to parse attribute docstrings :param docstring: Docstring object where found attributes are added :returns: list with names of added attributes c34K|]}|jywr))arg_name).0ps r z+add_attribute_docstrings..qs66s attributeN)args descriptionrO type_name is_optionalr$)setparamsr'r@itemsrmetaappend)rKrLrYrOrUrVr$params r add_attribute_docstringsr^hs6Y%5%56 6F++C0668 )33; 7 6 !"!8,'!##4/ E NN ! !% ( )r)rDrr8r6typingrEtypesrcommonrrASTrFrrIrrboolrrHr% NodeVisitorr'Uniontyper^rJrr rgs  -""QUU" cgg !**S/ SWW ''ZZQZZ_ajjo=>?&)#//)X) z! ")/8) )r