+
    WBi                        R t ^ RIHt ^ RIHtHtHtHtHtH	t	 ^ RI
Ht ^ RIHtHtHt ^ RIHt ^ RIHtHtHt ^ RIHtHt ^ RIHtHt ^ R	IHt ^ R
I H!t!H"t# ^ RI$H%t% ^ RI&H't' R t( ! R R]4      t)R t*]+R8X  d
   ]*! 4        R# R# )ap  
Filters Python code for use with Doxygen, using a syntax-aware approach.

Rather than implementing a partial Python parser with regular expressions, this
script uses Python's own abstract syntax tree walker to isolate meaningful
constructs.  It passes along namespace information so Doxygen can construct a
proper tree for nested functions, classes, and methods.  It understands bed lump
variables are by convention private.  It groks Zope-style Python interfaces.
It can automatically turn PEP 257 compliant that follow the more restrictive
Google style guide into appropriate Doxygen tags, and is even aware of
doctests.
)print_function)NodeVisitorparseiter_fieldsASTNameget_docstring)ArgumentParser)compile
IGNORECASE	MULTILINE)GeneratorType)argvstderrexit)basenamegetsize)linesepsep)
whitespace)BOM_UTF8open)compile_command)detectc                   a  V 3R lpV# )z/Implement the coroutine pattern as a decorator.c                 .   < S! V / VB p\        V4       V# )z>Automatically calls next() on the internal generator function.)next)argskwargs__crfuncs   *, 6/usr/lib/python3.14/site-packages/doxypypy/doxypypy.py__startcoroutine.<locals>.__start    s    T$V$T
     )r    r"   s   f r!   	coroutiner&      s    
 Nr$   c                   (  a a ] tR t^(t oRt]! R4      t]! R]4      t]! R4      t	]! R4      t
]! R4      t]! R]4      t]! R4      t]! R	]4      t]! R
]4      tR]! R]4      R]! R]4      R]! R]4      R]! R]4      R]! R]4      R]! R]4      R]! R]4      /t]! R]4      t]! R4      t]! R]4      t]! R]4      t]! R4      t]! R4      t]! R4      t]! R ]4      t]! R!4      t]! R"]4      t]! R#4      t]! R$4      t]! R%4      t]! R&4      t]! R'4      t ]! R(4      t!R)t"R* t#]$R+ 4       t%]$R, 4       t&]$]'R- 4       4       t(]'R@R. l4       t)]'R/ 4       t*RAR0 lt+]$R1 4       t,R2 t-R3 t.R4 t/R5 t0R6 t1R7 t2R8 t3R9 t4]4t5R: t6V 3R; lt7R< t8R= t9R> t:R?t;Vt<V ;t=# )B	AstWalkera  
A walker that'll recursively progress through an AST.

Given an abstract syntax tree for Python code, walk through all the
nodes looking for significant types (for our purposes we only care
about module starts, class definitions, function definitions, variable
assignments, and function calls, as all the information we want to pass
to Doxygen is found within these constructs).  If the autobrief option
is set, it further attempts to parse docstrings to create appropriate
Doxygen tags.
z^(\s*)\Sz^#z^\s*$z\s*([uUbB]*[rR]?(['\"]{3}))z\s*[uUbB]*[rR]?(['\"]{3})(.+)\1z`^(\s*)(?:zope\.)?(?:interface\.)?(?:module|class|directly)?(?:Provides|Implements)\(\s*(.+)\s*\)z^\s*class\s+(\S+)\s*\((\S+)\):zF^\s*class\s+(\S+)\s*\(\s*(?:zope\.)?(?:interface\.)?Interface\s*\)\s*:zU^(\s*)(\S+)\s*=\s*(?:zope\.)?(?:interface\.)?Attribute\s*\(['\"]{1,3}(.*)['\"]{1,3}\)z
 @author: z^(\s*Authors?:\s*)(.*)$z @copyright z^(\s*Copyright:\s*)(.*)$z @date z^(\s*Date:\s*)(.*)$z @file z^(\s*File:\s*)(.*)$z @version: z^(\s*Version:\s*)(.*)$z @note z^(\s*Note:\s*)(.*)$z
 @warning z^(\s*Warning:\s*)(.*)$zB^(\s*(?:(?:Keyword\s+)?(?:A|Kwa)rg(?:ument)?|Attribute)s?\s*:\s*)$zC^\s*(?P<name>\w+)\s*(?P<type>\(?\S*\)?)?\s*(?:-|:)+\s+(?P<desc>.+)$z^\s*(?:Return|Yield)s:\s*$z%^\s*(Raises|Exceptions|See Also):\s*$z)^\s*(([\w\.]+),\s*)+(&|and)?\s*([\w\.]+)$z^\s*([\w\.]+)\s*$z([\w\.]+),?\s*z^\s*(?:Example|Doctest)s?:\s*$z^\s*(([A-Z]\w* ?){1,2}):\s*$z4^\s*((?:\S+Error|Traceback.*):?\s*(.*)|@?[\w.]+)\s*$z=^\s*(?::param(eter)?|:arg(ument)?|:key(word)?)([^:]*):\s*(.*)z^(\s*)(?::type)\s*(\w*)\s*:(.*)z^(\s*)(?::rtype)\s*(.*):(.*)z^\s*(?::return)\s*(.*): (.*)$z^(.*)::$z^\s*=+\s+(=+\s*)+$z~~~~~~c                ,    Wn         W n        . V n        R# )z=Initialize a few class variables in preparation for our walk.N)linesr   docLines)selfr*   	argumentss   &&&r!   __init__AstWalker.__init__v   s    
	r$   c                v    \        V \        4      '       g   Q hV P                  RR4      P                  RR4      # )z>Take a string and returns the same without ands or ampersands.z and  z & )
isinstancestrreplace)inStrs   &r!   _stripOutAndsAstWalker._stripOutAnds|   s5     %%%%%}}Wc*225#>>r$   c                    \        V \        4      '       g   Q hV'       d'   RP                  \        V P	                  4       4      p RpW3# )z!Append end code marker if needed.z# @endcode{0}{1}F)r2   r3   formatr   rstrip)lineinCodeBlocks   &&r!   _endCodeIfNeededAstWalker._endCodeIfNeeded   s@     $$$$$%,,WdkkmDDK  r$   c              #     "    Rx w  rp^p^ pVP                  4       pRpVEf/   \        P                  P                  V4      pV'       d   VR8X  g	   V'       d   Rx w  rpVP                  4       pMVP	                  R4      '       d   RpMVP	                  R4      '       d   RpM \        V4      p	V	'       d/   W%,          P                  4       P	                  R4      '       d   RpM_Rx w  rpVP                  4       pVP	                  R4      '       d   RpM.V\        V,           ,          pVP                  4       pV^,          p W4,
          pEK3  V ^ ,          '       g/   V'       d'   RV ^ &   RP                  W%,          \        4      W%&   EK  V ^ ,          '       g   EK  VRJ g   EK  RV ^ &   RP                  W%,          \        4      W%&   EK    \        \        3 d    Rp L\         d    Rx w  rpTP                  4       p Li ; i5i)	z<Check whether or not a given line appears to be Python code.TNz...z>>>#Fz{0}{1}# @code{1}z{0}{1}# @endcode{1})stripr(   _AstWalker__errorLineREmatch
startswithr   r   SyntaxErrorRuntimeError	Exceptionr9   )
inCodeBlockObjr;   r*   lineNumtestLineNumcurrentLineNumtestLine
lineOfCoderC   compLines
   &         r!   _checkIfCodeAstWalker._checkIfCode   s     $) DKNzz|HJ$!//55h?8u#4,1(D#zz|H((//!%J((//!%J0#28#<#(=(C(C(E(P(PQT(U(U)-J490D#'::<D#u55-1
 (GdN :+3>>+; +q 0 ")!6!!$$$(q!(:(A(A))%  ""zU': %*q!(=(D(D))%' (6 +%*
$ 005,W#'::<0s   A
HH.HH%H)A G )H*0G H-G H#H+2H#H,&HH%H'H0HH
HHc              #  *  "   \        V\        4      '       d   \        V\        4      '       g   Q h. pRpRpR.pRpRpRp	R&p
^ p. pRpR&p^ pV P                  V4      p Rx w  ppV^ 8  d   TpVEe   V P                  P
                  '       Ed   \        P                  P                  4        F  w  ppVP                  V4      pV'       g   K!  V'       d    V P                  VR&,          V4      w  VR&&   pWV^ &   VP                  VV^,
          V34       . pTpVP                  VP                  ^4      V4      pRpK  	  V'       d   \        P                  P                  V4      pV'       g   \!        VP#                  V P                  P$                  4      4      \!        VP#                  V P                  P$                  4      P'                  4       4      ,
          pVV8:  d   RpEMVR&,          R8X  d   RVR&&   EMV'       d   \        P                  P                  V4      pV'       g   \!        VP#                  V P                  P$                  4      4      \!        VP#                  V P                  P$                  4      P'                  4       4      ,
          pVV8  dK   VV,
          ^8  d   R^V,
          V,           ,          pMRpVP)                  RV,           V,           4       EK  RpEM
V	'       Ed   \        P                  P                  V4      pV'       d   Rp	VP)                  RV,           4       EK  \        P*                  P                  V4      pV'       dF   V
^,           V8X  d   VP                  RR	4      pM$VP                  R
R4      pVP                  RR4      pV F0  pVV,          R8X  g   K  VRV R,           VV^,           R ,           pK2  	  VP)                  RV,           4       EK  \        P,                  P                  V4      pV'       dW   V P                  VR&,          V4      w  VR&&   pWV^ &   VP                  VP                  ^ 4      R4      P/                  4       pRpE	M\        P0                  P                  V4      pV'       d   VP                  VP                  ^ 4      R4      P/                  4       pRVP                  ^ 4      P3                  4       9   d   RpMRpV'       d    V P                  VR&,          V4      w  VR&&   pWV^ &   VP)                  RV,           4       EK  \        P4                  P                  V4      pV'       d   VP                  ^4      P7                  R4      pRP9                  V^,          V^ ,          V^,          VP                  ^4      4      pRpV'       d    V P                  VR&,          V4      w  VR&&   pVP)                  RV,           4       EK  \        P:                  P                  V4      pV'       d   RP9                  VP                  ^4      VP                  ^4      VP                  ^4      4      pV'       d    V P                  VR&,          V4      w  VR&&   pVP)                  RV,           4       EKL  \        P<                  P                  V4      pV'       du   RpRP9                  VP                  ^4      VP                  ^4      4      pV'       d    V P                  VR&,          V4      w  VR&&   pVP)                  RV,           4       EK  \        P>                  P                  V4      pV'       d   RP9                  VP                  ^4      VP                  ^4      VP                  ^4      4      pV'       d    V P                  VR&,          V4      w  VR&&   pVP)                  RV,           4       EK  \        P*                  P                  V4      pV'       d   Rp	\!        VP#                  V P                  P$                  4      4      \!        VP#                  V P                  P$                  4      P'                  4       4      ,
          pTp
. pVPA                  R4      pVR&8w  d4   VP)                  V^,           4       VPA                  RV^,           4      pK:  V^,          pRV,          RP9                  V4      ,           p\        PB                  P                  V4      pV'       dY   V'       gQ   RV9   d(   RP9                  VVPE                  4       \F        4      pEM5RP9                  VVPE                  4       4      pEM\        PH                  P                  V4      pV'       d   VP                  VP                  ^ 4      R4      P/                  4       pRVP                  ^4      P3                  4       9   d   RpMRpV P                  VR&,          V4      w  VR&&   pWV^ &   VP)                  RV,           4       E	K  \        PJ                  P                  V4      pV'       d   V'       g   . p\        PL                  PO                  V PQ                  VP                  ^ 4      4      4       F)  pVP)                  RP9                  VV\F        4      4       K+  	  RPS                  V4      R ,          pEM\        PT                  P                  V4      pV'       dv   VR&,          PW                  4       R8X  dZ   V P                  PX                  '       d>   RpRV^ &   VP                  VP                  ^ 4      R!P9                  \F        4      4      pEM\        PZ                  P                  V4      pV'       Ed   RpRp\!        VP#                  V P                  P$                  4      4      \!        VP#                  V P                  P$                  4      P'                  4       4      ,
          pVP                  VP                  ^ 4      R"P9                  VP                  ^4      4      4      pVR&,          R8X  d   RVR&&   V P                  VR&,          V4      w  VR&&   pWV^ &   VP)                  RV,           4       EKW  V'       d   \        P\                  P                  V4      pV'       d+   V'       g#   R#P9                  VVP                  ^ 4      4      pMV P                  PX                  '       d%   VP                  VVVV,
          34       V^ ,          pM@V P                  PX                  '       d%   VP                  VVVV,
          34       V^ ,          pV'       dG   V\!        V P^                  4      ^,
          8X  d&   R$P9                  VP/                  4       \F        V4      pR%P9                  VP/                  4       4      pV^ 8X  d
   RV,           pVP)                  VP                  R\F        ,           \F        4      4       MRpV'       g   EK  V'       d    V P                  VR&,          V4      w  VR&&   pWV^ &   VP                  VVV34       . pR&p^ pRpEK6  5i)'z
Run eternally, processing docstring lines.

Parses docstring lines as they get fed in via send, applies appropriate
Doxygen tags, and passes them along in batches for writing.
F TNr@   # @parr1   =-z =z -|z	 @return	z@return	attr
@property	z@param	z{} {} {} {}z#@param	z{}@n type of {}: {}z@return {} {}z{}@n return type of {}: {}z= zTable {}propertyz# {0}	{1[name]}{2}# {1[desc]}z {0}	{1[name]}	{1[desc]}seez@sa	z@exception	z# {0}	{1}{2}:   NNz @b Examples{0}# @codez	 @par {0}z {0}	{1}z{0}{1}# {2}z#{0})0r2   r3   r   rO   r   	autobriefr(   _AstWalker__singleLineREsitemssearchr=   sendr4   group_AstWalker__blanklineRErC   len
expandtabs	tablengthlstripappend_AstWalker__rst_tableRE_AstWalker__returnsStartREr:   _AstWalker__argsStartRElower_AstWalker__rst_paramRE
rpartitionr9   _AstWalker__rst_typeRE_AstWalker__rst_returnRE_AstWalker__rst_rtypeREfind_AstWalker__argsRE	groupdictr   _AstWalker__raisesStartRE_AstWalker__listRE_AstWalker__listItemREfindallr6   join_AstWalker__examplesStartRErA   autocode_AstWalker__sectionStartRE_AstWalker__singleListItemREr+   )r,   tailwriterr*   
timeToSendr<   rH   	inSectionin_literal_sectionin_rst_tablerst_table_start_line_numbertable_count!rst_table_middle_column_positionsprefixfirstLineNumsectionHeadingIndentcodeCheckerrI   r;   doxyTagtagRErC   indentcurrent_indentextra_indentposparam_declarationsitemList	itemMatchs   &&&                          r!   __alterDocstringAstWalker.__alterDocstring   s     $$$FM)J)JJJ
	"&(#,.) ''7"MGTa&99&&&*3*C*C*I*I*K %T 2 5$9=9N9N$)"I{:< 6b	;0;1-"KKw{E(JK$&E+2L#'<<A#HD)-J +L ! !* 7 7 = =d C$%(9L9L)M%N #DOODII4G4G$H$O$O$Q R&SF%)==,1	#(9#3 19E"I+ ) 7 7 = =d C$-0ATAT1U-V"%doodii6I6I&J&Q&Q&S"T.UN-0DD %35I$IQ#N36!n:LOc:c3dL35L %S<-?$-F G (16. & ) 7 7 = =d C +0L!LLt4$ !* 7 7 = =d C :Q>'I'+||C'= (,||D$'?'+||C'= $EC#CyC/'+DSzC'7$sQwx.'H $E S4Z0 %66<<TBE151F1F!"I{24.b	;,7q)#||EKKNLIPPR!, ) 7 7 = =d C #'<<A#C#J#J#LD%Q)=)=)??)6)3$9=9N9NuUWyZe9f 6b	;0;1-!LLt4$ ) 7 7 = =d C  27Q1J1J31O.#0#7#7 21 57I!7LN`abNcejepepqres$D &0F$9=9N9NuUWyZe9f 6b	;!LLt);<$ ) 6 6 < <T B #8#?#? %AAA$D  %9=9N9NuUWyZe9f 6b	;!LLt4$ ) 8 8 > >t D %0F#2#9#9%++a.%++VW.#YD$9=9N9NuUWyZe9f 6b	;!LLt4$ ) 7 7 = =d C #?#F#F %AAA$D  %9=9N9NuUWyZe9f 6b	;!LLt4$ ) 7 7 = =d C +/L-0ATAT1U-V"%doodii6I6I&J&Q&Q&S"T.UN:A7@B="&))D/C"%) A H Hq Q&*iicAg&> (1,K#&#7*:K:KK:X#XD ) 2 2 8 8 >   *V3'G'N'N$*EOO,=w(H (D'J'J$*EOO,=(? %.$=$=$C$CD$IE$'+||EKKNB'G'N'N'P#(EKKN,@,@,B#B-4F .<F9=9N9N$)"I{:< 6b	;4?q 1 %S4Z 8 ($-$6$6$<$<T$BE$[+-1:1G1G1O1OPTPbPbPUP[P[\]P^Q` 2aI$,OOO4J4J(.	75D %E2a (*wwx'8'<(1(C(C(I(I$(O#(U2Y__->#-E'+yy'9'9'926K8<N1$5+/<<A8P8W8WX_8`,bD -6,F,F,L,LT,RE',u1348	?B4??SWS\S\SfSfCg?h.1$//$))BUBU2V2]2]2_.`@a(</3||,1KKN,7,>,>u{{1~,N0* ,19+@8;E"IAEAVAV,1"I{BD(>b	;<Gq(9(-S4Z(@(0'-090L0L0R0RSW0X+03>3E3E06A4HD-1YY-?-?-?,7,<,<48%4;l4J12-. ;I:KK+/99+=+=+=,7,<,<48%4;l4J12-. ;I:KK
 Gs4=='9A'==(//wMD }}T[[]3a<:DT\\#-AB "
z-1-B-B59k-Z*E"I{$/q!\7E:;!"
s	  Bz:zzA0z&z/Bz&z-Cz:&z!Az%Az?A"z"A<zAz?A$z$A!zA z'Az/A z9z
A z+Az3A zDz#z+A6z"B<zz'B,z7zA$z1D
z<&z#z+=z)A z*+zB-z	zAzc              #     "    Rx w  rpW!,
          ^,           p\        V4      V8  d   VP                  R4       K#  W0P                  W^,           % KP  5i)z
Run eternally, dumping out docstring line batches as they get fed in.

Replaces original batches of docstring lines with modified versions
fed in via send.
NrR   )rd   rh   r+   )r,   r   lastLineNumr*   newDocstringLens   &    r!   __writeDocstringAstWalker.__writeDocstring  sI      05,Lu)81<Oe*.R ;@MM,a8s   AAc                l   \        V4      P                  p^ ;rVVR8w  d   VP                  ^,
          ;reRpV\        V P                  4      8  dG   V P                  V,          p\
        P                  P                  V4      pV'       d   MV^,          pK`  Tp	\
        P                  P                  V4      '       gh   V^,          pV\        V P                  4      8  dE   V P                  V,          pVP                  XP                  ^4      4      ^ 8  d   MV^,          pK^  V^,           p
V P                  Wi pV P                  W V n        V P                  '       d   \
        P                  P                  RV P                  ^ ,          4      V P                  ^ &   \
        P                  P                  RV P                  R,          4      V P                  R&   V P                  W P                  4       4      p\        V P                  4       F  pVP!                  V4       K  	  VP!                  \        V P                  4      ^,
          R34       V P"                  P$                  '       Ed#   ^ pV P                  '       d   V P                  ^ ,          P'                  R4      P)                  4       R8X  dO   V P                  ^  V P                  P+                  R4       V^,          pV\        V P                  4      8  g   K   \        V P                  4      ^8X  g   \        V P                  4      ^8  d   V P                  ^,          P)                  \,        R,           4      R8X  gC   V P                  ^,          P)                  \,        R,           4      P/                  R4      '       d   RP1                  V P                  ^ ,          P'                  R4      4      V P                  ^ &   \        V P                  4      ^8  d(   V P                  ^,          R8X  d   RV P                  ^&   V^ 8  d^   V P                  ^ ,          P'                  4       P/                  R4      '       g(   RV P                  ^ ,          ,           V P                  ^ &   V'       Ed7   \
        P2                  P                  V^ ,          4      pV'       d   VP                  ^4      MRpV P                   Uu. uF*  p\
        P4                  P                  VR,           V4      NK,  	  upV n        V P"                  P6                  '       d   V'       d   \9        R	P1                  VR
7      4      p\        V P                  4       FW  w  ppVP                  V4      pVf   K  VRVP;                  ^4       VVP=                  ^4      R ,           V P                  V&   KY  	  VR8w  Ed
   V	\        V P                  4      8  dM   \
        P2                  P                  V P                  V	,          4      pV'       d   VP                  ^4      MRpMRpVP?                  R. 4      ;'       g    . pV PA                  V4      pVR,          ^,          pVR8X  d   VR8X  g   VR,          ^,          R8X  d2   RP1                  VR,          PC                  4       \D        V4      VR&   EMV P"                  P$                  '       Ed   VR8X  Ed   \        V P                  4       F  w  ppRV9   g   K   M	  \        V P                  4      pV^ 8  Ed   RX9   Ed   VX8  d%   V^,          pRV P                  V,          9   g   K*   V^,          pV\        V P                  4      8  EdP   T
pRpV'       gq   V\        V P                  4      8  dW   \
        P2                  P                  V P                  V,          4      pV'       d   VP                  ^4      MRpV^,          pKx  V P                  VV  Uu. uF8  pRP1                  \D        V4      PG                  \D        \D        V,           4      NK:  	  ppVPI                  V4       . V P                  VV% VR,          P                  \D        R,           4      pV^ 8  d9   V P                  R;;,          VR,          VR ,          uu&   VR,          RV VR&   VR8w  d"   V P                  V,           V P                  Wj% V
# WP                  ,           V P                  Wj% V
# u upi u upi )z
Handle a docstring for functions, classes, and modules.

Basically just figures out the bounds of the docstring and sends it
off to the parser to do the actual work.

Return: last line number of this docstring
ModulerR   Nr@   @z## @brief {0}rS   z##z{istr}#+({istr}))istrcontainingNodes	interfaceFunctionDefz{0}{1}{1}{2}passClassDefrX   z{0}{1}z# @namespacer\   )%type__name__linenord   r*   r(   _AstWalker__docstrMarkerRErC   _AstWalker__docstrOneLineRErr   rb   r+   sub_AstWalker__alterDocstring_AstWalker__writeDocstring	enumeratera   r   r]   rg   rA   rh   r   rD   r9   _AstWalker__indentRE_AstWalker__newlineREequalIndentregexpCompilestartendget_getFullPathNamer:   r   r4   extend)r,   noder~   r   typeName
curLineNumstartLineNumr;   rC   docstringStart
endLineNumdefLinesdocstringConverterlineInfosafetyCounter	indentStrdocLineindentPartREindexdocIndentPartr   fullPathNamespace
parentTypefirstVarLineNumfirstVarLinelastVarLineNumindentLineNumvarLinesnamespaceLocs   &&&,                         r!   _processDocstringAstWalker._processDocstring  sQ    :&&$%%
x(,a7L3tzz?*::j)D..44T:E!OJ#**0066!OJs4::.zz*-99U[[^,1a
!^
 ::l;

>> ===(99==b>BmmA>N PDMM! ) : : > >r?C}}R?P!RDMM" "&!6!6++-"/%dmm4"''1 5##S%7!%;T$BC 99M---DMM!$4$;$;C$@$F$F$HB$NMM!$$$R(" C$664==!Q&3t}}+=+Ba &&zC'78B>MM!$**:+;<GGLL#2#9#9$--:J:Q:QRU:V#Wa t}}%)dmmA.>(.J'*DMM!$ q q)9)@)@)B)M)Md)S)S#'$--*:#:a 8 ((..x{;E*/ARI,0MM;,9 '2266y3P,9;DMyy$$$,-?-F-FI-F-VW(1$--(@$UG$0$6$6w$?M$,  ,33JM4G4G4J+KgVcVgVghiVjVkNl+lDMM%( )A xDJJ/!,,224::n3MN.3EKKN		$jj):B?EE2O $ 5 5o F*2.q1J[(X-F#B'*k9188"9L9L9N9@) M$$$Z)? 6?t}}5M1O\$4 6N "%T]]!3!A%-<*G(?:&!+(DMM.,II!"a'N&T]]);;(2$&	"+DJJ0O$-$8$8$>$>tzz-?X$YE:?ARI)Q.M 48==(74I$J4I %-OOGW$E$M$M$+Wy-@%B4I ! $J !1IKo~F (0|'8'8>9Q'R'1, MM"-"lm1LL-+3B<+FHRL
 x37==83KDJJ|0  4<mm3KDJJ|0O;f$Js   ,0d,">d1c                    \        V \        4      '       g   Q hRpV P                  R4      '       g5   V P                  R4      '       d   RpV# V P                  R4      '       d   RpV# )ad  
See if a member name indicates that it should be private.

Private variables in Python (starting with a double underscore but
not ending in a double underscore) and bed lumps (variables that
are not really private but are by common convention treated as
protected because they begin with a single underscore) get Doxygen
tags labeling them appropriately.
N__private_	protected)r2   r3   endswithrD   )namerestrictionLevels   & r!   _checkMemberNameAstWalker._checkMemberName  sf     $$$$$}}T""t$$#,    %%#. r$   c                    V P                  VP                  4      pV'       d   RP                  V\        V4      pV# TpV# )z
Mark up members if they should be private.

If the name indicates it should be private or protected, apply
the appropriate Doxygen tags.
z{0}{1}# @{2})r   r   r9   r   )r,   r   
contextTagr   workTags   &&&  r!   _processMembersAstWalker._processMembers  sG      00;$++J,3,<>G
  !Gr$   c                4   \        V4       F  w  r4\        V\        4      '       d=   V F4  p\        V\        4      '       g   K  V P	                  WRR,          R7       K6  	  KW  \        V\        4      '       g   Ko  V P	                  WBR,          R7       K  	  R# )a  
Extract useful information from relevant nodes including docstrings.

This is virtually identical to the standard version contained in
NodeVisitor.  It is only overridden because we're tracking extra
information (the hierarchy of containing nodes) not preserved in
the original.
r   r   N)r   r2   listr   visit)r,   r   r   fieldvalueitems   &&,   r!   generic_visitAstWalker.generic_visit  sp     (-LE%&&!D!$,,

4@Q9R
S " E3''

59J2K
L .r$   c                    VP                  R. 4      pRVP                  P                  ,           p\        WV P                  4      pV! WR7      # )a  
Visit a node and extract useful information from it.

This is virtually identical to the standard version contained in
NodeVisitor.  It is only overridden because we're tracking extra
information (the hierarchy of containing nodes) not preserved in
the original.
r   visit_r   )r   	__class__r   getattrr   )r,   r   r   r   methodvisitors   &&,   r!   r   AstWalker.visit  sF     !**%6;DNN333$(:(:;t==r$   c                r    \        V\        4      '       g   Q hV P                  P                  R3.V,           # )z
Return the full node hierarchy rooted at module name.

The list representing the full path through containing nodes
(starting with the module itself) is returned.
module)r2   r   r   r   )r,   r   s   &&r!   r   AstWalker._getFullPathName  s4     /40000,,h78?JJr$   c                   VP                  R. 4      pV P                  P                  '       d?   \        P                  ! RP                  V P                  P                  \        4      4       \        V4      '       dk   V P                  P                  '       d<   V P                  V4      pRP                  R V 4       4      pRP                  V4      pMRpV P                  W4       V P                  WR7       R# )	z
Handle the module-level docstring.

Process the module-level docstring and create appropriate Doxygen tags
if autobrief option is set.
r   z# Module {0}{1}.c              3   2   "   T F  q^ ,          x  K  	  R# 5i    Nr%   .0	pathTuples   & r!   	<genexpr>)AstWalker.visit_Module.<locals>.<genexpr>  s     %VDUyllDU   @namespace {0}rR   r   N)r   r   debugr   writer9   r   r   r   topLevelNamespacer   ry   r   r   )r,   r   r   r   r   r   r~   s   &&,    r!   visit_ModuleAstWalker.visit_Module  s     !**%6;99???LL*11$))2M2M29; <yy***$($9$9/$J! XX%VDU%VV
'..z:""4.4Ar$   c                l   VP                   ^,
          p\        P                  P                  V P                  V,          4      pV'       d   RP                  VP                  ^4      VP                  ^4      \        VP                  ^4      V P                  V,          P                  4       4      V P                  V&   V P                  P                  '       d<   \        P                  ! RP                  VP                  ^ ,          \        4      4       \        VP                  ^ ,          \        4      '       d   \        P                   P                  V P                  V,          4      pV'       d   VP                  ^4      MRpV P#                  VP                  ^ ,          P$                  4      pV'       da   RP                  VVP                  ^ ,          P$                  \        VV P                  V,          P                  4       4      V P                  V&   V P'                  WR,          R7       R# )aE  
Handle assignments within code.

Variable assignments in Python are used to represent interface
attributes in addition to basic variables.  If an assignment appears
to be an attribute, it gets labeled as such for Doxygen.  If a variable
name uses Python mangling or is just a bed lump, it is labeled as
private for Doxygen.
z?{0}## @property {1}{2}{0}# {3}{2}{0}# @hideinitializer{2}{4}{2}z# Attribute {0.id}{1}rR   z;{0}## @var {1}{2}{0}# @hideinitializer{2}{0}# @{3}{2}{4}{2}r   r   N)r   r(   _AstWalker__attributeRErC   r*   r9   rb   r   r:   r   r   r   r   targetsr2   r   r   r   idr   )r,   r   r   rI   rC   r   r   s   &&,    r!   visit_AssignAstWalker.visit_Assign	  s    ++/ ''--djj.AB#117KKNKKNKKNJJw'..02 JJw yy4;;DLLO<CE Fdll1ot,,((..tzz'/BCE*/ARI#44T\\!_5G5GH'>>Df!Q**(

7+224? 

7# 	48I1JKr$   c                <   VP                   ^,
          p\        P                  P                  V P                  V,          4      pV'       d   RP                  VP                  ^4      VP                  ^4      \        V P                  V,          P                  4       4      V P                  V&   V P                  P                  '       d:   \        P                  ! RP                  VP                  ^4      \        4      4       V P                  WR,          R7       R# )z
Handle function calls within code.

Function calls in Python are used to represent interface implementations
in addition to their normal use.  If a call appears to mark an
implementation, it gets labeled as such for Doxygen.
z!{0}## @implements {1}{2}{0}{3}{2}z# Implements {0}{1}r   r   N)r   r(   _AstWalker__implementsRErC   r*   r9   rb   r   r:   r   r   r   r   r   )r,   r   r   rI   rC   s   &&,  r!   
visit_CallAstWalker.visit_Call3  s     ++/ ((..tzz'/BC"E"L"LAA

7#**,#.DJJw yy299%++a.:AC D 	48I1JKr$   c                   V P                   P                  '       d+   \        P                  ! RP	                  V\
        4      4       VP                  '       Ed   \        P                  P                  V P                  VP                  ^,
          ,          4      pV'       d   VP                  ^4      MRp\        VP                  ^ ,          RR4      R8X  d   VRP	                  VP                  4      ,           \
        ,           V,           R,           \
        ,           V P                  VP                  ^,
          ,          ,           V P                  VP                  ^,
          &   \        VP                  ^ ,          RR4      R	8X  d\   VR,           \
        ,           V P                  VP                  ^,
          ,          ,           V P                  VP                  ^,
          &   VP                  R
4      ;'       g    . pVP!                  VP                  R34       V P                   P"                  '       dM   V P%                  V4      pRP'                  R V 4       4      pV P)                  W4      pRP	                  V4      p	MV P)                  VR4      p	\+        V4      '       dA   V P-                  WVR7      p
V P                   P.                  '       d   V P1                  W4       V P3                  WR7       VP5                  4        R# )z
Handle function definitions within code.

Process a function's docstring, keeping well aware of the function's
context and whether or not it's part of an interface definition.
z# Function {0.name}{1}rR   r  NrY   z{} = propertyz## \privaterW   setterr   functionr   c              3   2   "   T F  q^ ,          x  K  	  R# 5ir   r%   r   s   & r!   r   .AstWalker.visit_FunctionDef.<locals>.<genexpr>f       !R@Q9A,,@Qr   r   r   )r   r   r   r   r9   r   decorator_listr(   r   rC   r*   r   rb   r   r   r   rh   r   r   ry   r   r   r   keepDecorators!_shift_decorators_below_docstringr   pop)r,   r   r   rC   r   r   r   r   modifiedContextTagr~   last_doc_line_numbers   &&,        r!   visit_FunctionDefAstWalker.visit_FunctionDefI  sQ    99???LL188wGH ((..tzz$++//JKE*/ARIt**1-tT:jH.7/:P:PQUQZQZ:[.[/'/(*8/9;B/CEIZZPTP[P[^_P_E`/a

4;;?+t**1-vt<H.7..H7.RUYU_U_`d`k`kno`oUp.p

4;;?+ !**%67==2		:6799&&& $ 5 5o F!R@Q!RRJ!%!5!5d!G#**+=>D''b1D#'#9#9O $: $= yy'''66tR 	4Ar$   c                   VP                   ^,
          pVP                  R4      ;'       g    . pV P                  P                  '       g   V P                  V,          p\
        P                  P                  V4      pV'       dP   VP                  ^4      R8X  d:   VRVP                  ^4       WVP                  ^4      R ,           V P                  V&   \
        P                  P                  V P                  V,          4      pV'       de   V P                  P                  '       d+   \        P                  ! RP                  V\         4      4       VP#                  VP$                  R34       McV P                  P                  '       d+   \        P                  ! RP                  V\         4      4       VP#                  VP$                  R34       V P                  P&                  '       d<   V P)                  V4      pRP+                  R	 V 4       4      pR
P                  V4      p	MRp	V'       d(   RP                  V	\         VP                  ^4      4      pMT	pV P-                  W4      p\/        V4      '       dA   V P1                  WVR7      p
V P                  P2                  '       d   V P5                  W4       V P7                  WR7       VP9                  4        R# )aC  
Handle class definitions within code.

Process the docstring.  Note though that in Python Class definitions
are used to define interfaces in addition to classes.
If a class definition appears to be an interface definition tag it as an
interface definition for Doxygen.  Otherwise tag it as a class
definition for Doxygen.
r   objectNz# Interface {0.name}{1}r   z# Class {0.name}{1}classr   c              3   2   "   T F  q^ ,          x  K  	  R# 5ir   r%   r   s   & r!   r   +AstWalker.visit_ClassDef.<locals>.<genexpr>  r  r   r   rR   z{0}{1}# @interface {2}r   )r   r   r   object_respectr*   r(   _AstWalker__classRErC   rb   r   r   _AstWalker__interfaceREr   r   r   r9   r   rh   r   r   r   ry   r   r   r   r  r  r   r  )r,   r   r   rI   r   r;   rC   r   r   r~   r  s   &&,        r!   visit_ClassDefAstWalker.visit_ClassDefw  s+    ++/
 !**%67==2yy''' ::g&D''--d3E;;q>X-*.A*?$yyQR|}BU*UDJJw'''--djj.AByy6==dGLM""DII{#;<yy299$HI""DIIw#7899&&& $ 5 5o F!R@Q!RRJ#**:6DD 1889@9>QIJ J))$;
#'#9#9/ $: $C yy'''66tR4Ar$   c                .   < \         \        V `  V4       R# )z(Handle constant definitions within code.N)superr(   visit_Constant)r,   r   r   r   s   &&,r!   r&  AstWalker.visit_Constant  s    i-d3r$   c                   VP                   '       dm   VP                    FZ  pVP                  ^,
          pV^,
          pV P                  V^,           V V P                  V,          .,           V P                  WE% K\  	  R# R# )r[   N)r  r   r*   )r,   r   r  	decoratororg_line_numbernew_line_numbers   &&&   r!   r  +AstWalker._shift_decorators_below_docstring  ss     "00	"+"2"2Q"6"6":>Bjj[\I\]l>mzz/23?4

?;	 1	 r$   c                    \        RP                  V P                  4      V P                  P                  4      pV P                  V4       R# )zAForm an AST for the code and produce a new version of the source.rR   N)r   ry   r*   r   filenamer   )r,   inAsts   & r!   
parseLinesAstWalker.parseLines  s1    bggdjj)499+=+=>

5r$   c                P    \         P                  ! R V P                   4       4      # )z<Return the modified file once processing has been completed.c              3   @   "   T F  qP                  4       x  K  	  R # 5i)N)r:   )r   r;   s   & r!   r   %AstWalker.getLines.<locals>.<genexpr>  s     AjdKKMMjs   )r   ry   r*   )r,   s   &r!   getLinesAstWalker.getLines  s     ||AdjjAAAr$   )r   r+   r*   )rR   N)rR   )>r   
__module____qualname____firstlineno____doc__r   r   r   r   rc   r   r   r   r	  r   r!  r  r^   rk   rs   rj   ru   rv   r}   rw   rz   r|   rB   rm   ro   rq   rp   !_AstWalker__rst_literal_sectionREri    _AstWalker__LITERAL_SECTION_MARKr.   staticmethodr6   r=   r&   rO   r   r   r   r   r   r   r   r   r   r  r
  r  visit_AsyncFunctionDefr"  r&  r  r0  r5  __static_attributes____classdictcell____classcell__)r   __classdict__s   @@r!   r(   r(   (   s    
 {+Jy1K!(+M$%CD%&HI" $L $./N ?@I! #89CEM " #N #-.M 	m$>
K&A:N=!7D=!7D}%>
K=!7Dm$=zJO " #/0:<M  9 :H$%BJO#$L$.0OIJH&';< !23L%&G&02$%DE ""Y",.M ""bcM  "5 6L!"ABM"#CDN+K8!"78M% ? ?
 ! ! 9  9v r# r#h	 A AWr    & M">KB,(LTL,+X /:@4
4B Br$   r(   c                    R p V ! 4       p\        \        VP                  4      ^ 4      p\        VP                  R4      P	                  V4      p\        V4      pVR,          ;'       g    RpVP                  \        4      '       d   RpVP                  R4      '       d   RpMVP                  R4      '       d   RpVR8X  d   \        VP                  4      pM\        VP                  VR7      pVP                  4       pVP                  4        \        Wq4      pVP                  4        VP                  4       P                  \        4       F  p	\!        V	P#                  4       4       K  	  R	# )
zn
Start it up.

Starts the parser on the file given by the filename as the first
argument on the command line.
c            
        \        \        ^ ,          4      p \        V RR7      pVP                  RRR7       VP                  RRRR	R
R7       VP                  RRRRRR7       VP                  RRR\        RRR7       VP                  RRR\
        R^RR7       VP                  RRRRRR7       VP                  RR RR!R"R7       VP                  R#R$RR%R&R7       VP                  R'R(RR)R*R7       VP                  R+4      pVP                  R,R-RR.R/R7       VP                  4       pVP                  '       g-   \        P                  ! R0\        ,           4       \        R54       VP                  P                  \        R14      R2R6 pTpVP                  '       d'   VP!                  VP                  4      pV^ 8  d   WFR2 pVP"                  '       d   VP                  R3R44      pWSn        V# )7a  
Parse command line options.

Generally we're supporting all the command line options that doxypy.py
supports in an analogous way to make it easy to switch back and forth.
We additionally support a top-level namespace argument that is used
to trim away excess path information.
z%(prog)s [options] filename)progusager.  zInput file name)helpz-az--autobrief
store_truer]   z@parse the docstring for @brief description and other information)actiondestrG  z-cz
--autocoder{   z$parse the docstring for code samplesz-nz--nsstorer   z=specify a top-level namespace that will be used to trim paths)rI  r   rJ  rG  z-tz--tablengthrf   z<specify a tab length in spaces; only needed if tabs are used)rI  r   rJ  defaultrG  z-sz--stripinit	stripinitzstrip __init__ from namespacez-Oz--object-respectr  zBy default, doxypypy hides object class from class dependencieseven if class inherits explictilty from objects (new-style class),this option disable this.z-ez--equalIndentr   zPMake indention level of docstrings matching with their enclosingdefinitions one.z-kz--keepDecoratorsr  a  Decorators are usually ignored by doxypypy and thus are before thedoxygen docString output and not before it's definition string.With this option decorators are kept before it's definition string(function or class names). But this requires dogygen 1.9 or higher.zDebug Optionsz-dz--debugr   zenable debug output on stderrzNo filename given.r   Nz	.__init__rR   r\   )r   r   r	   add_argumentr3   intadd_argument_group
parse_argsr.  r   r   r   sysExitr4   r   r   rr   rM  r   )rE  parserrb   r   r   realNamespacenamespaceStarts          r!   argParsemain.<locals>.argParse  sD    Q T&CE 	" 	 	
 	-kS 	 	

 	,j7 	 	

 	&+>P 	 	

 	-;O 	 	

 	-k0 	 	

 	$&6- 	 	
 	/m$ 	 	
 	$&6W 	 	
 ))/:)g0 	 	
   " }}}LL-78BK !MM11#s;CR@)!!!.33D4J4JKN" 1/ B>>>)11+rBM!.r$   rbencodingasciiz	UTF-8-SIGzUTF-16zUTF-32)rZ  N)minr   r.  r   readr   rD   r   
codecsOpen	readlinescloser(   r0  r5  splitr   printr:   )
rW  r   numOfSampleBytessampleBytessampleByteAnalysisrZ  inFiler*   	astWalkerr;   s
             r!   mainrh    s*   Zz :D 74==126t}}d+001ABK,!*-88H h''8$$			X	&	& 7dmm$DMMH=E
LLN%&I ""$**73dkkm 4r$   __main__N),r:  
__future__r   astr   r   r   r   r   r   argparser	   rer
   r   r   r   typesr   sysr   r   r   rS  os.pathr   r   osr   r   stringr   codecsr   r   r^  codeopr   chardetr   r&   r(   rh  r   r%   r$   r!   <module>rv     sj    & I I # > >  - - %   / " iB iBXDP zF r$   