
    yIf9t                    \   d Z ddlmZ ddlZddlZddlmZ ddlZddlmZ ddl	m
Z
 ddlmZ d;dZd<dZd=dZd>dZd?dZd@dZdAdZdBdZdCd$ZdDd(ZdEd*Z	 dFdGd0Z G d1 d/          Z G d2 d3e          Z G d4 d5e          Z G d6 d7e          Z G d8 d9e          Zeeeeed:ZdS )Hz'Utility methods for docstring checking.    )annotationsN)Iterable)nodes)UninferableBase)utilssstrreturnintc                f    t          |           t          |                     d                    z
  S )zThe number of leading spaces in a string.

    :param str s: input string

    :rtype: int
    :return: number of leading spaces
     )lenlstrip)r   s    W/var/www/piapp/venv/lib/python3.11/site-packages/pylint/extensions/_check_docs_utils.pyspace_indentationr      s'     q66C&&&&    nodenodes.FunctionDef
str | Nonec                    | j         r| j         j        ng }|D ]T}t          |t          j                  r8|j        dk    r-t          |j        t          j                  r|j        j        c S UdS )a  Get the name of the property that the given node is a setter for.

    :param node: The node to get the property name for.
    :type node: str

    :rtype: str or None
    :returns: The name of the property that the node is a setter for,
        or None if one could not be found.
    setterN)
decoratorsr   
isinstance	AttributeattrnameexprNamename)r   r   	decorators      r   get_setters_property_namer       sz     +//A&&rJ ' '	y%/22	'"h..9>5:66 / >&&&&4r   nodes.FunctionDef | Nonec                    d}t          |           }t          j        |           }|r9|r7|                    | j                  }|D ]}t          j        |          r|} n|S )a'  Get the property node for the given setter node.

    :param node: The node to get the property for.
    :type node: nodes.FunctionDef

    :rtype: nodes.FunctionDef or None
    :returns: The node relating to the property of the given setter node,
        or None if one could not be found.
    N)r    r   node_frame_classgetattrr   decorated_with_property)r   	property_property_name
class_nodeclass_attrsattrs         r   get_setters_propertyr+   4   s     I-d33M'--J  /9/A/A$)/L/L 	 	D,T22  	 r   return_nodenodes.Returnboolc                `    | j         }|dS t          |t          j                  o|j         du  S )a  Check if a return node returns a value other than None.

    :param return_node: The return node to check.
    :type return_node: astroid.Return

    :rtype: bool
    :return: True if the return node returns a value other than None,
        False otherwise.
    NF)valuer   r   Const)r,   returnss     r   returns_somethingr3   L   s7     Gu7EK00JW]d5JKKr   nodes.NodeNG%nodes.NodeNG | UninferableBase | Nonec                    t          | j        t          j                  rF| j        j        }t          |t          j        t          j        f          rt          j        |          S d S N)	r   excr   Callfuncr   r   r   
safe_infer)r   r:   s     r   _get_raise_targetr<   ^   sR    $(EJ'' *x}dUZ9:: 	*#D)))4r   target	list[str]c                0    d}t          j        ||           S )Nz(\s*,(?:\s*or\s)?\s*|\s+or\s+))resplit)r=   
delimiterss     r   _split_multiple_exc_typesrC   f   s    2J8J'''r   set[nodes.ClassDef]c                    g }t           j        t          j                  r t	          j         j                  }|r|g}n j         j        }|r=t          |t          j                  s#|j        }|rt          |t          j                  #|rf|j        r_	 t          j
        |j                  D ],}t          |t                    s|                    |           -nJ# t          j        $ r Y n8w xY wn2t                     }t          |t          j                  r|g}nt          |t          j                  r|                    t          j                  D ]}|j        
|                                |k    r#t	          j        |j                  }|rt	          j        |          rxt          |t          j                  r|                    |           t          |t          j                  r.|                    |                    d          d                    	  fd|D             S # t          j        $ r t1                      cY S w xY w)a  Gets all the possible raised exception types for the given raise node.

    .. note::

        Caught exception types are ignored.

    :param node: The raise node to find exception types for.

    :returns: A list of exception types possibly raised by :param:`node`.
    N	__class__r   c                H    h | ]}t          j        |j                  |S  )r   node_ignores_exceptionr   ).0r8   r   s     r   	<setcomp>z%possible_exc_types.<locals>.<setcomp>   s>     
 
 
/ch??

 
 
r   )r   r8   r   r   r   r;   parentExceptHandlertypeastroidunpack_inferr   appendInferenceErrorr<   ClassDefFunctionDefnodes_of_classReturnr0   frameinherit_from_std_exInstancer$   set)r   
exceptionsinferredhandler	exceptionr=   retvals   `       r   possible_exc_typesra   k   s    J$(EJ'' !G#DH-- 	$"J		+ 	%j%2EFF 	%nG  	%j%2EFF 	%  	w| 	!(!5gl!C!C 5 5I%iAA 5")))4445 )    #4((fen-- 	G JJ 122 	G,,U\:: G G9$99;;&((&sy11 G54S99 G!#u~66 G"))#....#C)9:: G"))#++k*B*B1*EFFF
 
 
 
!
 
 
 	

 !   uus%   AC" "C54C5-H; ;IIc                V    t          | t          j                  o| j        t          k    S r7   )r   r   r1   r0   Ellipsis)r   s    r   _is_ellipsisrd      s     dEK((CTZ8-CCr   r   Iterable[nodes.NodeNG]comment_annotationsIterable[nodes.NodeNG | None]c              #     K   t          j        | |          D ]5\  }}|rt          |          s|V  |rt          |          s|V  1d V  6d S r7   )	itertoolszip_longestrd   )r   rf   anncomment_anns       r   _merge_annotationsrm      s       &1+?RSS  [ 	|C(( 	IIII 	k!:!: 	JJJJ r   	args_nodenodes.Argumentslist[nodes.NodeNG]c           	         | j         pd}| j        j        pd}| j        }|| j        pg z  }|| j        z  }t          t          |t          ||                              S )a  Get a merged list of annotations.

    The annotations can come from:

    * Real type annotations.
    * A type comment on the function.
    * A type common on the individual argument.

    :param args_node: The node to get the annotations for.
    :returns: The annotations.
    rH   )r   rL   type_comment_argstype_comment_posonlyargstype_comment_kwonlyargslistrm   )rn   plain_annotationsfunc_comment_annotationsrf   s       r   _annotations_listrx      s~     "-3(/AGR#<96<"<9<<79LMM	
 	
  r   set[str]c                   t                      }t          |           }d}| j        rx| j        }t	          | j                  s&t          | j                  }||||z            }||z  }t          | j        |          D ]!\  }}|r|                    |j                   "| j	        r[t          | j	                  }t          | j	        ||||z                      D ]!\  }}|r|                    |j                   "||z  }| j
        r\| j        r|                    | j
                   n:t          |          |k    r'||         r|                    | j
                   |dz  }| j        rx| j        }t	          | j                  s&t          | j                  }||||z            }||z  }t          | j        |          D ]!\  }}|r|                    |j                   "| j        r\| j        r|                    | j                   n:t          |          |k    r'||         r|                    | j                   |dz  }|S Nr      )rZ   rx   posonlyargsposonlyargs_annotationsanyr   zipaddr   argsvarargvarargannotation
kwonlyargskwonlyargs_annotationskwargkwargannotation)	rn   resultr   annotation_offsetr~   num_argsarg
annotationr   s	            r   args_with_annotationr      s   UUF#I..K %"+"C9455 	*9011H&1!$5$@@'# )"9#8:QRR 	% 	%OC %

38$$$~ 	&y~&&"N),=,HHI 
  
 	% 	%OC  %

38$$$X% #% 	#JJy'(((( 111kBS6T1JJy'(((" %!*!A9344 	*9/00H%0!$5$@@&" )"9#79OPP 	% 	%OC %

38$$$ #$ 	#JJy'''' 111kBS6T1JJy'''"Mr   default	docstringnodes.Const | Nonedefault_type	Docstringc                    dt                              |t                    |           f}t          t          t
          t          fD ]1} ||           }|                                }||d         k    r||f}2|d         S r{   )DOCSTRING_TYPESgetr   SphinxDocstringEpytextDocstringGoogleDocstringNumpyDocstringmatching_sections)r   r   
best_matchdocstring_typeinstancer   s         r   docstringifyr     s     _((yAA)LLMJ	 	7 	7 ">),,$6688z!},,+X6Ja=r   c                      e Zd ZU  ej        dej        ej        z            ZdZde	d<   	 dd	Z
ddZddZddZddZddZddZddZddZddZddZd dZddZdS )!r   z=
        For\s+the\s+(other)?\s*parameters\s*,\s+see
        Fr.   supports_yieldsdocr   r
   Nonec                N    |r|j         nd}|                                | _        d S )N )r0   
expandtabsr   )selfr   r   s      r   __init__zDocstring.__init__)  s)    &)1r	''))r   r	   c                2    d| j         j         d| j         dS )N<z:'''z'''>)rF   __name__r   r   s    r   __repr__zDocstring.__repr__-  s"    >4>*>>>>>>r   r   c                    dS )2Returns the number of matching docstring sections.r   rH   r   s    r   r   zDocstring.matching_sections0  s    qr   ry   c                    t                      S r7   rZ   r   s    r   r[   zDocstring.exceptions4  s    uur   c                    dS NFrH   r   s    r   
has_paramszDocstring.has_params7      ur   c                    dS r   rH   r   s    r   has_returnszDocstring.has_returns:  r   r   c                    dS r   rH   r   s    r   	has_rtypezDocstring.has_rtype=  r   r   c                    dS r   rH   r   s    r   has_property_returnszDocstring.has_property_returns@  r   r   c                    dS r   rH   r   s    r   has_property_typezDocstring.has_property_typeC  r   r   c                    dS r   rH   r   s    r   
has_yieldszDocstring.has_yieldsF  r   r   c                    dS r   rH   r   s    r   has_yields_typezDocstring.has_yields_typeI  r   r   tuple[set[str], set[str]]c                :    t                      t                      fS r7   r   r   s    r   match_param_docszDocstring.match_param_docsL  s    uucee|r   c                D    | j                             | j                  d uS r7   )re_for_parameters_seesearchr   r   s    r   params_documented_elsewherez%Docstring.params_documented_elsewhereO  s     )00::$FFr   N)r   r   r
   r   r
   r	   r
   r   r
   ry   r
   r.   r
   r   )r   
__module____qualname__r@   compileXSr   r   __annotations__r   r   r   r[   r   r   r   r   r   r   r   r   r   rH   r   r   r   r     s^        &BJ	 	rt	  "O!!!!* * * *? ? ? ?                              G G G G G Gr   c            	         e Zd ZdZde dZde de de de d	Zde d	Zd
e de dZ ej	        eej
        ej        z            Zde dZ ej	        eej
        ej        z            Zde dZ ej	        eej
        ej        z            Zde dZ ej	        eej
        ej        z            Z ej	        d          Z ej	        d          ZdZd#dZd$dZd%dZd%dZd%dZd%dZd%dZd&d!Zd"S )'r   zt
        [~!.]?               # Optional link style prefix
        \w(?:\w|\.[^\.])*    # Valid python name
        z	
        zw                     # a container type
        [\(\[] [^\n\s]+ [\)\]]        # with the contents of the container
    
        (?:|4)
        (?:(?:\s+(?:of|or)\s+|\s*,\s*|\s+\|\s+)(?:))*
    z?
        (?::\w+:)?                    # optional tag
        `z0`                   # what to reference
        a#  
        :                       # initial colon
        (?:                     # Sphinx keywords
        param|parameter|
        arg|argument|
        key|keyword
        )
        \s+                     # whitespace

        (?:                     # optional type declaration
        (z)
        \s+
        )?

        ((\\\*{0,2}\w+)|(\w+))  # Parameter name with potential asterisks
        \s*                       # whitespace
        :                         # final colon
        zx
        :type                           # Sphinx keyword
        \s+                             # whitespace
        (z)     # Parameter name
        \s*                             # whitespace
        :                               # final colon
        zo
        :type:                      # Sphinx keyword
        \s+                         # whitespace
        z   # type declaration
        z
        :                               # initial colon
        (?:                             # Sphinx keyword
        raises?|
        except|exception
        )
        \s+                             # whitespace
        (z)     # exception type
        \s*                             # whitespace
        :                               # final colon
        z:rtype:z
:returns?:Fr
   r   c           
     `   t          d | j                            | j                  | j                            | j                  | j                            | j                  | j                            | j                  | j                            | j                  fD                       S )r   c              3  4   K   | ]}t          |          V  d S r7   r.   rJ   is     r   	<genexpr>z4SphinxDocstring.matching_sections.<locals>.<genexpr>  <       	
 	
 GG	
 	
 	
 	
 	
 	
r   )sumre_param_in_docstringr   r   re_raise_in_docstringre_rtype_in_docstringre_returns_in_docstringre_property_type_in_docstringr   s    r   r   z!SphinxDocstring.matching_sections  s     	
 	
 *11$(;;*11$(;;*11$(;;,33DH==299$(CC	
 	
 	
 	
 	
 		
r   ry   c                    t                      }t          j        | j        | j                  D ]9}|                    d          }|                    t          |                     :|S Nr|   )rZ   r@   finditerr   r   groupupdaterC   )r   typesmatch
raise_types       r   r[   zSphinxDocstring.exceptions  s_    %%[!;TXFF 	@ 	@EQJLL2:>>????r   r.   c                V    | j         sdS | j                            | j                   d uS r   )r   r   r   r   s    r   r   zSphinxDocstring.has_params  s/    x 	5)00::$FFr   c                l    | j         sdS t          | j                            | j                             S r   )r   r.   r   r   r   s    r   r   zSphinxDocstring.has_returns  s2    x 	5D077AABBBr   c                l    | j         sdS t          | j                            | j                             S r   )r   r.   r   r   r   s    r   r   zSphinxDocstring.has_rtype  s2    x 	5D.55dh??@@@r   c                n    | j         sdS | j                                                             d           S )NF:)r   r   
startswithr   s    r   r   z$SphinxDocstring.has_property_returns  s6    x 	5 8??$$//4444r   c                l    | j         sdS t          | j                            | j                             S r   )r   r.   r   r   r   s    r   r   z!SphinxDocstring.has_property_type  s2    x 	5D6==dhGGHHHr   r   c                   t                      }t                      }t          j        | j        | j                  D ]n}|                    d          }|                    dd          }|                    |           |                    d          }||                    |           o|                    t          j	        | j
        | j                             ||fS )N   \r   r|   )rZ   r@   r   r   r   r   replacer   r   findallre_type_in_docstring)r   params_with_docparams_with_typer   r   
param_types         r   r   z SphinxDocstring.match_param_docs  s    %%55[!;TXFF 	+ 	+E;;q>>D<<b))D%%%QJ% $$T***
4+Ddh O OPPP 000r   Nr   r   r   r   )r   r   r   re_typere_simple_container_typere_multiple_simple_typere_xrefre_param_rawr@   r   r   r   r   re_type_rawr   re_property_type_rawr   re_raise_rawr   r   r   r   r   r[   r   r   r   r   r   r   rH   r   r   r   r   S  s]       G
 	     
$ '. 3K NU  

  G
   -  L$ 'BJ|RTBD[AA "  K &2:k24"$;?? 
!  
 %/BJ/CRTBD[$Q$Q!
 "
 
 
L 'BJ|RTBD[AA&BJz22(bj77O
 
 
 
   G G G GC C C CA A A A5 5 5 5I I I I1 1 1 1 1 1r   r   c                  6   e Zd ZdZ ej        ej                            ddd          ej	        ej
        z            Z ej        ej                            ddd          ej	        ej
        z            Z ej        ej                            ddd          ej	        ej
        z            Z ej        ej                            ddd          ej	        ej
        z            Z ej        dej	        ej
        z            Z ej        d          Zdd	Zd
S )r   a  Epytext is similar to Sphinx.

    See the docs:
        http://epydoc.sourceforge.net/epytext.html
        http://epydoc.sourceforge.net/fields.html#fields

    It's used in PyCharm:
        https://www.jetbrains.com/help/pycharm/2016.1/creating-documentation-comments.html#d848203e314
        https://www.jetbrains.com/help/pycharm/2016.1/using-docstrings-to-specify-types.html
    r   @r|   z
        @                       # initial "at" symbol
        (?:                     # Epytext keyword
        rtype|returntype
        )
        :                       # final colon
        z
@returns?:r
   r.   c                    | j         sdS |                                 r-| j                                                             d           S dS )NFr  )r   r   r   r   r   s    r   r   z%EpytextDocstring.has_property_returns  sQ    x 	5 !!## 	9 x((33C8888ur   Nr   )r   r   r   __doc__r@   r   r   r  r   r   r   r   r  r   r  r   r  r   r   r   r   rH   r   r   r   r     sN       	 	 'BJ$,,S#q9924"$;  &2:#++Ca88"$+  %/BJ,44S#qAA24"$;% %! 'BJ$,,S#q9924"$;  'BJ	 	rt	 	 )bj77
 
 
 
 
 
r   r   c                     e Zd Zej        Zej        Zde de dZde de de de de de dZdZ e	j
        e                    d          e	j        e	j        z  e	j        z            Z e	j
        e                    d          e	j        e	j        z  e	j        z            Z e	j
        d	e d
e	j        e	j        z  e	j        z            Z e	j
        e                    d          e	j        e	j        z  e	j        z            Z e	j
        de de	j        e	j        z  e	j        z            Z e	j
        e                    d          e	j        e	j        z  e	j        z            Z e	j
        de de	j        e	j        z  e	j        z            Z e	j
        de de	j        e	j        z  e	j        z            Z e	j
        e                    d          e	j        e	j        z  e	j        z            ZeZdZd0dZd1dZd1dZd1dZd1dZd1dZd1dZ d1dZ!d2d!Z"d3d#Z#d4d%Z$e%d5d(            Z&e%d6d*            Z'd7d.Z(d/S )8r   r   r   zj)       # a container type
        [\(\[] [^\n]+ [\)\]]          # with the contents of the container
    r   r   zy
        ^([ ]*)   {0} \s*:   \s*$     # Google parameter header
        (  .* )                       # section
        (?:Args|Arguments|Parameters)z&Keyword\s(?:Args|Arguments|Parameters)z}
        \s*  ((?:\\?\*{0,2})?[\w\\]+) # identifier potentially with asterisks or escaped `\`
        \s*  ( [(]
            z
            (?:,\s+optional)?
            [)] )? \s* :                # optional type declaration
        \s*  (.*)                       # beginning of optional description
    Raisesz
        \s*  (zg) \s* :  # identifier
        \s*  (.*)                        # beginning of optional description
    Returns?
        \s* (za:)?        # identifier
        \s* (.*)                          # beginning of description
    z

        ^za:           # identifier
        \s* (.*)                       # Summary line / description
    Yields?Tr
   r   c                z   t          d | j                            | j                  | j                            | j                  | j                            | j                  | j                            | j                  | j                            |                                           fD                       S )r   c              3  4   K   | ]}t          |          V  d S r7   r   r   s     r   r   z4GoogleDocstring.matching_sections.<locals>.<genexpr>p  r   r   )	r   re_param_sectionr   r   re_raise_sectionre_returns_sectionre_yields_sectionre_property_returns_line_first_liner   s    r   r   z!GoogleDocstring.matching_sectionsn  s     	
 	
 %,,TX66%,,TX66'..tx88&--dh77-44T5E5E5G5GHH	
 	
 	
 	
 	
 		
r   r.   c                V    | j         sdS | j                            | j                   d uS r   )r   r  r   r   s    r   r   zGoogleDocstring.has_params{  s/    x 	5$++DH55TAAr   c                    | j         sdS |                     | j                  }|D ]9}| j                            |          }|s|                    d          }|r dS :dS NFr   Tr   _parse_sectionr  re_returns_liner   r   )r   entriesentryr   return_descs        r   r   zGoogleDocstring.has_returns      x 	5%%d&=>> 	 	E(..u55E ++a..K tt ur   c                    | j         sdS |                     | j                  }|D ]9}| j                            |          }|s|                    d          }|r dS :dS NFr|   Tr  )r   r  r  r   return_types        r   r   zGoogleDocstring.has_rtype  r!  r   c                   |                                  }t          | j                            |          pM| j                            |          p3| j                            |          p| j                            |                     S r7   )r  r.   r  r   r  r  r  )r   
first_lines     r   r   z$GoogleDocstring.has_property_returns  s     %%''
!((44 9$++J779&--j999 %,,Z88	
 
 
 	
r   c                    | j         sdS t          | j                            |                                                     S r   )r   r.   r  r   r  r   s    r   r   z!GoogleDocstring.has_property_type  s<    x 	5D1778H8H8J8JKKLLLr   c                    | j         sdS |                     | j                  }|D ]9}| j                            |          }|s|                    d          }|r dS :dS r  r   r  r  re_yields_liner   r   )r   r  r  r   
yield_descs        r   r   zGoogleDocstring.has_yields      x 	5%%d&<== 	 	E'--e44E QJ tt ur   c                    | j         sdS |                     | j                  }|D ]9}| j                            |          }|s|                    d          }|r dS :dS r#  r)  )r   r  r  r   
yield_types        r   r   zGoogleDocstring.has_yields_type  r,  r   ry   c                6   t                      }|                     | j                  }|D ]m}| j                            |          }|s|                    d          }|                    d          }|r"|                    t          |                     n|S )Nr|   r   )rZ   r  r  re_raise_liner   r   r   rC   )r   r   r  r  r   exc_typeexc_descs          r   r[   zGoogleDocstring.exceptions  s    %%%%d&;<< 	B 	BE&,,U33E {{1~~H{{1~~H B6x@@AAAr   r   c                   t                      }t                      }|                     | j                  }|                    |                     | j                             |D ]}| j                            |          }|s|                    d          }|                    dd          }|                    d          }|                    d          }|r|	                    |           |r|	                    |           ||fS )Nr|   r   r   r      )
rZ   r  r  extendre_keyword_param_sectionre_param_liner   r   r   r   )	r   r   r   r  r  r   
param_namer   
param_descs	            r   r   z GoogleDocstring.match_param_docs  s   $'EE%(UU%%d&;<<t**4+HIIJJJ 	0 	0E&,,U33E QJ#++D"55JQJQJ 1 $$Z000 0##J/// 000r   r	   c                h    | j                                                             dd          d         S )N
r|   r   )r   r   rA   r   s    r   r  zGoogleDocstring._first_line  s)    x  &&tQ//22r   section_matchre.Match[str]c                L    t          |                     d                    dz   S r   r   r   r<  s    r   min_section_indentz"GoogleDocstring.min_section_indent  s#    =&&q))**Q..r   _c                    dS r   rH   )rB  s    r   _is_section_headerz"GoogleDocstring._is_section_header  s	     ur   
section_rere.Pattern[str]r>   c                @   |                     | j                  }|g S |                     |          }g }g }d}|                    d                                          D ]}|                                st          |          }||k     r ne|r|}d}||k    rC|                     |          r nB|r*|                    d	                    |                     g }|                    |           |r(|                    d	                    |                     |S )NTr   Fr;  )
r   r   rA  r   
splitlinesstripr   rD  rQ   join)	r   rE  r<  min_indentationr  r  is_firstlineindentations	            r   r  zGoogleDocstring._parse_section	  sD   "))$(33 I11-@@!''**5577 	 	D::<< +D11K_,,  !"- o--**400 E  NN499U#3#3444ELL 	-NN499U++,,,r   Nr   r   r   r   r   r<  r=  r
   r   )rB  r	   r
   r.   )rE  rF  r
   r>   ))r   r   r   r   r   r  re_container_typere_multiple_type_re_section_templater@   r   formatr   r   Mr  r6  r7  r  r0  r  r  r  r  r*  r   r   r   r   r   r   r   r   r   r[   r   r  staticmethodrA  rD  r  rH   r   r   r   r     s       %G%G   
  ' *1 3D GN QX  

 "rz##$DEE
rtbd 
  *rz##$MNN
rtbd   
 BJ	 	 	 	 	rtbd
 
M "rz##I..rtbd0B  BJ		 	 	 	rtbd M $##K00"$+2D  !bj		 	 	 	rtbd O  *rz	
	 	 	 	rtbd    #
##J//rt1C  %NO
 
 
 
B B B B        	
 	
 	
 	
M M M M            1 1 1 143 3 3 3 / / / \/    \
% % % % % %r   r   c                  .   e Zd ZdZ ej        e                    d          ej        ej        z  ej	        z            Z
dZ ej        dej         de dej        ej        z            Z ej        e                    d          ej        ej        z  ej	        z            Z ej        dej         d	ej        ej        z  ej	        z            Z ej        e                    d
          ej        ej        z  ej	        z            Z ej        dej         dej        ej        z  ej	        z            Z ej        e                    d          ej        ej        z  ej	        z            ZeZdZddZedd            Zedd            ZdS )r   z
        ^([ ]*)   {0}   \s*?$          # Numpy parameters header
        \s*     [-=]+   \s*?$          # underline
        (  .* )                        # section
    r  z.((['"]\w+\s*['"])|(\d+)|(True)|(False)|(None))z
        \s*  (?P<param_name>\*{0,2}\w+)(\s?(:|\n)) # identifier with potential asterisks
        \s*
        (?P<param_type>
         (
          (z)      # default type declaration
          (,\s+optional)?                           # optional 'optional' indication
         )?
         (
          {(z,?\s*)+}            # set of default values
         )?
         (?:$|\n)
        )?
        (
         \s* (?P<param_desc>.*)                     # optional description
        )?
    r  r  z^)$   # type declaration
        \s* (.*)                           # optional description
    r  z6
        \s* (?:\w+\s+:\s+)? # optional name
        (zc)$   # type declaration
        \s* (.*)                                # optional description
    r  Tr
   r   c                   t                      }t                      }|                     | j                  }|                    |                     | j                             |D ]}| j                            |          }|st          j        d|          }|r-|                    d          }|                    d          }d}	n^|                    d          }|                    d          }	|                    d          }|	t          j        d|          r|}	|s|	r|	}|	r|	                    |           |r|	                    |           ||fS )zIMatches parameter documentation section to parameter documentation rules.z\s*(\*{0,2}\w+)\s*:?\n\s*\w*$r8  r   Nr9  z\s*(\*{0,2}\w+)\s*:.+$)
rZ   r  r  r5  r6  r7  r   r@   r   r   )
r   r   r   r  r  r   re_only_descr8  r9  r   s
             r   r   zNumpyDocstring.match_param_docsu  sp   %%55%%d&;<<t**4+HIIJJJ 	0 	0E&,,U33E  8$DeLLL ,"[[66
"[[66
!

"[[66
"[[66
"[[66
 %"(3Le*T*T%!+J " ,j ,!+J 1 $$Z000 0##J/// 000r   r<  r=  r   c                F    t          |                     d                    S r   r?  r@  s    r   rA  z!NumpyDocstring.min_section_indent  s    =&&q))***r   rM  r	   r.   c                F    t          t          j        d|                     S )Nz\s*-+$)r.   r@   r   )rM  s    r   rD  z!NumpyDocstring._is_section_header  s    BHY--...r   Nr   rO  )rM  r	   r
   r.   )r   r   r   rR  r@   r   rS  r   r   rT  r  re_default_valuer   rQ  r7  r  r   r0  r  r  r  r*  r   r   rU  rA  rD  rH   r   r   r   r   1  s9        "rz##$DEE
rtbd 
 MBJ	
 ,	 	 	 	 	" 	rt% M* "rz##I..rtbd0B  BJ	%	 	 	 	rtbd M $##K00"$+2D  !bj	

*	 	 	
 	rtbd O #
##J//rt1C  %NO(1 (1 (1 (1T + + + \+ / / / \/ / /r   r   )sphinxepytextgooglenumpyr   )r   r	   r
   r   )r   r   r
   r   )r   r   r
   r!   )r,   r-   r
   r.   )r   r4   r
   r5   )r=   r	   r
   r>   )r   r4   r
   rD   )r   r4   r
   r.   )r   re   rf   re   r
   rg   )rn   ro   r
   rp   )rn   ro   r
   ry   )r   )r   r   r   r	   r
   r   )r	  
__future__r   ri   r@   collections.abcr   rO   r   astroid.utilr   pylint.checkersr   r   r    r+   r3   r<   rC   ra   rd   rm   rx   r   r   r   r   r   r   r   r   rH   r   r   <module>rd     s  
 . - " " " " " "     				 $ $ $ $ $ $        ( ( ( ( ( ( ! ! ! ! ! !' ' ' '   *   0L L L L$   ( ( ( (
6 6 6 6rD D D D	 	 	 	   28 8 8 8x 8A    $6G 6G 6G 6G 6G 6G 6G 6GrP1 P1 P1 P1 P1i P1 P1 P1f3 3 3 3 3 3 3 3lR R R R Ri R R Rjt/ t/ t/ t/ t/_ t/ t/ t/p   r   