3

T'ícê
ã@sÆdZddlZddlZddlZddlmZmZmZddlm	Z	ddl
mZmZej
e	jdƒZeeeeeeffdœdd	„Zeeeefdœd
d„Zdeeeeed
œdd„Zeeedœdd„ZdS)z#Utilities for docstring processing.éN)ÚDictÚListÚTuple)ÚBody)ÚRemovedInSphinx50WarningÚRemovedInSphinx60WarningZfield_marker)ÚsÚreturncCsÒd}i}g}|s||fSxªt|ƒD]ž}|jƒdkrBd}|j|ƒq"tj|ƒ}|r²|r²|jƒdd…jddƒd}|jdƒr¦|dd…jƒ}||jƒd…jƒ||<qÀ|j|ƒq"d	}|j|ƒq"Wd
j	|ƒ|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)rZin_other_elementÚmetadataÚlinesÚlineÚmatchedÚ
field_nameÚname©rú8/tmp/pip-build-gk9425m9/sphinx/sphinx/util/docstrings.pyÚseparate_metadatas&


r!cCs tjdtddt|ƒ\}}|S)Nz!extract_metadata() is deprecated.é)Ú
stacklevel)ÚwarningsÚwarnrr!)rZ	docstringrrrr Úextract_metadata,s
r&é)rÚignoreÚtabsizer	c	Cs|dkrd}ntjdtdd|j|ƒjƒ}tj}x:||d…D]*}t|jƒƒ}|r@t|ƒ|}t	||ƒ}q@Wx,t
|ƒD] }|t|ƒkrx||jƒ||<qxW|tjkrÒx*t
|t|ƒƒD]}|||d…||<q¶Wx|rî|drî|jdƒqÔW|oú|dr|j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.
    Nrz;The 'ignore' argument to prepare_docstring() is deprecated.r")r#rr
éÿÿÿÿ)
r$r%rÚ
expandtabsÚ
splitlinesÚsysÚmaxsizeÚlenÚlstripÚminÚrangeÚpopr)	rr(r)rÚmarginrÚcontentÚindentÚirrr r4s,	


rcCs~g}dd„|jƒjƒDƒ}xH|D]@}|jdƒr |dd…}|rV|ddkrV|dd…}|j|ƒq W|rz|d
rz|jd	ƒ|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|]}|jƒ‘qSr)r)Ú.0rrrr ú
<listcomp>`sz&prepare_commentdoc.<locals>.<listcomp>z#:r"Nrú rr
r*)r+r,rr)rÚresultrrrrr Úprepare_commentdoc[s


r<)Nr')Ú__doc__Úrer-r$ÚtypingrrrZdocutils.parsers.rst.statesrZsphinx.deprecationrrÚcompileÚpatternsrÚstrr!r&Úintrr<rrrr Ú<module>s '