ó 1Tc@s‘dZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZddlmZmZd e jfd „ƒYZd „Zd „Zd „Zde jfd„ƒYZd„Zdd d„ƒYZd„Zdefd„ƒYZdd„Zddd„Zd„Zdgd„Z!d„Z"igd„Z#d„Z$d„Z%dS(!sƒ sphinx.ext.autosummary ~~~~~~~~~~~~~~~~~~~~~~ Sphinx extension that adds an autosummary:: directive, which can be used to generate function/method/attribute/etc. summary lists, similar to those output eg. by Epydoc and other API doc generation tools. An :autolink: role is also provided. autosummary directive --------------------- The autosummary directive has the form:: .. autosummary:: :nosignatures: :toctree: generated/ module.function_1 module.function_2 ... and it generates an output table (containing signatures, optionally) ======================== ============================================= module.function_1(args) Summary line from the docstring of function_1 module.function_2(args) Summary line from the docstring ... ======================== ============================================= If the :toctree: option is specified, files matching the function names are inserted to the toctree with the given prefix: generated/module.function_1 generated/module.function_2 ... Note: The file names contain the module:: or currentmodule:: prefixes. .. seealso:: autosummary_generate.py autolink role ------------- The autolink role functions as ``:obj:`` when the name referred can be resolved to a Python object, and otherwise it becomes simple emphasis. This can be used as the default role to make links 'smart'. :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. i˙˙˙˙N(t directives(tViewList(tnodes(taddnodes(t Directive(tModuleAnalyzert PycodeErrortautosummary_toccBseZRS((t__name__t __module__(((sI/usr/local/lib/python2.7/site-packages/sphinx/ext/autosummary/__init__.pyRIscs8|jj‰i‰d‡‡‡fd†‰ˆ|ƒdS(siInsert items described in autosummary:: to the TOC tree, but do not generate the toctree:: list. icsŔtˆ|ŁsN(tsphinx.ext.autodocR/R0R1tinspecttismoduletNonetget_documenterthasattrR-Rt _registrytvaluestcan_document_membertFalsetsort( tobjtparentR/R0R1tparent_doc_clst parent_docR5tclasses((sI/usr/local/lib/python2.7/site-packages/sphinx/ext/autosummary/__init__.pyR;…s $t AutosummarycBsneZdZdZdZeZeZie j d6e j d6e j d6Z d„Z d„Zd„Zd„ZRS( s™ Pretty table containing short signatures and summaries of functions etc. autosummary can also optionally generate a hidden toctree:: node. iR t nosignaturesttemplatecCs/|jj|jjjj|d|jƒƒdS(Ntline(twarningstappendtstatetdocumenttreportertwarningtlineno(Rtmsg((sI/usr/local/lib/python2.7/site-packages/sphinx/ext/autosummary/__init__.pytwarnźscCs×|jjjj|_}i|_g|_tƒ|_g|jD]D}|j ƒrAt j d|j ƒdƒrA|j ƒj ƒd^qA}|j |ƒ}|j|ƒ}d|jkrĚtj|jƒ}|jdj ƒ}g}xw|D]o\} } } } tj|| ƒ} tjtj|| ƒƒ} | |jkrL|jd| ƒn|j| ƒqęWtjƒ}||dtk rÎ|j d|ƒ|j |dd|fƒq1nXt ƒ|_ |} | j| dƒr| d | t | ƒd} nt| | ƒ|| ƒ} | jƒsg|j d |ƒ|j |dd|fƒq1n| jƒsŁ|j d |ƒ|j |dd|fƒq1ny)tj| jƒƒ| _| jjƒWn2tk r}| jjjd |ƒd| _nX| jƒ}|sd}n=td |t |ƒƒ}t|d|ƒ}|jddƒ}| jdƒt| j |j j!gƒƒ}x(|rŽ|dj"ƒ rŽ|j#dƒq‡Wx4t$|ƒD]&\}}|j"ƒsź|| }PqźqźWt%j&ddj'|ƒj"ƒƒ}|r%|j(dƒj"ƒ}n|r>|dj"ƒ}nd}|j ||||fƒq1W|S(s}Try to import the given names, and return a list of ``[(name, signature, summary_string, real_name), ...]``. i2t~it.i˙˙˙˙tprefixessfailed to import %sR2s::sfailed to parse name %ssfailed to import object %ss$[autodoc] module analyzer failed: %si t max_charst*s\*is^([A-Z].*?\.)(?:\s|$)t N()RMRNRXRtget_import_prefixes_from_envt startswithR^timport_by_namet ImportErrorRSRLRRYtlenR;t parse_namet import_objectRt for_moduletget_real_modnametanalyzertfind_attr_docsRRtdebugR:tformat_signaturetmaxtmangle_signatureR&t add_contentR"t process_doctdataR[tpopR R\R]Rdtgroup(RRhRRtRitmax_item_charsRlt display_nameRoRBRCtmodnamet full_namet documenterterrRmRutdoctitpiecetmRn((sI/usr/local/lib/python2.7/site-packages/sphinx/ext/autosummary/__init__.pyR_ăst   "            !csJtjƒ}d|di( RR(t paragraphRRLRMt nested_parseR Rtentry(t column_textsR(ttextRtvl(tbodyR(sI/usr/local/lib/python2.7/site-packages/sphinx/ext/autosummary/__init__.pyt append_rowTs   RBRHs:%s:`%s <%s>`\ %ss :%s:`%s <%s>`( Rttabular_col_specR!RttableRLttgrouptcolspecR'Ra(RRit table_specR¤t real_tableR‹R˘RlRmRnRot qualifiertcol1tcol2((RĄRsI/usr/local/lib/python2.7/site-packages/sphinx/ext/autosummary/__init__.pyR`Bs(      (RR t__doc__trequired_argumentstoptional_argumentsR@tfinal_argument_whitespaceR t has_contentRt unchangedtflagt option_specRSRqR_R`(((sI/usr/local/lib/python2.7/site-packages/sphinx/ext/autosummary/__init__.pyRGŤs     # _ic Csvtjdd|ƒjƒ}tjdd|ƒ}tjdd|ƒ}tjdd|ƒ}g}g}tjdƒ}x^|rŐ|j|ƒ}|sŚ|jdƒ}Pn|jd |jd ƒƒ|jd ƒd }qxWtd|d |d ƒ}|rn|sdtd|d |dƒ}qnt |ƒ|dd dkrn|dtd|d |t |ƒdd ƒ7}qnnd|S(s5Reformat a function signature to a more compact form.s ^\((.*)\)$s\1s\\\\R2s\\'s'[^']*'s^(.*, |)([a-zA-Z0-9_*]+)=s, iiiiţ˙˙˙Rus[%s]iis[, %s]u(%s)( R\tsubR[tcompileR]R^tinsertR‹t limited_joinR|(RmRutstargstoptstopt_reR•((sI/usr/local/lib/python2.7/site-packages/sphinx/ext/autosummary/__init__.pyR†ns,  #s...c CsŞ|j|ƒ}t|ƒ|kr%|Sd}d}xXt|ƒD]J\}}|t|ƒt|ƒ7}||t|ƒkr‡|d7}q>Pq>W|jt|| ƒ|gƒS(sĆJoin a number of strings to one, limiting the length to *max_chars*. If the string overflows this limit, replace the last fitting item by *overflow_marker*. Returns: joined_string ii(RdR|R R"( tsepRiRutoverflow_markertfull_strtn_charstn_itemsRtitem((sI/usr/local/lib/python2.7/site-packages/sphinx/ext/autosummary/__init__.pyRˇ‘s cCs„dg}|jjdƒ}|r4|jd|ƒn|jjdƒ}|r€|rm|jd|d|ƒq€|jd|ƒn|S(s` Obtain current Python import prefixes (for `import_by_name`) from ``document.env`` s py:moduleispy:classRsN(R:t temp_datatgetRś(RRtt currmodulet currclass((sI/usr/local/lib/python2.7/site-packages/sphinx/ext/autosummary/__init__.pyRxŞs cCs˘g}x||D]t}yM|r4dj||gƒ}n|}t|ƒ\}}}||||fSWq tk r€|j|ƒq Xq Wtddj|ƒƒ‚dS(s~Import a Python object that has the given *name*, under one of the *prefixes*. The first name that succeeds is used. Rssno module named %ss or N(Rdt_import_by_nameR{RL(RlRtttriedtprefixt prefixed_nameRBRCRŽ((sI/usr/local/lib/python2.7/site-packages/sphinx/ext/autosummary/__init__.pyRzžs  c Cs­yx|jdƒ}dj|d ƒ}|r€y5t|ƒtj|}t||dƒ||fSWq€tttfk r|q€Xnd}d}xxt t dt |ƒdƒƒD]W}|}dj|| ƒ}yt|ƒWntk rďqŹnX|tjkrŹPqŹqŹW|t |ƒkrcd}tj|}x'||D]}|}t||ƒ}q7W|||fStj|d|fSWn.t tttfk r¨} t| jŒ‚nXdS(s+Import a Python object given its full name.Rsi˙˙˙˙iiN(R^Rdt __import__tsystmodulestgetattrR{RtAttributeErrorR:treversedtrangeR|t ValueErrortKeyErrorRš( Rlt name_partsRŽtmodtlast_jRRCRBtobj_namete((sI/usr/local/lib/python2.7/site-packages/sphinx/ext/autosummary/__init__.pyRĆĎs>  &   cCsĚ|jjj}|jdƒjdƒd||||||ƒ}|dd} t|ƒ} y#t| d| ƒ\} } } }WnItk rÇ| d}tj ||dj ƒd|dƒ|dd6s8          &Ă #  ,