
    -Ph                        d dl Z d dlmZ d dlmZmZmZ d dlmZm	Z	 d dl
Z
d dlZd dlmZ d dlmZ d dlmZ ej        Z eej                                                  Ze
j                            dd	gd
heg e             e            gdhdhgddhddhgh deddhz
  gd
dhedhz
  gg          d             Ze
j                            ddhdhdhddhg          d             Z G d de          Zd Ze
j                            dd	gdi gdddgigddddgigdddgigddddgigddgddgd gg          d!             Ze
j                            d" e
j        d#d$%           e
j        d&d'%          f          e
j                            d( e
j        d)d&d*%           e
j        d+d#d,%          f          d-                         Z  G d. d/          Z! G d0 d1          Z" G d2 d3          Z# G d4 d5          Z$ G d6 d7          Z% G d8 d9          Z& G d: d;          Z' G d< d=          Z( G d> d?          Z)d@ Z*e*e* G dA dB                                  Z+ G dC dD          Z,dE Z-dS )F    N)nullcontext)cached_propertypartialwraps)getsourcefilegetsourcelinesvalidate)get_doc_object)	ValidatorchecksexpectedallEX01SA01>   r   r   r   PR01c                 :    t          j        |           |k    sJ dS )z"Ensure check selection is working.N)r
   get_validation_checks)r   r   s     \/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numpydoc/tests/test_validate.py test_utils_get_validation_checksr      s&     )&11X======    everySM10c                     t          j        t          d          5  t          j        |           }ddd           dS # 1 swxY w Y   dS )z'Ensure that invalid checks are flagged.zUnrecognized validation codematchN)pytestraises
ValueErrorr
   r   )r   _s     r   #test_get_validation_checks_validityr!   "   s     
z)G	H	H	H 3 3*6223 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3s   >AAc                       e Zd ZdZdS )
_DummyListz$Dummy list class to test validation.N)__name__
__module____qualname____doc__ r   r   r#   r#   1   s        ....r   r#   c                  .    t          j         d           dS )z>Test that validation can be done on functions made on the fly.z-numpydoc.tests.test_validate._DummyList.clearNr	   r(   r   r   test_no_filer*   5   s     EFFFFFr   file_contentszclass MyClass:
    passz/class MyClass:  # numpydoc ignore=EX01
    pass   z5class MyClass:  # numpydoc ignore= EX01,SA01
    passzHclass MyClass:
    def my_method():  # numpydoc ignore:EX01
        pass   zNclass MyClass:
    def my_method():  # numpydoc ignore: EX01,PR01
        passzeclass MyClass:  # numpydoc ignore=GL08
    def my_method():  # numpydoc ignore:EX01,PR01
        passGL08)r,   r-   c                     | dz  }t          |d          5 }|                    |           ddd           n# 1 swxY w Y   t          j        |          |k    sJ dS )z>Test that extraction of validation ignore comments is working.ignore_comments.pywN)openwriter
   "extract_ignore_validation_comments)tmp_pathr+   r   filepathfiles        r   'test_extract_ignore_validation_commentsr8   ;   s    2 ..H	h		 "

=!!!" " " " " " " " " " " " " " "6x@@HLLLLLLs   8<<assumed_encodingutf-8
utf8_codec)idcp1252cp1252_codec)	classnameactual_encodingu   MÿClasscp1252_fileu	   MyClass	utf8_filec                    | dz  }d| d}t          |d          5 }|                    |                    |                     ddd           n# 1 swxY w Y   |dk    r(|dk    r"t          t          j        t          d	          }n5|dk    r(|dk    r"t          t          j        t          d
	          }nt          } |            5  t          j	        ||          }|i k    sJ 	 ddd           dS # 1 swxY w Y   dS )z1Test handling of different source file encodings.r0   zclass z
:
    passwbNr=   r:   z8can't decode byte 0xff in position 7: invalid start byter   zCcan't decode byte 0x81 in position 9: character maps to <undefined>)
r2   r3   encoder   r   r   UnicodeDecodeErrorr   r
   r4   )	r5   r?   r@   r9   r6   r+   r7   contextresults	            r   test_encodingsrI   Z   s   " ..H3Y333M	h		 :

=''88999: : : : : : : : : : : : : : : (""'77'B'BML
 
 
 
G	#	#(8H(D(DMW
 
 
 	  <XGWXX|||||                 s#   )AAA	C55C9<C9c                       e Zd ZdZd ZddZd Zd Zd Zd Z	d	 Z
ddZddZd ed          fdZd Zd Zd Zd Zd Zd Zd Zd Zd Zd ZdS )GoodDocStringsa  
    Collection of good doc strings.

    This class contains a lot of docstrings that should pass the validation
    script without any errors.

    See Also
    --------
    AnotherClass : With its description.

    Examples
    --------
    >>> result = 1 + 1
    c                     dS )z.Allow one liner docstrings (including quotes).Nr(   selfs    r   	one_linerzGoodDocStrings.one_liner         r   bluec                     dS )a7  
        Generate a plot.

        Render the data in the Series as a matplotlib plot of the
        specified kind.

        Parameters
        ----------
        kind : str
            Kind of matplotlib plot, e.g.::

                "foo"

        color : str, default 'blue'
            Color name or rgb code.
        **kwargs
            These parameters will be passed to the matplotlib plotting
            function.

        See Also
        --------
        related : Something related.

        Examples
        --------
        >>> result = 1 + 1
        Nr(   )rN   kindcolorkwargss       r   plotzGoodDocStrings.plot   rP   r   c                     dS )a  
        Swap two indices on an array.

        The extended summary can be multiple paragraphs, but just one
        is enough to pass the validation.

        Parameters
        ----------
        arr : list
            The list having indexes swapped.
        i, j : int
            The indexes being swapped.
        *args, **kwargs
            Extraneous parameters are being permitted.

        See Also
        --------
        related : Something related.

        Examples
        --------
        >>> result = 1 + 1
        Nr(   )rN   arrijargsrU   s         r   swapzGoodDocStrings.swap   rP   r   c                     dS )a  
        Generate and return a random number.

        The value is sampled from a continuous uniform distribution between
        0 and 1.

        Returns
        -------
        float
            Random number generated.

            - Make sure you set a seed for reproducibility

        See Also
        --------
        related : Something related.

        Examples
        --------
        >>> result = 1 + 1
        Nr(   rM   s    r   samplezGoodDocStrings.sample   rP   r   c                     dS )a  
        Generate and return a sequence of random letters.

        The length of the returned string is also random, and is also
        returned.

        Returns
        -------
        length : int
            Length of the returned string.
        letters : str
            String of random letters.

            .. versionadded:: 0.1

        See Also
        --------
        related : Something related.

        Examples
        --------
        >>> result = 1 + 1
        Nr(   rM   s    r   random_letterszGoodDocStrings.random_letters   rP   r   c                     dS )az  
        Generate an infinite sequence of random numbers.

        The values are sampled from a continuous uniform distribution between
        0 and 1.

        Yields
        ------
        float
            Random number generated.

        See Also
        --------
        related : Something related.

        Examples
        --------
        >>> result = 1 + 1
        Nr(   rM   s    r   sample_valueszGoodDocStrings.sample_values   rP   r   c                     dS )aL  
        Return the first 5 elements of the Series.

        This function is mainly useful to preview the values of the
        Series without displaying the whole of it.

        Returns
        -------
        int
            Subset of the original series with the 5 first values.

        See Also
        --------
        Series.tail : Return the last 5 elements of the Series.
        Series.iloc : Return a slice of the elements in the Series,
            which can also be used to return the first or last n.

        Examples
        --------
        >>> 1 + 1
        2
        r,   r(   rM   s    r   headzGoodDocStrings.head  s	    . qr      c                     dS )a  
        Return the first elements of the Series.

        This function is mainly useful to preview the values of the
        Series without displaying the whole of it.

        Parameters
        ----------
        n : int
            Number of values to return.

        Returns
        -------
        int
            Subset of the original series with the n first values.

        See Also
        --------
        tail : Return the last n elements of the Series.

        Examples
        --------
        >>> s = 10
        >>> s
        10

        With the `n` parameter, we can change the number of returned rows:

        >>> s + 1
        11
        r,   r(   rN   ns     r   head1zGoodDocStrings.head1.  
    @ qr   c                     dS )a  
        2nd rule of summaries should allow this.

        3 Starting the summary with a number instead of a capital letter.
        Also in parameters, returns, see also...

        Parameters
        ----------
        n : int
            4 Number of values to return.

        Returns
        -------
        int
            5 Subset of the original series with the n first values.

        See Also
        --------
        tail : 6 Return the last n elements of the Series.

        Examples
        --------
        >>> s = 10
        >>> s
        10

        7 With the `n` parameter, we can change the number of returned rows:

        >>> s + 1
        11
        r,   r(   rg   s     r   summary_starts_with_numberz)GoodDocStrings.summary_starts_with_numberP  rj   r   TNaNc                     dS )a  
        Return whether each value contains `pat`.

        In this case, we are illustrating how to use sections, even
        if the example is simple enough and does not require them.

        Parameters
        ----------
        pat : str
            Pattern to check for within each element.
        case : bool, default True
            Whether check should be done with case sensitivity.
        na : object, default np.nan
            Fill value for missing data.

        See Also
        --------
        related : Something related.

        Examples
        --------
        >>> s = 25
        >>> s
        25

        **Case sensitivity**

        With `case_sensitive` set to `False` we can match `a` with both
        `a` and `A`:

        >>> s + 1
        26

        **Missing values**

        We can fill missing values in the output using the `na` parameter:

        >>> s * 2
        50
        Nr(   )rN   patcasenas       r   containszGoodDocStrings.containsr  rP   r   c                     dS )a  
        Ensure reST directives don't affect checks for leading periods.

        The extended summary can be multiple paragraphs, but just one
        is enough to pass the validation.

        Parameters
        ----------
        axis : str
            Sentence ending in period, followed by single directive.

            .. versionchanged:: 0.1.2

        numeric_only : bool
            Sentence ending in period, followed by multiple directives.

            .. versionadded:: 0.1.2
            .. deprecated:: 0.00.0
                A multiline description,
                which spans another line.

        See Also
        --------
        related : Something related.

        Examples
        --------
        >>> result = 1 + 1
        Nr(   )rN   axisnumeric_onlys      r   modezGoodDocStrings.mode  rP   r   c                     dS )a  
        Ensure import other than numpy and pandas are fine.

        The extended summary can be multiple paragraphs, but just one
        is enough to pass the validation.

        See Also
        --------
        related : Something related.

        Examples
        --------
        This example does not import pandas or import numpy.
        >>> import datetime
        >>> datetime.MAXYEAR
        9999
        Nr(   rM   s    r   good_importszGoodDocStrings.good_imports  rP   r   c                     dS )a'  
        Say hello and have no returns.

        The extended summary can be multiple paragraphs, but just one
        is enough to pass the validation.

        See Also
        --------
        related : Something related.

        Examples
        --------
        >>> result = 1 + 1
        Nr(   rM   s    r   
no_returnszGoodDocStrings.no_returns  rP   r   c                 "    d } |             	 dS )a#  
        Say hello and always return None.

        Since this function never returns a value, this
        docstring doesn't need a return section.

        See Also
        --------
        related : Something related.

        Examples
        --------
        >>> result = 1 + 1
        c                      dS )NzHello World!r(   r(   r   r   	say_helloz/GoodDocStrings.empty_returns.<locals>.say_hello  s    !>r   TNr(   )rN   r}   s     r   empty_returnszGoodDocStrings.empty_returns  s(     	" 	" 	" 			Fr   c                     dS )aP  
        Do one thing.

        Sometimes, this function does other things.

        Warnings
        --------
        This function may produce side effects when some condition
        is met.

        See Also
        --------
        related : Something related.

        Examples
        --------
        >>> result = 1 + 1
        Nr(   rM   s    r   warningszGoodDocStrings.warnings  rP   r   c                     dS )a  
        Swap two values in a matrix.

        The extended summary can be multiple paragraphs, but just one
        is enough to pass the validation.

        Parameters
        ----------
        matrix : list of list
            A double list that represents a matrix.
        a, b : int
            The indices of the first value.
        i, j : int
            The indices of the second value.

        See Also
        --------
        related : Something related.

        Examples
        --------
        >>> result = 1 + 1
        Nr(   )rN   matrixabrY   rZ   s         r   multiple_variables_on_one_linez-GoodDocStrings.multiple_variables_on_one_line  rP   r   c                     dS )a  
        Ensure "Other Parameters" are recognized.

        The second parameter is used infrequently, so it is put in the
        "Other Parameters" section.

        Parameters
        ----------
        param1 : bool
            Description of commonly used parameter.

        Other Parameters
        ----------------
        param2 : str
            Description of infrequently used parameter.

        See Also
        --------
        related : Something related.

        Examples
        --------
        >>> result = 1 + 1
        Nr(   )rN   param1param2s      r   other_parameterszGoodDocStrings.other_parameters$  rP   r   c                     dS )a2  
        Ensure a PR06 error is not raised when type is member of a set.

        Literal keywords like 'integer' are valid when specified in a set of
        valid options for a keyword parameter.

        Parameters
        ----------
        bar : {'integer', 'boolean'}
            The literal values of 'integer' and 'boolean' are part of an
            options set and thus should not be subject to PR06 warnings.

        See Also
        --------
        related : Something related.

        Examples
        --------
        >>> result = 1 + 1
        Nr(   )rN   bars     r   +valid_options_in_parameter_description_setsz:GoodDocStrings.valid_options_in_parameter_description_sets>  rP   r   c                     dS )ah  
        Ensure PR01 and PR02 errors are not raised with trailing underscores.

        Parameters with trailing underscores need to be escaped to render
        properly in the documentation since trailing underscores are used to
        create links. Doing so without also handling the change in the validation
        logic makes it impossible to both pass validation and render correctly.

        Parameters
        ----------
        str\_ : str
           Some text.

        See Also
        --------
        related : Something related.

        Examples
        --------
        >>> result = 1 + 1
        Nr(   )rN   str_s     r   $parameters_with_trailing_underscoresz3GoodDocStrings.parameters_with_trailing_underscoresT  rP   r   c                     dS )a  
        Ensure PR06 doesn't fail when non-preferable types are substrings.

        While PR06 checks for parameter types which contain non-preferable type
        names like integer (int), string (str), and boolean (bool), PR06 should
        not fail if those types are used only as susbtrings in, for example,
        custom type names.

        Parameters
        ----------
        a : Myint
           Some text.
        b : intClass
           Some text.
        c : Mystring
           Some text.
        d : stringClass
           Some text.
        e : Mybool
           Some text.
        f : boolClass
           Some text.

        See Also
        --------
        related : Something related.

        Examples
        --------
        >>> result = 1 + 1
        Nr(   )rN   r   r   cdefs          r   (parameter_with_wrong_types_as_substringsz7GoodDocStrings.parameter_with_wrong_types_as_substringsk  rP   r   N)rQ   )re   )r$   r%   r&   r'   rO   rV   r\   r^   r`   rb   rd   ri   rl   floatrr   rv   rx   rz   r~   r   r   r   r   r   r   r(   r   r   rK   rK      sp        = = =   :  2  .  2  *  2       D       D "&%%,, ( ( ( (T  >  &     2  (  2  4  ,  .    r   rK   c                   `    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd ZdS )BadGenericDocStringsz#Everything here has a bad docstringc                     d}d}||z   S )a  Some function.

        With several mistakes in the docstring.

        It has a blank like after the signature `def func():`.

        The text 'Some function' should go in the line after the
        opening quotes of the docstring, not in the same line.

        There is a blank line between the docstring and the first line
        of code `foo = 1`.

        The closing quotes should be in the next line, not in this one.r,   r-   r(   )rN   foor   s      r   funczBadGenericDocStrings.func  s     Syr   c                     dS )zo
        Casts Series type.

        Verb in third-person of the present simple, should be infinitive.
        Nr(   rN   dtypes     r   astypezBadGenericDocStrings.astype  rP   r   c                     dS )zP
        Method to cast Series type.

        Does not start with verb.
        Nr(   r   s     r   astype1zBadGenericDocStrings.astype1  rP   r   c                     dS )zC
        Cast Series type

        Missing dot at the end.
        Nr(   r   s     r   astype2zBadGenericDocStrings.astype2  rP   r   c                     dS )z
        Cast Series type from its current type to the new type defined in
        the parameter dtype.

        Summary is too verbose and doesn't fit in a single line.
        Nr(   r   s     r   astype3zBadGenericDocStrings.astype3  rP   r   c                     dS )z
        Test linebreaks message GL03.

        Note 2 blank lines before parameters section.


        Parameters
        ----------
        foo : str
            Description of foo parameter.
        Nr(   rN   r   s     r   two_linebreaks_between_sectionsz4BadGenericDocStrings.two_linebreaks_between_sections  rP   r   c                     dS )z
        Test linebreaks message GL03.

        Note extra blank line at end of docstring.

        Parameters
        ----------
        foo : str
            Description of foo parameter.

        Nr(   r   s     r   linebreak_at_end_of_docstringz2BadGenericDocStrings.linebreak_at_end_of_docstring  rP   r   c                     dS )aT  
        Generate a plot.

        Render the data in the Series as a matplotlib plot of the
        specified kind.

        Note the blank line between the parameters title and the first
        parameter. Also, note that after the name of the parameter `kind`
        and before the colon, a space is missing.

        Also, note that the parameter descriptions do not start with a
        capital letter, and do not finish with a dot.

        Finally, the `**kwargs` parameter is missing.

        Parameters
        ----------

        kind: str
            kind of matplotlib plot
        Nr(   rN   rS   rU   s      r   rV   zBadGenericDocStrings.plot  rP   r   c                     dS )z
        This section has an unknown section title.

        Unknown Section
        ---------------
        This should raise an error in the validation.
        Nr(   rM   s    r   unknown_sectionz$BadGenericDocStrings.unknown_section  rP   r   c                     dS )a  
        This docstring has the sections in the wrong order.

        Parameters
        ----------
        name : str
            This section is in the right position.

        Examples
        --------
        >>> print("So far Examples is good, as it goes before Parameters")
        So far Examples is good, as it goes before Parameters

        See Also
        --------
        function : This should generate an error, as See Also needs to go
            before Examples.
        Nr(   rM   s    r   sections_in_wrong_orderz,BadGenericDocStrings.sections_in_wrong_order  rP   r   c                     dS )aI  
        This docstring has the deprecation warning in the wrong order.

        This is the extended summary. The correct order should be
        summary, deprecation warning, extended summary.

        .. deprecated:: 1.0
            This should generate an error as it needs to go before
            extended summary.
        Nr(   rM   s    r   deprecation_in_wrong_orderz/BadGenericDocStrings.deprecation_in_wrong_order  rP   r   c                     d S Nr(   rM   s    r   method_wo_docstringsz)BadGenericDocStrings.method_wo_docstrings  s    r   c                     dS )a  
        Ensure reST directives have trailing colons.

        Parameters
        ----------
        first : str
            Sentence ending in period, followed by single directive w/o colons.

            .. versionchanged 0.1.2

        second : bool
            Sentence ending in period, followed by multiple directives w/o
            colons.

            .. versionadded 0.1.2
            .. deprecated 0.00.0

        Nr(   )rN   firstseconds      r   directives_without_two_colonsz2BadGenericDocStrings.directives_without_two_colons  rP   r   N)r$   r%   r&   r'   r   r   r   r   r   r   r   rV   r   r   r   r   r   r(   r   r   r   r     s        --  &              .    (
 
 
      r   r   c                       e Zd ZdZd ZdS )WarnGenericFormatzC
    Those contains things that _may_ be incorrect formatting.
    c                     dS )z~
        The header line is too short.

        Parameters
        ------
        a, b : int
            Foo bar baz.
        Nr(   rN   r   r   s      r   too_short_header_underlinez,WarnGenericFormat.too_short_header_underline7  rP   r   N)r$   r%   r&   r'   r   r(   r   r   r   r   2  s-             r   r   c                   >    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	S )
BadSummariesc                     dS )zM
        Returns
        -------
        int
            Always one.
        Nr(   rM   s    r   
no_summaryzBadSummaries.no_summaryC  rP   r   c                     dS )z{
           Summary with heading whitespaces.

        Returns
        -------
        int
            Always one.
        Nr(   rM   s    r   heading_whitespacesz BadSummaries.heading_whitespacesK  rP   r   c                     dS )z@Quotes are on the wrong line.

        Both opening and closing.Nr(   rM   s    r   
wrong_linezBadSummaries.wrong_lineU  rP   r   c                     dS )z<
        Has the right line but forgets punctuation
        Nr(   rM   s    r   no_punctuationzBadSummaries.no_punctuationZ  rP   r   c                     dS )z/
        provides a lowercase summary.
        Nr(   rM   s    r   no_capitalizationzBadSummaries.no_capitalization_  rP   r   c                     dS )z=
        Started with a verb that is not infinitive.
        Nr(   rM   s    r   no_infinitivezBadSummaries.no_infinitived  rP   r   c                     dS )zG
        Extends beyond one line
        which is not correct.
        Nr(   rM   s    r   
multi_linezBadSummaries.multi_linei  rP   r   c                     dS )z
        Extends beyond one line
        which is not correct.

        Extends beyond one line, which in itself is correct but the
        previous short summary should still be an issue.
        Nr(   rM   s    r   two_paragraph_multi_linez%BadSummaries.two_paragraph_multi_lineo  rP   r   N)r$   r%   r&   r   r   r   r   r   r   r   r   r(   r   r   r   r   B  s            % % %
  
  
  
      r   r   c                   l    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd ZdS )BadParameterszD
    Everything here has a problem with its Parameters section.
    c                     dS )z|
        Lacks the type.

        Parameters
        ----------
        value
            A parameter without type.
        Nr(   rN   values     r   no_typezBadParameters.no_type~  rP   r   c                     dS )z
        Has period after type.

        Parameters
        ----------
        value : str.
            A parameter type should not finish with period.
        Nr(   r   s     r   type_with_periodzBadParameters.type_with_period  rP   r   c                     dS )zc
        Lacks the description.

        Parameters
        ----------
        value : str
        Nr(   r   s     r   no_descriptionzBadParameters.no_description  rP   r   c                     dS )z
        Lacks kwargs in Parameters.

        Parameters
        ----------
        kind : str
            Foo bar baz.
        Nr(   r   s      r   missing_paramszBadParameters.missing_params  rP   r   c                     dS )z
        Has bad spacing in the type line.

        Parameters
        ----------
        kind: str
            Needs a space after kind.
        Nr(   rN   rS   s     r   bad_colon_spacingzBadParameters.bad_colon_spacing  rP   r   c                     dS )z
        Forgets to add a period to the description.

        Parameters
        ----------
        kind : str
           Doesn't end with a dot
        Nr(   r   s     r   no_description_periodz#BadParameters.no_description_period  rP   r   c                     dS )z
        Forgets to add a period, and also includes a directive.

        Parameters
        ----------
        kind : str
           Doesn't end with a dot

           .. versionadded:: 0.00.0
        Nr(   r   s     r   $no_description_period_with_directivez2BadParameters.no_description_period_with_directive  rP   r   c                     dS )z
        Forgets to add a period, and also includes multiple directives.

        Parameters
        ----------
        kind : str
           Doesn't end with a dot

           .. versionchanged:: 0.00.0
           .. deprecated:: 0.00.0
        Nr(   r   s     r   %no_description_period_with_directivesz3BadParameters.no_description_period_with_directives  rP   r   c                     dS )z
        Forgets to capitalize the description.

        Parameters
        ----------
        kind : str
           this is not capitalized.
        Nr(   r   s     r   parameter_capitalizationz&BadParameters.parameter_capitalization  rP   r   c                     dS )z
        Adds a blank line after the section header.

        Parameters
        ----------

        kind : str
            Foo bar baz.
        Nr(   r   s     r   blank_lineszBadParameters.blank_lines  rP   r   c                     dS )z
        Uses integer instead of int.

        Parameters
        ----------
        kind : integer
            Foo bar baz.
        Nr(   r   s     r   integer_parameterzBadParameters.integer_parameter  rP   r   c                     dS )z
        Uses string instead of str.

        Parameters
        ----------
        kind : string
            Foo bar baz.
        Nr(   r   s     r   string_parameterzBadParameters.string_parameter  rP   r   c                     dS )z
        Uses boolean instead of bool.

        Parameters
        ----------
        kind : boolean
            Foo bar baz.
        Nr(   r   s     r   boolean_parameterzBadParameters.boolean_parameter  rP   r   c                     dS )z
        Uses list of boolean instead of list of bool.

        Parameters
        ----------
        kind : list of boolean, integer, float or string
            Foo bar baz.
        Nr(   r   s     r   list_incorrect_parameter_typez+BadParameters.list_incorrect_parameter_type  rP   r   c                     dS )z
        The parameters on the same line have an extra space between them.

        Parameters
        ----------
        a,  b : int
            Foo bar baz.
        Nr(   r   s      r   bad_parameter_spacingz#BadParameters.bad_parameter_spacing  rP   r   N)r$   r%   r&   r'   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r(   r   r   r   r   y  s                     
 
 
    	 	 	            r   r   c                   >    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	S )

BadReturnsc                     dS )z+
        Lacks section for Returns
        Hello world!r(   rM   s    r   return_not_documentedz BadReturns.return_not_documented  s	     ~r   c              #      K   dV  dS )z*
        Lacks section for Yields
        r   Nr(   rM   s    r   yield_not_documentedzBadReturns.yield_not_documented!  s       r   c                     dS )zk
        Returns documented but without type.

        Returns
        -------
        Some value.
        r   r(   rM   s    r   r   zBadReturns.no_type'  	     ~r   c                     dS )z`
        Provides type but no description.

        Returns
        -------
        str
        r   r(   rM   s    r   r   zBadReturns.no_description1  r   r   c                     dS )z
        Provides type and description but no period.

        Returns
        -------
        str
           A nice greeting
        r   r(   rM   s    r   r   zBadReturns.no_punctuation;  	     ~r   c                     dS )z
        Provides name but returns only one value.

        Returns
        -------
        s : str
           A nice greeting.
        r   r(   rM   s    r   named_single_returnzBadReturns.named_single_returnF  r   r   c                     dS )z
        Forgets capitalization in return values description.

        Returns
        -------
        foo : str
           The first returned string.
        bar : str
           the second returned string.
        HellozWorld!r(   rM   s    r   r   zBadReturns.no_capitalizationQ  
     ! r   c                     dS )z
        Forgets period in return values description.

        Returns
        -------
        foo : str
           The first returned string
        bar : str
           The second returned string.
        r  r(   rM   s    r   no_period_multizBadReturns.no_period_multi^  r  r   N)r$   r%   r&   r   r   r   r   r   r  r   r  r(   r   r   r   r     s                	 	 		 	 	! ! !! ! ! ! !r   r   c                   &    e Zd Zd Zd Zd Zd ZdS )
BadSeeAlsoc                     dS )zs
        Return the first 5 elements of the Series.

        See Also
        --------
        Series.tail
        Nr(   rM   s    r   no_desczBadSeeAlso.no_descm  rP   r   c                     dS )a$  
        Return the first 5 elements of the Series.

        See Also
        --------
        Series.tail : Return the last 5 elements of the Series.
        Series.iloc : Return a slice of the elements in the Series,
            which can also be used to return the first or last n
        Nr(   rM   s    r   desc_no_periodzBadSeeAlso.desc_no_periodv  rP   r   c                     dS )a%  
        Return the first 5 elements of the Series.

        See Also
        --------
        Series.tail : return the last 5 elements of the Series.
        Series.iloc : Return a slice of the elements in the Series,
            which can also be used to return the first or last n.
        Nr(   rM   s    r   desc_first_letter_lowercasez&BadSeeAlso.desc_first_letter_lowercase  rP   r   c                     dS )z
        Have `pandas` prefix in See Also section.

        See Also
        --------
        pandas.Series.rename : Alter Series index labels or name.
        DataFrame.head : The first `n` rows of the caller object.
        Nr(   rM   s    r   prefix_pandaszBadSeeAlso.prefix_pandas  rP   r   N)r$   r%   r&   r  r  r  r  r(   r   r   r	  r	  l  sP          	 	 		 	 	    r   r	  c                        e Zd Zd Zd Zd ZdS )BadExamplesc                     dS )zG
        Examples
        --------
        >>> 2 + 5
        7
        Nr(   rM   s    r   -missing_whitespace_around_arithmetic_operatorz9BadExamples.missing_whitespace_around_arithmetic_operator  rP   r   c                     dS )zV
        Examples
        --------
        >>> if 2 + 5:
        ...     pass
        Nr(   rM   s    r   %indentation_is_not_a_multiple_of_fourz1BadExamples.indentation_is_not_a_multiple_of_four  rP   r   c                     dS )zu
        Examples
        --------
        >>> import datetime
        >>> value = datetime.date(2019, 1, 1)
        Nr(   rM   s    r   missing_whitespace_after_commaz*BadExamples.missing_whitespace_after_comma  rP   r   N)r$   r%   r&   r  r  r  r(   r   r   r  r    sA                r   r  c            
       j   e Zd Zd>dZd Zd Zej                            dg d          d             Z	d Z
ej                            dd	g          d
             Zej                            dg d          d             Zej                            dg ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+ ej        d,d-d.ej        j        /          d0d1 ej        d2d3d4ej        j        /          d5d6d7d8d9d:d;d<          d=             ZdS )?TestValidatorNc                 n    d}|rd                     ||g          }|rd                     ||g          }|S )a[  
        Build the required import path for tests in this module.

        Parameters
        ----------
        klass : str
            Class name of object in module.
        func : str
            Function name of object in module.

        Returns
        -------
        str
            Import path of specified object in this module
        znumpydoc.tests.test_validate.)join)rN   klassr   	base_paths       r   _import_pathzTestValidator._import_path  sK      3	 	5)U!344I 	4)T!233Ir   c                     t          |                     dd                    }d                    d |d         D                       }d|vsJ d|vsJ d S )	NrK   rO   r  r    c              3   &   K   | ]}|d          V  dS r,   Nr(   .0errs     r   	<genexpr>z/TestValidator.test_one_liner.<locals>.<genexpr>  s&      ==S#a&======r   errors=should start in the line immediately after the opening quotes0should be placed in the line after the last text)validate_oner!  r  )rN   capsysrH   r+  s       r   test_one_linerzTestValidator.test_one_liner  s    $4;GG
 
 ==F8,<=====K    BOOOOOOr   c                     t          |                     d                    d         }t          |t                    sJ |rJ d S )NrK   r  r+  r.  r!  
isinstancelistrN   r/  r+  s      r   test_good_classzTestValidator.test_good_class  sN    d//6F/GGHHR&$'''''r   r   )rV   r\   r^   r`   rb   rd   ri   rl   rr   rv   rx   rz   r~   r   r   r   r   r   r   c                     t          |                     d|                    d         }t          |t                    sJ |rJ d S )NrK   r#  r+  r3  rN   r/  r   r+  s       r   test_good_functionsz!TestValidator.test_good_functions  sW    2 d//6FT/RRSS
 &$'''''r   c                     t          |                     d                    d         }t          |t                    sJ |sJ d S )Nr   r2  r+  r3  r6  s      r   test_bad_classzTestValidator.test_bad_class  sI    d//6L/MMNNxX&$'''''r   r   c                     t          j        t                    5  t          |                     d|                    }d d d            n# 1 swxY w Y   dt
          j        v sJ d S )Nr   r#  zis too short)r   warnsUserWarningr.  r!  r1   msgr9  s       r   test_bad_generic_functionsz(TestValidator.test_bad_generic_functions   s     \+&& 	 	!!!(;$!GG F	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 &&&&&&s   %AAA)r   r   r   r   r   rV   r   c                     t          |                     d|                    d         }t          |t                    sJ |sJ d S )Nr   r#  r+  r3  r9  s       r   rA  z(TestValidator.test_bad_generic_functions  sW     $:FF
 

 &$'''''r   zklass,func,msgs)r   r   )z(Found unknown section "Unknown Section".)r   r   )zQSections are in the wrong order. Correct order is: Parameters, See Also, Examples)r   r   )z3Deprecation warning should precede extended summary)r   r   )z_reST directives ['versionchanged', 'versionadded', 'deprecated'] must be followed by two colons)r	  r  )z8Missing description for See Also "Series.tail" reference)r	  r  )z?Missing period at end of description for See Also "Series.iloc")r	  r  )z0should be capitalized for See Also "Series.tail")r   r   )zNo summary found)r   r   )z$Summary contains heading whitespaces)r   r   )r,  r-  )r   r   )z"Summary does not end with a period)r   r   )z,Summary does not start with a capital letter)r   r   )z'Summary must start with infinitive verb)r   r   z#Summary should fit in a single line)r   r   rC  )r   r   )zParameter "value" has no type)r   r   )z1Parameter "value" type should not finish with ".")r   r   )z$Parameter "value" has no description)r   r   )z&Parameters {'**kwargs'} not documented)r   r   )zYParameter "kind" requires a space before the colon separating the parameter name and type)r   r   z3Parameter "kind" description should finish with ".")r   r   rD  )r   r   )z?Parameter "kind" description should start with a capital letter)r   r   z;Parameter "kind" type should use "int" instead of "integer")r   r   z:Parameter "kind" type should use "str" instead of "string")r   r   z<Parameter "kind" type should use "bool" instead of "boolean")r   r   rG  )r   r   rE  )r   r   rF  )r   r   )zParameters {'b'} not documentedzUnknown parameters {' b'}r   r   )zNo error yet?)marks)r   r   )zNo Returns section found)r   r   )zNo Yields section foundr   r   )r   )r   r   )zReturn value has no description)r   r   z/Return value description should finish with ".")r   r  )zmThe first line of the Returns section should contain only the type, unless multiple values are being returned)r   r   )z;Return value description should start with a capital letter)r   r  rI  )r   r   )z$The object does not have a docstring)r   r   zDouble line break found; please use only one blank line to separate sections or paragraphs, and do not leave blank lines at the end of docstrings)r   r   rJ  c                 X   t          j        d          5 }t          |                     ||                    }d d d            n# 1 swxY w Y   t	          |          rt          d |D                       sJ |D ]+}|d                    d |d         D                       v sJ ,d S )NT)recordr#  c              3   B   K   | ]}d t          |j                  v V  dS )zUnknown sectionN)strmessage)r(  wws     r   r*  z4TestValidator.test_bad_docstrings.<locals>.<genexpr>  s0      HH(C
OO;HHHHHHr   r$  c              3   &   K   | ]}|d          V  dS r&  r(   r'  s     r   r*  z4TestValidator.test_bad_docstrings.<locals>.<genexpr>  s&      "F"Fc3q6"F"F"F"F"F"Fr   r+  )r   catch_warningsr.  r!  lenr   r  )rN   r/  r  r   msgsr1   rH   r@  s           r   test_bad_docstringsz!TestValidator.test_bad_docstrings   s   x $D111 	MQ!$"3"3%d"3"K"KLLF	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	Mq66 	IHHaHHHHHHHH 	G 	GC#(("F"FVH5E"F"F"FFFFFFFF	G 	Gs   %AAA)NN)r$   r%   r&   r!  r0  r7  r   markparametrizer:  r<  rA  paramxfailrU  r(   r   r   r  r    s          4	P 	P 	P  
 [	
 	
 	
 0 1 0  
 [(	
 ' ' ' [	
 	
 	
    [W	
W	
W	
W	
()W	
89W	
BCW	
LMW	
XYW	
bcW	
lmW	
| X}W	
~W	
HIW	
R USW	
TUW	
`aW	
jkW	
tuW	
~W	
HIW	
XYW	
bcW	
lmW	
vwW	
@AW	
JKW	
TUW	
^_W	
hiW	
rsW	
| FL"k'	  }W	
J SKW	
L QMW	
N FLy(&+BSTTTOW	
P SQW	
RSW	
\]W	
lmW	
vwW	
@AW	
JKW	
\]W	
Z ZvG GwZ ZvG G Gr   r  c                     | S )zTest decorator.r(   )xs    r   	decoratorr\    s    Hr   c                   z    e Zd ZdZd Zed             Zed             Ze	e	e	d                                     Z
dS )DecoratorClassa  
    Class and methods with decorators.

    * `DecoratorClass` has two decorators.
    * `DecoratorClass.test_no_decorator` has no decorator.
    * `DecoratorClass.test_property` has a `@property` decorator.
    * `DecoratorClass.test_cached_property` has a `@cached_property` decorator.
    * `DecoratorClass.test_three_decorators` has three decorators.

    `Validator.source_file_def_line` should return the `def` or `class` line number, not
    the line of the first decorator.
    c                     dS )zTest method without decorators.Nr(   rM   s    r   test_no_decoratorz DecoratorClass.test_no_decorator  rP   r   c                     dS zTest property method.Nr(   rM   s    r   test_propertyzDecoratorClass.test_property  rP   r   c                     dS rb  r(   rM   s    r   test_cached_propertyz#DecoratorClass.test_cached_property   rP   r   c                     dS )z"Test method with three decorators.Nr(   rM   s    r   test_three_decoratorsz$DecoratorClass.test_three_decorators$  rP   r   N)r$   r%   r&   r'   r`  propertyrc  r   re  r\  rg  r(   r   r   r^  r^  	  s         . . . $ $ X$ $ $ _$ 1 1 Y Y Y1 1 1r   r^  c                      e Zd Zej                            dddg          d             Zej                            dddg          d             Zej                            dd	gd
 ee	          d         dz   gd ee	j
                  d         gd ee	j        j                  d         dz   gd ee	j        j                  d         dz   gd ee	j                  d         dz   gg          d             Zej                            ddgd ee	j        j                  gd ee	j        j                  gg          d             ZdS )TestValidatorClassinvalid_nameunknown_modzunknown_mod.MyClassc                     d| d}t          j        t          |          5  t          j        j                            |           d d d            d S # 1 swxY w Y   d S )Nz No module can be imported from ""r   )r   r   ImportErrornumpydocr
   r   	_load_obj)rN   rk  r@  s      r   #test_raises_for_invalid_module_namez6TestValidatorClass.test_raises_for_invalid_module_name,  s    @@@@];c222 	@ 	@'11,???	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@s   %AAAzdatetime.BadClassNamezdatetime.bad_method_namec                    |                     d          }|d         |d         }}d| d| d}t          j        t          |          5  t          j        j                            |           d d d            d S # 1 swxY w Y   d S )Nr  'z' has no attribute 'r   )splitr   r   AttributeErrorrp  r
   r   rq  )rN   rk  name_componentsobj_nameinvalid_attr_namer@  s         r   &test_raises_for_invalid_attribute_namez9TestValidatorClass.test_raises_for_invalid_attribute_name2  s     ',,S11&5b&9?2;N#D(DD0ADDD]>555 	@ 	@'11,???	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@s   
%A<<B B decorated_objdef_linez+numpydoc.tests.test_validate.DecoratorClassru  r-   z=numpydoc.tests.test_validate.DecoratorClass.test_no_decoratorz9numpydoc.tests.test_validate.DecoratorClass.test_propertyr,   z@numpydoc.tests.test_validate.DecoratorClass.test_cached_propertyzAnumpydoc.tests.test_validate.DecoratorClass.test_three_decorators   c                     t           j                            t           j                            t           j        j                            |                              }|j        |k    sJ d S r   )rp  r
   r   	docscraper   rq  source_file_def_line)rN   r}  r~  docs       r   )test_source_file_def_line_with_decoratorsz<TestValidatorClass.test_source_file_def_line_with_decorators<  se    4 ))--!+55mDD 
 

 '8333333r   rh  	file_namec                     t           j                            t           j                            t           j        j                            |                              }|j        |k    sJ d S r   )rp  r
   r   r  r   rq  source_file_name)rN   rh  r  r  s       r   %test_source_file_name_with_propertiesz8TestValidatorClass.test_source_file_name_with_properties]  se     ))--!+55h?? 
 

 #y000000r   N)r$   r%   r&   r   rV  rW  rr  r|  r   r^  r`  rc  fgetre  r   rg  r  r   r  r(   r   r   rj  rj  +  s       [^m=R-STT@ @ UT@
 [02LM @ @ @ [	*% >~..r2Q6
 P~?@@D
 L~;@AA"EI
 S~BGHHLqP
 T~CDDRH1L#	
 24 43 24 [	[! Ln:?@@
 SnAFGG		
 1 1 1 1 1r   rj  c                  <   d } d }| d             }| | | d                                     }t          t          |                    }|j        sJ t          t          |                    }|j        sJ t          t          |                    }|j        sJ dS )ztEnsure that the check for a Yields section when an object is a generator
    (YD01) works with decorated generators.c                 <     t                      fd            }|S )Nc                       | i |S r   r(   )r[   rU   r   s     r   wrapperzLtest_is_generator_validation_with_decorator.<locals>.tinsel.<locals>.wrapperx  s    1d%f%%%r   )r   )r   r  s   ` r   tinselz;test_is_generator_validation_with_decorator.<locals>.tinselw  s3    	q	& 	& 	& 	& 
	& r   c               3   4   K   t          d          E d{V  dS )zA simple generator
   Nranger(   r   r   r   z8test_is_generator_validation_with_decorator.<locals>.foo~  s*      99r   c               3   4   K   t          d          E d{V  dS )zGenerator wrapped oncer  Nr  r(   r   r   r   z8test_is_generator_validation_with_decorator.<locals>.bar  s,       99r   c               3   4   K   t          d          E d{V  dS )z Generator wrapped multiple timesr  Nr  r(   r   r   bazz8test_is_generator_validation_with_decorator.<locals>.baz  s,      
 99r   N)r   r   is_generator_function)r  r   r   r  vs        r   +test_is_generator_validation_with_decoratorr  s  s           V   V V V
 	.%%&&A"""" 	.%%&&A"""" 	.%%&&A""""""r   ).r   
contextlibr   	functoolsr   r   r   inspectr   r   r   numpydoc.testsrp  r
   numpydoc.docscraper   numpydoc.validater   r.  set
ERROR_MSGSkeys
ALL_CHECKSrV  rW  r   r!   r5  r#   r*   r8   rX  rI   rK   r   r   r   r   r   r	  r  r  r\  r^  rj  r  r(   r   r   <module>r     s    " " " " " " 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1            - - - - - - ' ' ' ' ' ' S$))++,,
 z
*	
F8
&	FF+,	 	 	 */?"?@
*x/0
 
> >
 
>
 						 3 3 3/ / / / / / / /G G G j!	#R(	;a&]KD !	

 YM	

 _ !	

 vff-..	
 .M M/ .M W...X.111  $Zm<<<_g+>>>    <D D D D D D D DNb b b b b b b bJ        4 4 4 4 4 4 4 4n^ ^ ^ ^ ^ ^ ^ ^BO! O! O! O! O! O! O! O!d( ( ( ( ( ( ( (V       4PG PG PG PG PG PG PG PGf
  
 
1 1 1 1 1 1 1  1@E1 E1 E1 E1 E1 E1 E1 E1P%# %# %# %# %#r   