o ×$•a™ã @sÒdZddlZddlZddlZddlmZmZmZddlm Z ddl m Z m Z e  e jd¡Zdedeeeeefffd d „Zdedeeeffd d „Zddedededeefdd„Zdedeefdd„ZdS)zÒ sphinx.util.docstrings ~~~~~~~~~~~~~~~~~~~~~~ Utilities for docstring processing. :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. éN)ÚDictÚListÚTuple)ÚBody)ÚRemovedInSphinx50WarningÚRemovedInSphinx60WarningÚ field_markerÚsÚreturncCsÌd}i}g}|s ||fSt|ƒD]N}| ¡dkr d}| |¡qt |¡}|rW|sW| ¡dd… dd¡d}| d¡rQ|dd… ¡}|| ¡d… ¡||<q| |¡qd }| |¡qd   |¡|fS) z,Separate docstring into metadata and others.FÚéNú:rzmeta éTÚ ) Úprepare_docstringÚstripÚappendÚfield_list_item_reÚmatchÚgroupÚsplitÚ startswithÚendÚjoin)r Úin_other_elementÚmetadataÚlinesÚlineÚmatchedÚ field_nameÚname©r!ú8/usr/lib/python3/dist-packages/sphinx/util/docstrings.pyÚseparate_metadatas&       r#cCs tjdtddt|ƒ\}}|S)Nz!extract_metadata() is deprecated.é©Ú stacklevel)ÚwarningsÚwarnrr#)r Ú docstringrr!r!r"Úextract_metadata4s ÿ r*éÚignoreÚtabsizec Cs|durd}ntjdtdd| |¡ ¡}tj}||d…D]}t| ¡ƒ}|r4t|ƒ|}t ||ƒ}qt |ƒD]}|t|ƒkrI|| ¡||<q9|tjkrct |t|ƒƒD] }|||d…||<qV|rt|dst|  d¡|rt|dri|r|dr|  d¡|S) a—Convert a docstring into lines of parseable reST. Remove common leading indentation, where the indentation of a given number of lines (usually just one) is ignored. Return the docstring as a list of lines usable for inserting into a docutils ViewList (used as argument of nested_parse().) An empty line is added to act as a separator between this docstring and following content. Nr z;The 'ignore' argument to prepare_docstring() is deprecated.r$r%réÿÿÿÿr ) r'r(rÚ expandtabsÚ splitlinesÚsysÚmaxsizeÚlenÚlstripÚminÚrangeÚpopr) r r,r-rÚmarginrÚcontentÚindentÚir!r!r"r<s4 ÿ   €  €    ÿ  rcCszg}dd„| ¡ ¡Dƒ}|D] }| d¡r/|dd…}|r*|ddkr*|dd…}| |¡q|r;|d r;| d ¡|S) z˜Extract documentation comment lines (starting with #:) and return them as a list of lines. Returns an empty list if there is no documentation. cSsg|]}| ¡‘qSr!)r)Ú.0rr!r!r"Ú hsz&prepare_commentdoc..z#:r$Nrú r r.r )r/r0rr)r Úresultrrr!r!r"Úprepare_commentdoccs    €  r@)Nr+)Ú__doc__Úrer1r'ÚtypingrrrÚdocutils.parsers.rst.statesrÚsphinx.deprecationrrÚcompileÚpatternsrÚstrr#r*Úintrr@r!r!r!r"Ús  " '