-
 <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_1/happydoclib/parsecomments.pys   __init__L s   c    sg   Q V W x7 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.
        ii   N(   s   selfs   datas   indents   pops   appends   name(   s   selfs   names   indent(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_1/happydoclib/parsecomments.pys   pushQ s    %c    s:   \ ] ^ |  i d \ } } _ |  i d  |  _ ` | Sd S(   s*   Remove the top of the stack and return it.iN(   s   selfs   datas   items   indent(   s   selfs   items   indent(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_1/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_1/happydoclib/parsecomments.pys   <lambda>d s    N(   s   maps   selfs   data(   s   self(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_1/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_1/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_1/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_1/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
   match_dicts   comments   comment_texts	   match_objs   nametypes   fs   dbgs	   blanklines   current_names   comment_infos   indents   lines   parse_stacks   name(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_1/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   bodys   actuals   expected(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_1/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   bodys   actuals   expected(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_1/happydoclib/parsecomments.pys   testDecoratedComments s   E(   s   testCommentss   testDecoratedComments(    (    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_1/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   res   ParseCommentsTests   StreamFlushTests   StringIOs
   ParseStacks   __version__s   extractCommentss   __rcs_info__(    (    sW   /home/dhellmann/Personal/Devel/HappyDoc/dist/HappyDoc-r2_1/happydoclib/parsecomments.pys   ? s   Q&*