*ë
·ó <c       sA    d  Z     h  d d <d d <d d <d d <d	 d
 <d d <d d <d d <Z 1 y 2 e d i d ƒ d Z Wn 3 4 d Z n X9 d k Z : y ; d k l Z Wn < = d k l Z n XC d k l Z I d f  d „  ƒ  YZ o e i	 d ƒ i
 e i	 d ƒ i d „ Z ó d e f d „  ƒ  YZ d S(   s*   Parse comment information from a module.

s   $RCSfile: parsecomments.py,v $s   module_namesB   $Id: parsecomments.py,v 1.2 2001/11/25 13:35:51 doughellmann Exp $s   rcs_ids    Doug Hellmann <doug@hellfly.net>s   creators   UNSPECIFIEDs   projects   Sat, 27-Oct-2001 17:49:02 EDTs   createds   $Author: doughellmann $s   authors   $Revision: 1.2 $s   versions   $Date: 2001/11/25 13:35:51 $s   dates    i   s   0.0N(   s   StringIO(   s   StreamFlushTests
   ParseStackc      sV   I d  Z  J L d „  Z Q d „  Z \ d „  Z b d „  Z f d „  Z j d „  Z RS(   s;   Helper class for 'extractComments' function in this module.c    s   L M N g  |  _ O d Sd S(   s   Create a ParseStack.N(   s   selfs   data(   s   self(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/parsecomments.pys   __init__L s   c    sh   Q V W x8 W |  i o | |  i d d j o X |  i ƒ  q WY |  i i | | f ƒ Z d Sd S(   s™   Push a new 'name' onto the stack.

        Smartly determine, based on 'indent', whether to 'pop' other
        'names' before pushing this one.
        i   N(   s   selfs   datas   indents   pops   appends   name(   s   selfs   names   indent(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/parsecomments.pys   pushQ s    &c    s<   \ ] ^ |  i d \ } } _ |  i d  |  _ ` | Sd S(   s*   Remove the top of the stack and return it.i   N(   s   selfs   datas   items   indent(   s   selfs   indents   item(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/parsecomments.pys   pop\ s   c    s    b c d t  d „  |  i ƒ Sd S(   sE   Return a list of the names as they appear on the stack, bottom first.c    s   d |  d S(   Ni    (   s   x(   s   x(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/parsecomments.pys   <lambda>d s    N(   s   maps   selfs   data(   s   self(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/parsecomments.pys   __namesb s   c    s#   f g h t  i |  i ƒ  d ƒ Sd S(   s   Create a string representation.s   :N(   s   strings   joins   selfs   _ParseStack__names(   s   self(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/parsecomments.pys   __str__f s   c    s   j k l t  |  i ƒ  ƒ Sd S(   s.   Return a value to be used as a dictionary key.N(   s   tuples   selfs   _ParseStack__names(   s   self(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/parsecomments.pys   keyj s   (   s   __doc__s   __init__s   pushs   pops   _ParseStack__namess   __str__s   key(    (    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/parsecomments.pys
   ParseStackI s   	s   ^((?P<blankline>\s*$)|(?P<namedobj>(?P<indent>\s*)(?P<nametype>(class|def))\s+(?P<name>[0-9A-Za-z_]+))|(?P<commentline>\s*#+(?P<comment>.*)))s   \s*[+-=#][ +-=#]*\s*$c    s   o ~  t  }  h  } ƒ d } „ t ƒ  } … t  }	 ‡ t |  ƒ } ˆ | i
 ƒ  } ‰ xf‰ | o[‹ | | ƒ } Œ | o | i ƒ  } ‘ | d } ’ | d } “ | d } ” | d } • | d o t | d ƒ p d }
 — | d o | o ˜ d	 } n š | o3 œ | o | | ƒ o ž d
 | | f } n nR  | o | oy ¢ |	 o3 ¨ | | | i ƒ  <ª | i | |
 ƒ ­ d } n9 ± | i | |
 ƒ µ | | | i ƒ  <¶ d } · t  }	 nÈ ¹ | o  À | }	 Á | i | |
 ƒ nž Ã | oY È | o |	 o2 É | i | t  ƒ o Í | | | i ƒ  <n n Ò t  }	 Ó d } n; Õ |	 o | o) Ú | | | i ƒ  <Û d } Ü t  }	 n n á t  }	 â d } ä | i
 ƒ  } qZ Wæ | i ƒ  è |	 o | o ì | | | i ƒ  <n ð | Sd S(   s3  Given a block of Python source, extract the comments.

    The comment text is associated with nearby named objects
    (functions, methods, classes, etc.).  This function returns
    a dictionary of names and the associated comment text.

    Arguments

      text -- The Python source to be scanned.

    s    s   comments   names   nametypes	   blanklines   indenti    s   commentlines    s   %s%s
N(   s   Nones   dbgs   comment_infos   comment_texts
   ParseStacks   parse_stacks   current_names   StringIOs   texts   fs   readlines   lines	   extractRes	   match_objs	   groupdicts
   match_dicts   comments   names   nametypes	   blanklines   lens   indents   ignoreRes   keys   pushs   gets   close(   s   texts	   extractRes   ignoreRes   names	   blanklines   lines   comment_infos   nametypes   parse_stacks   current_names   indents   dbgs   fs	   match_objs   comment_texts   comments
   match_dict(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/parsecomments.pys   extractCommentso sh   				 

%

	
	
				s   ParseCommentsTestc      s   ó õ d „  Z   d „  Z RS(   Nc    s}   õ ö t  d d ƒ i ƒ  } ÷ t | ƒ } ø h  d d f <d d d f <} ü t o! | | j p t d t | ƒ ‚ d  S(   Ns!   TestCases/test_ignore_comments.pys   rts£    
 This class is documented only with comments.
 
 Any documentation which appears for this class with the
 comment flag set to ignore comments indicates a bug.
 
s   WithCommentss=    
 WithComments init method.
 
   You should not see this!
 
s   __init__s,   Did not get expected comment values.  Got %s(	   s   opens   reads   bodys   extractCommentss   actuals   expecteds	   __debug__s   AssertionErrors   str(   s   selfs   expecteds   actuals   body(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/parsecomments.pys   testCommentsõ s   $c    sž    t  d d ƒ i ƒ  } t | ƒ } h  d d f <d d f <d d f <d	 d
 f <d d f <} 	t o! | | j p t d t | ƒ ‚ d  S(   Ns$   TestCases/test_decorated_comments.pys   rts    
 Func with dash lines
 
s   Dashess    
 Func with equal lines
 
s   Equalss    
 
 Func with hash lines
 
 
s   Hashess   
 This function has, in the comments about it, a table.  That table
 should be rendered via STNG to an HTML table in the test output.
 
  |-------------------------------------------------|
  | Function  | Documentation                       |
  |=================================================|
  | '__str__' | This method converts the            |
  |           |  the object to a string.            |
  |           |                                     |
  |           | - Blah                              |
  |           |                                     |
  |           | - Blaf                              |
  |           |                                     |
  |           |       |--------------------------|  |
  |           |       |  Name   | Favorite       |  |
  |           |       |         | Color          |  |
  |           |       |==========================|  |
  |           |       | Jim     |  Red           |  |
  |           |       |--------------------------|  |
  |           |       | John    |  Blue          |  |
  |           |       |--------------------------|  |
  |-------------------------------------------------|
 
s   StructuredTextTables'    
 Func with mixed dashes and equals
 
s   Mixeds,   Did not get expected comment values.  Got %s(	   s   opens   reads   bodys   extractCommentss   actuals   expecteds	   __debug__s   AssertionErrors   str(   s   selfs   expecteds   actuals   body(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/parsecomments.pys   testDecoratedComments s   E(   s   testCommentss   testDecoratedComments(    (    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/parsecomments.pys   ParseCommentsTestó s   (   s   __doc__s   __rcs_info__s   splits   __version__s   res	   cStringIOs   StringIOs   StreamFlushTests
   ParseStacks   compiles   searchs   matchs   extractCommentss   ParseCommentsTest(   s   __rcs_info__s   extractCommentss   __version__s   res   StringIOs   StreamFlushTests   ParseCommentsTests
   ParseStack(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_0/happydoclib/parsecomments.pys   ? s   Q&*„