;ò
¹0sDc           @   s  d  Z  d k Z d k Z d k Z d k Z d k Z d f  d „  ƒ  YZ e d „ Z d „  Z	 d „  Z
 e d „ Z d d	 „ Z e d
 j ou d k Z d GHx e i D] Z d Ge GHq¡ We i d Z e g  j o e i d ƒ n x e D] Z e e ƒ qæ Wn d S(   sl   
This grabs various Python class, method and function
headers and their doc strings to include in documents
Ns   Structc           B   s   t  Z RS(   N(   s   __name__s
   __module__(    (    (    sH   /home/packages/reportlab/reportlab_2_0/reportlab/tools/docco/codegrab.pys   Struct   s   c         C   só  | o | g } n
 t i } t i |  d ƒ } t | ƒ d j o€ | d } t
 i | | ƒ } | p t d | ‚ | \ } }	 } t t i i t |	 g | d d !ƒ ƒ } | d }  | g } n t
 i |  | ƒ } | p t d |  ‚ | \ } } } t
 i |  | | | ƒ } t | d ƒ i ƒ  } t t i | ƒ } t ƒ  } g  | _  g  | _! | i" | _# xŠt$ | ƒ D]|} t& | | ƒ } t( | ƒ t) i* j oö t i i | i+ i, ƒ \ } } t i i- | ƒ \ } } | |  j o¯ | } t ƒ  } | | _% t2 | | ƒ | _3 | i" o t4 | i" ƒ | _# n
 d | _# | d d !d	 j o d
 | _5 n( | d d j o d | _5 n
 d | _5 | i  i6 | ƒ qçqkt( | ƒ t) i7 j oE| i8 |  j o1t ƒ  } | | _% | i" o t4 | i" ƒ | _# n
 d | _# g  | _: x$ | i; D] } | i: i6 | i= ƒ q W| d d !d	 j o d
 | _5 n( | d d j o d | _5 n
 d | _5 g  | _> | i? i@ ƒ  } | iA ƒ  xE| D]=\ } }
 t( |
 ƒ t) i* j o qŽqŽt i i- |
 i+ i, ƒ d |  j o qŽqŽt ƒ  } | | _% |
 i+ iE } t2 |
 | ƒ | _3 | | j o, d | | _# t iG | i3 | | ƒ | _3 n* |
 i" o t4 |
 i" ƒ | _# n
 d | _# | d d !d	 j o d
 | _5 n( | d d j o d | _5 n
 d | _5 | i> i6 | ƒ qŽW| i! i6 | ƒ qçqkqkW| Sd S(   s¹   Returns two tuple of (functions, classes) defined
    in the given module.  'directory' must be the directory
    containing the script; modulename should not include
    the .py suffixs   .i   i    s   Package %s not foundiÿÿÿÿs   Module %s not founds   rs   (no documentation string)s   _s   privates
   0123456789s   experimentals   officials   pointer to N(H   s	   directorys
   searchpaths   syss   paths   strings   splits
   modulenames   wordss   lens   packagenames   imps   find_modules   packagefounds   AssertionErrors   files   packagepaths   descriptions   applys   oss   joins   tuples   founds   pathnames   load_modules   mods   opens	   readliness   liness   maps   rstrips   Structs   results	   functionss   classess   __doc__s   docs   dirs   names   getattrs   values   types   typess   FunctionTypes	   func_codes   co_filenames   splitexts   roots   exts   funcObjs   fns   getFunctionPrototypes   protos   dedents   statuss   appends	   ClassTypes
   __module__s   cls   basess	   __bases__s   bases   __name__s   methodss   __dict__s   itemss   sorts   key2s   value2s   meths   co_names   name2s   replace(   s
   modulenames	   directorys   cls   key2s   results   files   meths   descriptions   fns   packagepaths   value2s   packagenames   funcObjs   packagefounds   bases   name2s   wordss   paths   mods
   searchpaths   names   roots   liness   values   exts   pathnames   itemss   found(    (    sH   /home/packages/reportlab/reportlab_2_0/reportlab/tools/docco/codegrab.pys   getObjectsDefinedIn   s¬     	
)
			 		
				
		
 		
 #		
		c         C   s½   |  i i d } | } d } xy n oq | | } xD | D]< } | d j o | d } q7 | d j o | d } q7 q7 W| d j o Pq | d } q& W| | | d !} t
 i | d ƒ Sd S(   sd   Pass in the function object and list of lines;
    it extracts the header as a multiline text block.i   i    s   (s   )s   
N(   s   fs	   func_codes   co_firstlinenos   firstLineNos   lineNos   bracketss   liness   lines   chars   usefulLiness   strings   join(   s   fs   liness   bracketss   chars   usefulLiness   lineNos   lines   firstLineNo(    (    sH   /home/packages/reportlab/reportlab_2_0/reportlab/tools/docco/codegrab.pys   getFunctionPrototype   s$      
 c         C   sõ   t  i |  d ƒ } t | ƒ d j  o t t  i | ƒ } n§ d } x1 | d D]% } | t  i
 j o | d } qL PqL Wg  } xc | D][ } xE t t t | ƒ | ƒ ƒ D]( } | d t  i
 j o | d } q¤ q¤ W| i | ƒ q‚ Wt  i | d ƒ Sd S(   s•   Attempts to dedent the lines to the edge. Looks at no.
    of leading spaces in line 2, and removes up to that number
    of blanks from other lines.s   
i   i    i   N(   s   strings   splits   comments   commentLiness   lens   maps   lstrips   cleaneds   spcs   chars
   whitespaces   lines   ranges   mins   is   appends   join(   s   comments   commentLiness   chars   is   cleaneds   lines   spc(    (    sH   /home/packages/reportlab/reportlab_2_0/reportlab/tools/docco/codegrab.pys   dedent£   s&        c         C   sà   t  |  | ƒ } d GHd G|  d GHd GHH| i g  j o	 d GHn. d GHx% | i D] } | i GHd | i GHqO W| i g  j o	 d GHnW d	 GHxN | i D]C } | i
 GHd | i GHx% | i D] } | i GHd
 | i GHq¹ WHq• Wd S(   sF   Test support.  Just prints docco on the module
    to standard output.s-   codegrab.py - ReportLab Documentation Utilitys   documentings   .pys7   -------------------------------------------------------s   No functions founds
   Functions:s       s   No classes founds   Classes:s           N(   s   getObjectsDefinedIns
   modulenames	   directorys   doccos	   functionss   fs   protos   docs   classess   cs   names   methodss   m(   s
   modulenames	   directorys   cs   fs   ms   docco(    (    sH   /home/packages/reportlab/reportlab_2_0/reportlab/tools/docco/codegrab.pys   dumpDoc¼   s2     	
 	
 
 s   reportlab.platypus.paragraphc         C   s   t  |  ƒ d  S(   N(   s   dumpDocs   m(   s   m(    (    sH   /home/packages/reportlab/reportlab_2_0/reportlab/tools/docco/codegrab.pys   testØ   s    s   __main__s   Path to search:s      i   (   s   __doc__s   imps   typess   strings   oss   syss   Structs   Nones   getObjectsDefinedIns   getFunctionPrototypes   dedents   dumpDocs   tests   __name__s   paths   lines   argvs   Ms   appends   m(   s   dedents   strings   ms   getFunctionPrototypes   Ms   syss   imps   tests   getObjectsDefinedIns   lines   dumpDocs   oss   typess   Struct(    (    sH   /home/packages/reportlab/reportlab_2_0/reportlab/tools/docco/codegrab.pys   ?   s.   					z			
  