
    -Phq                     R   d dl Z d dlZd dlZd dlmZ d dlmZ d dlZ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mZmZ d dlmZ d dlmZ d	Z ej        d
dgddg          d             ZdZ ee          ZdZ e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-dQd!Z.d" Z/d# Z0d$ Z1d% Z2d& Z3d' Z4 ed(          Z5d) Z6 ed*          Z7d+ Z8 ed,          Z9d- Z: ed.          Z;d/ Z<d0 Z=ej>        ?                    d1d
dg          d2             Z@d3 ZAd4 ZBd5 ZCd6 ZD ed7          ZEd8 ZF ed9          ZGd: ZHd; ZId< ZJd= ZKd> ZLd? ZMd@ ZNdAZOdB ZPdC ZQdD ZRdE ZSdF ZTdG ZUdH ZVdIZWdJZXdK ZYdL ZZdM Z[dN Z\dO Z]e^dPk    rd dlZ ej_                     dS dS )R    N
namedtuple)deepcopy)warns)ClassDocFunctionDocNumpyDocString)SphinxClassDocSphinxDocStringSphinxFunctionDocget_doc_object)update_config)DEFAULT_LINKSaI    numpy.multivariate_normal(mean, cov, shape=None, spam=None)

  Draw values from a multivariate normal distribution with specified
  mean and covariance.

  The multivariate normal or Gaussian distribution is a generalisation
  of the one-dimensional normal distribution to higher dimensions.

  Parameters
  ----------
  mean : (N,) ndarray
      Mean of the N-dimensional distribution.

      .. math::

         (1+2+3)/3

  cov : (N, N) ndarray
      Covariance matrix of the distribution.
  shape : tuple of ints
      Given a shape of, for example, (m,n,k), m*n*k samples are
      generated, and packed in an m-by-n-by-k arrangement.  Because
      each sample is N-dimensional, the output shape is (m,n,k,N).
  dtype : data type object, optional (default : float)
      The type and size of the data to be returned.

  Returns
  -------
  out : ndarray
      The drawn samples, arranged according to `shape`.  If the
      shape given is (m,n,...), then the shape of `out` is
      (m,n,...,N).

      In other words, each entry ``out[i,j,...,:]`` is an N-dimensional
      value drawn from the distribution.
  list of str
      This is not a real return value.  It exists to test
      anonymous return values.
  no_description

  Other Parameters
  ----------------
  spam : parrot
      A parrot off its mortal coil.

  Raises
  ------
  RuntimeError
      Some error

  Warns
  -----
  RuntimeWarning
      Some warning

  Warnings
  --------
  Certain warnings apply.

  Notes
  -----
  Instead of specifying the full covariance matrix, popular
  approximations include:

    - Spherical covariance (`cov` is a multiple of the identity matrix)
    - Diagonal covariance (`cov` has non-negative elements only on the diagonal)

  This geometrical property can be seen in two dimensions by plotting
  generated data-points:

  >>> mean = [0,0]
  >>> cov = [[1,0],[0,100]] # diagonal covariance, points lie on x or y-axis

  >>> x,y = multivariate_normal(mean,cov,5000).T
  >>> plt.plot(x,y,'x'); plt.axis('equal'); plt.show()

  Note that the covariance matrix must be symmetric and non-negative
  definite.

  References
  ----------
  .. [1] A. Papoulis, "Probability, Random Variables, and Stochastic
         Processes," 3rd ed., McGraw-Hill Companies, 1991
  .. [2] R.O. Duda, P.E. Hart, and D.G. Stork, "Pattern Classification,"
         2nd ed., Wiley, 2001.

  See Also
  --------
  some, other, funcs
  otherfunc : relationship
  :py:meth:`spyder.widgets.mixins.GetHelpMixin.show_object_info`

  Examples
  --------
  >>> mean = (1,2)
  >>> cov = [[1,0],[1,0]]
  >>> x = multivariate_normal(mean,cov,(3,3))
  >>> print(x.shape)
  (3, 3, 2)

  The following is probably true, given that 0.6 is roughly twice the
  standard deviation:

  >>> print(list((x[0, 0, :] - mean) < 0.6))
  [True, True]

  .. index:: random
     :refguide: random;distributions, random;gauss

   z
    flushnewline_indented)paramsidsc                 :    t          | j        t          z             S N)r	   paramdoc_txt)requests    ]/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numpydoc/tests/test_docscrape.pydocr      s    '-'1222    z
Test generator

Yields
------
a : int
    The number of apples.
b : int
    The number of bananas.
int
    The number of unknowns.
z
Test generator

Yields
------
a : int
    The number of apples.

Receives
--------
b : int
    The number of bananas.
c : int
    The number of oranges.

c                 z    | d                              d          sJ | d                             d          sJ d S )N	Signatureznumpy.multivariate_normal(z
spam=None)
startswithendswithr   s    r   test_signaturer#      sG    {&&'CDDDDD{$$\2222222r   c                     | d         d                              d          sJ | d         d                             d          sJ d S )NSummaryr   zDraw valueszcovariance.r   r"   s    r   test_summaryr'      sN    y>!''66666y>"&&}5555555r   c                 L    | d         d                              d          sJ d S )NExtended Summaryr   zThe multivariate normal)r    r"   s    r   test_extended_summaryr*      s.    !"1%001JKKKKKKKr   c                    t          | d                   dk    sJ d | d         D             }t          d t          |g d          D                       sJ | d         d         \  }}}|dk    sJ |d                             d	          sJ | d         d         d
         d
         dk    sJ | d         d         \  }}}|dk    sJ |dk    sJ |d                             d          sJ | d         d         d
         d
         dk    sJ | d         d         \  }}}|dk    sJ |dk    sJ |d                             d          sJ d S )N
Parameters   c                     g | ]\  }}}|	S  r/   .0n_s      r   
<listcomp>z#test_parameters.<locals>.<listcomp>   s    00071aQ000r   c              3   (   K   | ]\  }}||k    V  d S r   r/   )r1   abs      r   	<genexpr>z"test_parameters.<locals>.<genexpr>   s*      GG$!QqAvGGGGGGr   )meancovshape   z(N, N) ndarrayr   zCovariance matrixr&   z   (1+2+3)/3   r;   ztuple of intsGiven   dtypez,data type object, optional (default : float)zThe type and size)lenallzipr    )r   namesargarg_typedescs        r   test_parametersrH      s   s< !!Q&&&&00c,/000EGG#e-E-E-E"F"FGGGGGGGGl+A.C4'''''7122222|Q#B'>9999l+A.C4'>>>>&&&&7g&&&&&|Q#B'>9999l+A.C4'>>>>EEEEE712222222r   c                     t          | d                   dk    sJ d | d         D             dgk    sJ | d         d         \  }}}|dk    sJ |d                             d          sJ d S )NzOther Parametersr<   c                     g | ]\  }}}|	S r/   r/   r0   s      r   r4   z)test_other_parameters.<locals>.<listcomp>   s    555'!QA555r   spamr   parrotzA parrot off its mortal coil)rA   r    r   rE   rF   rG   s       r   test_other_parametersrN      s    s%&''1,,,,55S!34555&AAAA01!4C4x7<=======r   c                 B   t          | d                   dk    sJ | d         d         \  }}}|dk    sJ |dk    sJ |d                             d          sJ |d                             d          sJ | d         d	         \  }}}|d
k    sJ |dk    sJ |d                             d          sJ |d                             d          sJ | d         d         \  }}}|d
k    sJ |dk    sJ d
                    |                                          rJ d S )NReturnsr?   r   outndarrayzThe drawn samplesr&   zdistribution.r<   r   zlist of strzThis is not a realzanonymous return values.r=   no_description)rA   r    r!   joinstriprM   s       r   test_returnsrV      s\   s9~!####i.+C4%<<<<y    71222228_-----i.+C4"9999}$$$$72333338788888i.+C4"9999'''''wwt}}""$$$$$$$r   c                  "   t           d         } t          |           dk    sJ g d}t          | |          D ]W\  \  }}}\  }}}||k    sJ ||k    sJ |d                             d          sJ |d                             |          sJ Xd S )NYieldsr?   ))r6   intzapples.r7   rY   zbananas.)r   rY   z	unknowns.r   The number of)
doc_yieldsrA   rC   r    r!   sectiontruthrE   rF   rG   arg_	arg_type_ends           r   test_yieldsrc      s    "Gw<<1  E
 :=We9L9L % %5h5id{{{{9$$$$Aw!!/22222Aw$$$$$$	% %r   c                  "   t           d         } t          |           dk    sJ ddg}t          | |          D ]W\  \  }}}\  }}}||k    sJ ||k    sJ |d                             d          sJ |d                             |          sJ Xd S )NReceivesr=   rZ   )crY   zoranges.r   r[   )doc_sentrA   rC   r    r!   r]   s           r   	test_sentrh      s    z"Gw<<1%'?@E9<We9L9L % %5h5id{{{{9$$$$Aw!!/22222Aw$$$$$$	% %r   c                      d} t          |           }t          |d                   dk    sJ t          |d                   dk    sJ d S )Nz
Test having returns and yields.

Returns
-------
int
    The number of apples.

Yields
------
a : int
    The number of apples.
b : int
    The number of bananas.

rP   r<   rX   r=   )r	   rA   )doc_textr   s     r   test_returnyieldrk     sX    H  
"
"Cs9~!####s8}""""""r   c                     d} t          j        t          d          5  t          |            d d d            n# 1 swxY w Y    G d d          }d }t          j        t          d          5  t	          |           d d d            n# 1 swxY w Y   t          j        t          d          5  t          |           d d d            d S # 1 swxY w Y   d S )	Nzy
Test having a section Notes twice

Notes
-----
See the next note for more information

Notes
-----
That should break...
zThe section Notes appears twicematchc                       e Zd ZdZd Zd ZdS )!test_section_twice.<locals>.Dummyz
        Dummy class.

        Notes
        -----
        First note.

        Notes
        -----
        Second note.

        c                     dS zSpam

Spam spam.Nr/   selfr6   r7   s      r   rK   z&test_section_twice.<locals>.Dummy.spam;        r   c                     dS zCheese

No cheese.Nr/   rt   rf   ds      r   hamz%test_section_twice.<locals>.Dummy.ham>  ru   r   N)__name__
__module____qualname____doc__rK   rz   r/   r   r   Dummyrp   -  s<        	 		% 	% 	%	' 	' 	' 	' 	'r   r   c                     dS )z
        Dummy function.

        Notes
        -----
        First note.

        Notes
        -----
        Second note.
        Nr/   )rE   s    r   
dummy_funcz&test_section_twice.<locals>.dummy_funcA  ru   r   zDummy classr   )pytestraises
ValueErrorr	   r
   r   )rj   r   r   s      r   test_section_twicer     s   
H 
z)J	K	K	K ! !x   ! ! ! ! ! ! ! ! ! ! ! ! ! ! !' ' ' ' ' ' ' '(   
z	7	7	7  u               
z	6	6	6 & &*%%%& & & & & & & & & & & & & & & & & &s1   :>>0BBB2CCCc                     | d         d                              d          sJ | d         d                             d          sJ t          | d                   dk    sJ d S )NNotesr   Insteadr&   z	definite.   )r    r!   rA   r"   s    r   
test_notesr   U  sj    w<?%%i00000w<$$[11111s7|""""""r   c                     | d         d                              d          sJ | d         d                             d          sJ d S )N
Referencesr   z..r&   z2001.r   r"   s    r   test_referencesr   [  sP    |Q**400000|R ))'2222222r   c                     | d         d                              d          sJ | d         d                             d          sJ d S )NExamplesr   z>>>r&   zTrue]r   r"   s    r   test_examplesr   `  sN    z?1((/////z?2''0000000r   c                     | d         d         dk    sJ t          | d                   dk    sJ t          | d         d                   dk    sJ d S )Nindexdefaultrandomr=   refguide)rA   r"   s    r   
test_indexr   e  sa    w<	"h....s7|!!!!s7|J'((A------r   c                     t          j        dd|           } t          j        dd|           } t          j        dd|           } | S )z1Remove leading, trailing and multiple blank linesz^\s*\nr   z\n\s*$z\n\s*\nz\n\n)resub)ss    r   _strip_blank_linesr   k  s@    
y"a  A
y"a  A
z7A&&AHr   c                    t          j        |           } t          j        |          }d t          |                               d          D             d |         } d t          |                              d          D             d |         }t	          |           t	          |          k    sJ t          t          | |                    D ]\  }\  }}||k    sJ d S )Nc                 6    g | ]}|                                 S r/   rstripr1   ls     r   r4   z(line_by_line_compare.<locals>.<listcomp>v       ??????r   
c                 6    g | ]}|                                 S r/   r   r   s     r   r4   z(line_by_line_compare.<locals>.<listcomp>w  r   r   )textwrapdedentr   splitrA   	enumeraterC   )r6   r7   n_linesiiaabbs         r   line_by_line_comparer   s  s    AA??/2288>>???IA??/2288>>???IAq66SVV!#a)),,  HRRxxxxx r   c                 @    t          t          |           d           d S )Na
  numpy.multivariate_normal(mean, cov, shape=None, spam=None)

Draw values from a multivariate normal distribution with specified
mean and covariance.

The multivariate normal or Gaussian distribution is a generalisation
of the one-dimensional normal distribution to higher dimensions.

Parameters
----------
mean : (N,) ndarray
    Mean of the N-dimensional distribution.

    .. math::

       (1+2+3)/3
cov : (N, N) ndarray
    Covariance matrix of the distribution.
shape : tuple of ints
    Given a shape of, for example, (m,n,k), m*n*k samples are
    generated, and packed in an m-by-n-by-k arrangement.  Because
    each sample is N-dimensional, the output shape is (m,n,k,N).
dtype : data type object, optional (default : float)
    The type and size of the data to be returned.

Returns
-------
out : ndarray
    The drawn samples, arranged according to `shape`.  If the
    shape given is (m,n,...), then the shape of `out` is
    (m,n,...,N).

    In other words, each entry ``out[i,j,...,:]`` is an N-dimensional
    value drawn from the distribution.
list of str
    This is not a real return value.  It exists to test
    anonymous return values.
no_description

Other Parameters
----------------
spam : parrot
    A parrot off its mortal coil.

Raises
------
RuntimeError
    Some error

Warns
-----
RuntimeWarning
    Some warning

Warnings
--------
Certain warnings apply.

See Also
--------

`some`_, `other`_, `funcs`_
    ..
`otherfunc`_
    relationship
:py:meth:`spyder.widgets.mixins.GetHelpMixin.show_object_info`
    ..

Notes
-----
Instead of specifying the full covariance matrix, popular
approximations include:

  - Spherical covariance (`cov` is a multiple of the identity matrix)
  - Diagonal covariance (`cov` has non-negative elements only on the diagonal)

This geometrical property can be seen in two dimensions by plotting
generated data-points:

>>> mean = [0,0]
>>> cov = [[1,0],[0,100]] # diagonal covariance, points lie on x or y-axis

>>> x,y = multivariate_normal(mean,cov,5000).T
>>> plt.plot(x,y,'x'); plt.axis('equal'); plt.show()

Note that the covariance matrix must be symmetric and non-negative
definite.

References
----------
.. [1] A. Papoulis, "Probability, Random Variables, and Stochastic
       Processes," 3rd ed., McGraw-Hill Companies, 1991
.. [2] R.O. Duda, P.E. Hart, and D.G. Stork, "Pattern Classification,"
       2nd ed., Wiley, 2001.

Examples
--------
>>> mean = (1,2)
>>> cov = [[1,0],[1,0]]
>>> x = multivariate_normal(mean,cov,(3,3))
>>> print(x.shape)
(3, 3, 2)

The following is probably true, given that 0.6 is roughly twice the
standard deviation:

>>> print(list((x[0, 0, :] - mean) < 0.6))
[True, True]

.. index:: random
   :refguide: random;distributions, random;gauss)r   strr"   s    r   test_strr   }  s4     Cn	4q q q q qr   c                  J    t          t          t                    d           d S )NzTest generator

Yields
------
a : int
    The number of apples.
b : int
    The number of bananas.
int
    The number of unknowns.
)r   r   r\   r/   r   r   test_yield_strr     s,    J
	    r   c                  J    t          t          t                    d           d S )NzTest generator

Yields
------
a : int
    The number of apples.

Receives
--------
b : int
    The number of bananas.
c : int
    The number of oranges.
)r   r   rg   r/   r   r   test_receives_strr     s,    H	    r   c                      dt          t          d                    vsJ dt          t          d                    v sJ dt          t          d                    v sJ d S )Nr   zTest idx

    z%Test idx

    .. index :: random
    z*Test idx

    .. index ::
        foo
    )r   r	   r/   r   r   test_no_index_in_strr     s    #	
 	
      c	
 	
      c	
 	
       r   c                  h    t          t                    } t          t          |           d           d S )NaA  
.. index:: random
   single: random;distributions, random;gauss

Draw values from a multivariate normal distribution with specified
mean and covariance.

The multivariate normal or Gaussian distribution is a generalisation
of the one-dimensional normal distribution to higher dimensions.

:Parameters:

    **mean** : (N,) ndarray
        Mean of the N-dimensional distribution.

        .. math::

           (1+2+3)/3

    **cov** : (N, N) ndarray
        Covariance matrix of the distribution.

    **shape** : tuple of ints
        Given a shape of, for example, (m,n,k), m*n*k samples are
        generated, and packed in an m-by-n-by-k arrangement.  Because
        each sample is N-dimensional, the output shape is (m,n,k,N).

    **dtype** : data type object, optional (default : float)
        The type and size of the data to be returned.

:Returns:

    **out** : ndarray
        The drawn samples, arranged according to `shape`.  If the
        shape given is (m,n,...), then the shape of `out` is
        (m,n,...,N).

        In other words, each entry ``out[i,j,...,:]`` is an N-dimensional
        value drawn from the distribution.

    list of str
        This is not a real return value.  It exists to test
        anonymous return values.

    no_description
        ..

:Other Parameters:

    **spam** : parrot
        A parrot off its mortal coil.

:Raises:

    RuntimeError
        Some error

:Warns:

    RuntimeWarning
        Some warning

.. warning::

    Certain warnings apply.

.. seealso::

    :obj:`some`, :obj:`other`, :obj:`funcs`
        ..
    :obj:`otherfunc`
        relationship
    :py:meth:`spyder.widgets.mixins.GetHelpMixin.show_object_info`
        ..

.. rubric:: Notes

Instead of specifying the full covariance matrix, popular
approximations include:

  - Spherical covariance (`cov` is a multiple of the identity matrix)
  - Diagonal covariance (`cov` has non-negative elements only on the diagonal)

This geometrical property can be seen in two dimensions by plotting
generated data-points:

>>> mean = [0,0]
>>> cov = [[1,0],[0,100]] # diagonal covariance, points lie on x or y-axis

>>> x,y = multivariate_normal(mean,cov,5000).T
>>> plt.plot(x,y,'x'); plt.axis('equal'); plt.show()

Note that the covariance matrix must be symmetric and non-negative
definite.

.. rubric:: References

.. [1] A. Papoulis, "Probability, Random Variables, and Stochastic
       Processes," 3rd ed., McGraw-Hill Companies, 1991
.. [2] R.O. Duda, P.E. Hart, and D.G. Stork, "Pattern Classification,"
       2nd ed., Wiley, 2001.

.. only:: latex

   [1]_, [2]_

.. rubric:: Examples

>>> mean = (1,2)
>>> cov = [[1,0],[1,0]]
>>> x = multivariate_normal(mean,cov,(3,3))
>>> print(x.shape)
(3, 3, 2)

The following is probably true, given that 0.6 is roughly twice the
standard deviation:

>>> print(list((x[0, 0, :] - mean) < 0.6))
[True, True]
)r   r   r   r   
sphinx_docs    r   test_sphinx_strr   7  s?     ))JJw	z z z z zr   c                  h    t          t                    } t          t          |           d           d S )NzTest generator

:Yields:

    **a** : int
        The number of apples.

    **b** : int
        The number of bananas.

    int
        The number of unknowns.
)r   doc_yields_txtr   r   r   s    r   test_sphinx_yields_strr     s9     00JJ	    r   a  
    Returns array of indices of the maximum values of along the given axis.

    Parameters
    ----------
    a : {array_like}
        Array to look in.
    axis : {None, integer}
        If None, the index is into the flattened array, otherwise along
        the specified axisc                  F    t          t          d                   dk    sJ d S )Nr,   r=   )rA   doc2r/   r   r   ,test_parameters_without_extended_descriptionr     s&    tL!""a''''''r   zB
    my_signature(*params, **kwds)

    Return this and that.
    c                      t          t                                        d          d         } | dk    sJ d }t          |          }|d         dk    sJ d S )Nr   r   z my_signature(\*params, \*\*kwds)c                     d S r   r/   )r6   r7   kwargss      r   my_funcz"test_escape_stars.<locals>.my_func  s    r   )funcr   r   )r   doc3r   r   )	signaturer   fdocs      r   test_escape_starsr     sm    D		%%a(I;;;;;   G$$$D""""""r   zJa.conj()

    Return an array with all complex-valued elements conjugated.c                  ,    t           d         g k    sJ d S )Nr)   )doc4r/   r   r   test_empty_extended_summaryr     s    "#r))))))r   z
    a.something()

    Raises
    ------
    LinAlgException
        If array is singular.

    Warns
    -----
    SomeWarning
        If needed
    c                      t          t          d                   dk    sJ t          d         d         } | j        dk    sJ | j        dk    sJ | j        dgk    sJ d S )NRaisesr<   r   r   LinAlgExceptionzIf array is singular.rA   doc5nametyperG   r   s    r   test_raisesr     sq    tH~!####N1E::*****:12222222r   c                      t          t          d                   dk    sJ t          d         d         } | j        dk    sJ | j        dk    sJ | j        dgk    sJ d S )NWarnsr<   r   r   SomeWarningz	If neededr   r   s    r   
test_warnsr     sn    tG}""""M!E::&&&&:+&&&&&&r   prefixc                    t          | dz             }t          |d                   dk    sJ |d         D ]\  }}|D ]\  }}|dv r|rJ t          ||g                      n;|dv r|sJ t          ||g                      n|sJ t          ||g                      |dk    r	|dk    sJ nD|dv r	|d	k    sJ n7|d
k    r	|dk    sJ n(|dv r	|dk    sJ n|J t          ||g                      |dk    r
|dgk    sJ |dk    r|ddgk    sJ |d
k    r|ddgk    sJ |dv r!|dgk    sJ t          |dgg                      d S )Na  z(x,theta)

    See Also
    --------
    func_a, func_b, func_c
    func_d : some equivalent func
    foo.func_e : some other func over
             multiple lines
    func_f, func_g, :meth:`func_h`, func_j,
    func_k
    func_f1, func_g1, :meth:`func_h1`, func_j1
    func_f2, func_g2, :meth:`func_h2`, func_j2 : description of multiple
    :obj:`baz.obj_q`
    :obj:`~baz.obj_r`
    :class:`class_j`: fubar
        foobar
    zSee Also
   )func_afunc_bfunc_cfunc_ffunc_gfunc_hfunc_jfunc_k	baz.obj_qfunc_f1func_g1func_h1func_j1
~baz.obj_r)func_f2func_g2func_h2func_j2r   meth)r   r   objclass_jclass)r   r   func_dzsome equivalent funcz
foo.func_ezsome other func overzmultiple linesfubarfoobarzdescription of multiple)r	   rA   r   )r   doc6funcsrG   r   roles         r   test_see_alsor   "  s1   	 D* tJ  B&&&&J' , ,t +	 +	JD$      22dD\!2!22222EEE..S$........S$.....xv~~~~~444u}}}}}""w///v~~~~~||S$%6%6|||x 6777777%% 68HIIIIII""222222EEE 9::::C567= =:::S+	, ,r   c                      d} t          j        t          d          5  t          |            d d d            d S # 1 swxY w Y   d S )Nz@
    z(x,theta)

    See Also
    --------
    :func:`~foo`
    zSee Also entry ':func:`~foo`'rm   )r   r   r   r	   )texts    r   test_see_also_parse_errorr   i  s    D 
z)H	I	I	I  t                 s   ;??c                       G d d          } t          t          | d                    }d|v sJ d|v sJ d|v sJ d S )Nc                       e Zd ZdZdS )"test_see_also_print.<locals>.Dummyz
        See Also
        --------
        func_a, func_b
        func_c : some relationship
                 goes here
        func_d
        Nr{   r|   r}   r~   r/   r   r   r   r   v  s        	 	 	 	r   r   r   )r   z:func:`func_a`, :func:`func_b`z    some relationshipz:func:`func_d`)r   r   )r   r   s     r   test_see_also_printr  u  s            	KF+++,,A+q0000"a''''q      r   c                      t          j        d           t          t          d          5  t	          d           d d d            d S # 1 swxY w Y   d S )NerrorzEUnexpected comma or period after function list at index 43 of line .*rm   z
            z(x,theta)

            See Also
            --------
            func_f2, func_g2, :meth:`func_h2`, func_j2, : description of multiple
            :class:`class_j`: fubar
                foobar
            )warningsfilterwarningsassert_warnsWarningr	   r/   r   r   $test_see_also_trailing_comma_warningr    s    G$$$	U
 
 
 
 
 	
	
 
	
 
	
	
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
s   AAAc                     d}  G d d          }t          j        t          d          5 }t          |            d d d            n# 1 swxY w Y   t	          |          dk    sJ d}t          j        t          |          5 }t          |           d d d            n# 1 swxY w Y   t	          |          dk    sJ d S )NzS
Test having an unknown section

Mope
----
This should be ignored and warned about
c                       e Zd ZdZdS )(test_unknown_section.<locals>.BadSectionzbClass with bad section.

        Nope
        ----
        This class has a nope section.
        Nr   r/   r   r   
BadSectionr    s        	 	 	 	r   r  zUnknown section Moperm   r<   z3Unknown section Nope in the docstring of BadSection)r   r   UserWarningr	   rA   r
   )rj   r  record	msg_matchs       r   test_unknown_sectionr    sZ   H        
k)?	@	@	@ !Fx   ! ! ! ! ! ! ! ! ! ! ! ! ! ! !v;;! FI	k	3	3	3 #vz"""# # # # # # # # # # # # # # #v;;!s#   AAAB  B$'B$z.

        Doc starts on second line.

        c                  V    t           d         d                             d          sJ d S )Nr%   r   z
Doc starts)doc7r    r/   r   r   test_empty_first_liner    s+    	?1((6666666r   z

        Parameters with colon and no types:

        Parameters
        ----------

        data :
            some stuff, technically invalid
        c                      t          d          } d}| d         d         j        |k    sJ |t          |           v sJ dS )z{Make sure colons that are part of sphinx roles are not misinterpreted
    as type separator in returns section. See gh-428.zP
        Returns
        -------
        str or :class:`NumpyDocString`
        zstr or :class:`NumpyDocString`rP   r   N)r	   r   r   )	docstringexpecteds     r    test_returns_with_roles_no_namesr    sZ     	 I 0HY"'83333s9~~%%%%%%r   c                  B    t           d         d         j        dk    sJ d S )Nr,   r   data)doc8r   r/   r   r   test_trailing_colonr    s&    a %//////r   c                  >    t          t          d                     d S )Nz
    Parameters
    ----------)r   r   r/   r   r   test_no_summaryr    s0    	
 	
    r   c                      t          d          } t          | d         d         t                    sJ | d         d         dk    sJ d S )Nu   
    öäöäöäöäöåååå

    öäöäöäööäååå

    Parameters
    ----------
    ååå : äää
        ööö

    Returns
    -------
    ååå : ööö
        äää

    r%   r   u   öäöäöäöäöåååå)r   
isinstancer   r"   s    r   test_unicoder     sX    
	 C$ c)nQ'-----y>! <<<<<<<r   c                     t          d          } t          d|           }dt          |          v sJ t          |                      t          d|           }dt          |          v sJ t          |                      t          d|           }t          |                              d          dk    sJ t          |                      d S )	NT)	use_plotsz|
    Examples
    --------
    >>> import matplotlib.pyplot as plt
    >>> plt.plot([1,2,3],[4,5,6])
    >>> plt.show()
    configzplot::z
    Examples
    --------
    >>> from matplotlib import pyplot as plt
    >>> plt.plot([1,2,3],[4,5,6])
    >>> plt.show()
    z
    Examples
    --------
    .. plot::

       import matplotlib.pyplot as plt
       plt.plot([1,2,3],[4,5,6])
       plt.show()
    r<   )dictr   r   countcfgr   s     r   test_plot_examplesr)    s    



C
	 	 	 	C s3xxS
	 	 	 	C s3xxS
	   C s88>>(##q(((#c(((((((r   c                  	    G d d          } t           t          fD ]} || t          d                    }dt          |          vsJ |t          |          f            dt          |          vsJ |t          |          f            dt          |          vsJ |t          |          f            d	t          |          vsJ |t          |          f            d
t          |          vsJ |t          |          f             || t          d                    }dt          |          v sJ |t          |          f            dt          |          v sJ |t          |          f            dt          |          v sJ |t          |          f            d	t          |          v sJ |t          |          f            |t          u r*dt          |          v sJ t          |                      d
t          |          v sJ t          |                       G d d|           }t           t          fD ]} ||t          dd                    }dt          |          v sJ |t          |          f            dt          |          vsJ |t          |          f            dt          |          v sJ |t          |          f            dt          |          v sJ |t          |          f            d	t          |          vsJ |t          |          f            |t          u r)dt          |          v sJ t          |                      n(d
t          |          vsJ t          |                       ||t          dd                    }dt          |          v sJ |t          |          f            dt          |          v sJ |t          |          f            dt          |          v sJ |t          |          f            dt          |          v sJ |t          |          f            d	t          |          v sJ |t          |          f            |t          u r*dt          |          v sJ t          |                      ld
t          |          v sJ t          |                      d S )Nc                   N    e Zd ZdZd Zd Zed             Z G d d          ZdS )!test_class_members.<locals>.Dummyz
        Dummy class.

        c                     dS rr   r/   rs   s      r   rK   z&test_class_members.<locals>.Dummy.spam6  ru   r   c                     dS rw   r/   rx   s      r   rz   z%test_class_members.<locals>.Dummy.ham9  ru   r   c                     dS )Spammity indexgffffff?r/   rt   s    r   spammityz*test_class_members.<locals>.Dummy.spammity<  s	     4r   c                       e Zd ZdZdS )+test_class_members.<locals>.Dummy.Ignorablezlocal class, to be ignoredNr   r/   r   r   	Ignorabler4  A  s        ,,,,r   r5  N)	r{   r|   r}   r~   rK   rz   propertyr2  r5  r/   r   r   r   r,  0  s        	 	
	% 	% 	%	' 	' 	' 
	 	 
		- 	- 	- 	- 	- 	- 	- 	- 	- 	-r   r   F)show_class_membersr#  MethodsrK   rz   r2  r0  Tz.. autosummary::c                       e Zd ZdZd Zd ZdS )$test_class_members.<locals>.SubDummyz+
        Subclass of Dummy class.

        c                     dS )z'Cheese

No cheese.
Overloaded Dummy.hamNr/   rx   s      r   rz   z(test_class_members.<locals>.SubDummy.ham]  ru   r   c                     dS )zBar

No barNr/   rs   s      r   barz(test_class_members.<locals>.SubDummy.bar`  ru   r   N)r{   r|   r}   r~   rz   r=  r/   r   r   SubDummyr:  W  s<        	 	
	= 	= 	=	  	  	  	  	 r   r>  r7  show_inherited_class_membersr=  )r   r
   r%  r   )r   clsr   r>  s       r   test_class_membersrB  /  s7   - - - - - - - -( .) : :c% > > >???C(((3C/(((SXX%%%SXX%%%CHH$$$sCHHo$$$S)))CS?)))s3xx///#s3xx///c% = = =>>>CHH$$$sCHHo$$$S!!!CS?!!!C   3C/   SXX%%%SXX%%%.  %S1113s881111#s3xx///S////
  
  
  
  
 5 
  
  
  .) : :c4eTTT
 
 
 CHH$$$sCHHo$$$SXX%%%SXX%%%C   3C/   C   3C/   S)))CS?))).  %S1113s881111#3s88333SXX333c4dSSS
 
 
 CHH$$$sCHHo$$$S!!!CS?!!!C   3C/   C   3C/   SXX%%%SXX%%%.  %S1113s881111#s3xx///S////;: :r   c                  d    t          d          } | d                                         dk    sJ d S )Nz$
    z(x1, x2)

    z(a, theta)
    r   zz(a, theta))r	   rU   r"   s    r   test_duplicate_signaturerD    sB    
 	 C {!!##}444444r   a  
    Foo

    Parameters
    ----------
    f : callable ``f(t, y, *f_args)``
        Aaa.
    jac : callable ``jac(t, y, *jac_args)``

        Bbb.

    Attributes
    ----------
    t : float
        Current time.
    y : ndarray
        Current variable values.

        * hello
        * world
    an_attribute : float
        The docstring is printed instead
    no_docstring : str
        But a description
    no_docstring2 : str
    multiline_sentence
    midword_period
    no_period

    Methods
    -------
    a
    b
    c

    Other Parameters
    ----------------

    another parameter : str
        This parameter is less important.

    Notes
    -----

    Some notes about the class.

    Examples
    --------
    For usage examples, see `ode`.
c                  j    t          d t                    } t          t          |           d           d S )Na   
    Foo

    Parameters
    ----------
    f : callable ``f(t, y, *f_args)``
        Aaa.
    jac : callable ``jac(t, y, *jac_args)``
        Bbb.

    Attributes
    ----------
    t : float
        Current time.
    y : ndarray
        Current variable values.

        * hello
        * world
    an_attribute : float
        The docstring is printed instead
    no_docstring : str
        But a description
    no_docstring2 : str
    multiline_sentence
    midword_period
    no_period

    Methods
    -------
    a
    b
    c

    Other Parameters
    ----------------
    another parameter : str
        This parameter is less important.

    Notes
    -----
    Some notes about the class.

    Examples
    --------
    For usage examples, see `ode`.

    )r   class_doc_txtr   r   r"   s    r   test_class_members_docrG    s;    
4
'
'CC/	2 2 2 2 2r   c                       G d d          } t          | t                    }t          t          |          d           d S )Nc                       e Zd Zed             Zed             Zed             Zed             Zed             Zed             Z	dS )*test_class_members_doc_sphinx.<locals>.Fooc                     dS zTest attributeNr/   r1  s    r   an_attributez7test_class_members_doc_sphinx.<locals>.Foo.an_attribute   	     Fr   c                     d S r   r/   r1  s    r   no_docstringz7test_class_members_doc_sphinx.<locals>.Foo.no_docstring      4r   c                     d S r   r/   r1  s    r   no_docstring2z8test_class_members_doc_sphinx.<locals>.Foo.no_docstring2	  rQ  r   c                     dS )z8This is a
            sentence. It spans multiple lines.Nr/   r1  s    r   multiline_sentencez=test_class_members_doc_sphinx.<locals>.Foo.multiline_sentence  s	     Fr   c                     dS )zThe sentence for numpy.org.Nr/   r1  s    r   midword_periodz9test_class_members_doc_sphinx.<locals>.Foo.midword_period  rN  r   c                     dS )zThis does not have a period
            so we truncate its summary to the first linebreak

            Apparently.
            Nr/   r1  s    r   	no_periodz4test_class_members_doc_sphinx.<locals>.Foo.no_period  s	     Fr   N)
r{   r|   r}   r6  rM  rP  rS  rU  rW  rY  r/   r   r   FoorJ    s        		 	 
	 
	 	 
	 
	 	 
	 
	 	 
	
 
	 	 
	 
	 	 
	 	 	r   rZ  aP  
    Foo

    :Parameters:

        **f** : callable ``f(t, y, *f_args)``
            Aaa.

        **jac** : callable ``jac(t, y, *jac_args)``
            Bbb.

    :Attributes:

        **t** : float
            Current time.

        **y** : ndarray
            Current variable values.

            * hello
            * world

        :obj:`an_attribute <an_attribute>` : float
            Test attribute

        **no_docstring** : str
            But a description

        **no_docstring2** : str
            ..

        :obj:`multiline_sentence <multiline_sentence>`
            This is a sentence.

        :obj:`midword_period <midword_period>`
            The sentence for numpy.org.

        :obj:`no_period <no_period>`
            This does not have a period

    .. rubric:: Methods

    =====  ==========
    **a**
    **b**
    **c**
    =====  ==========

    :Other Parameters:

        **another parameter** : str
            This parameter is less important.

    .. rubric:: Notes

    Some notes about the class.

    .. rubric:: Examples

    For usage examples, see `ode`.

    )r
   rF  r   r   )rZ  r   s     r   test_class_members_doc_sphinxr[    sk                   D m
,
,CC=	@ @ @ @ @r   c                  P    G d d          } d}|t          t          |                     v sJ dt          t          |                     vsJ d}t          d          }|t          t          | |                    v sJ dt          t          | |                    vsJ d S )	Nc                   (    e Zd ZdZed             ZdS )1test_class_attributes_as_member_list.<locals>.Fooz
        Class docstring.

        Attributes
        ----------
        an_attribute
            Another description that is not used.

        c                     dS rL  r/   r1  s    r   rM  z>test_class_attributes_as_member_list.<locals>.Foo.an_attributeq  rN  r   N)r{   r|   r}   r~   r6  rM  r/   r   r   rZ  r^  f  s9        	 	 
	 	 
	 	 	r   rZ  zK:Attributes:

    :obj:`an_attribute <an_attribute>`
        Test attributezAnother descriptionzF.. rubric:: Attributes

.. autosummary::
   :toctree:

   an_attributeF)attributes_as_param_listr#  )r   r
   r%  )rZ  attr_doc	attr_doc2r(  s       r   $test_class_attributes_as_member_listrc  e  s            H
 s>#..////// N3,?,?(@(@@@@@I 
.
.
.CN3s;;;<<<<<< N3s,K,K,K(L(LLLLLLLr   c                      t          d t          dt          j        d          i          } t	          t          |           d           d S )Ntemplatez{{examples}}
{{parameters}}r#  z
    .. rubric:: Examples

    For usage examples, see `ode`.

    :Parameters:

        **f** : callable ``f(t, y, *f_args)``
            Aaa.

        **jac** : callable ``jac(t, y, *jac_args)``
            Bbb.

    )r
   rF  jinja2Templater   r   r"   s    r   test_templated_sectionsrh    s[    
FO,JKKL  C
 C	    r   c                       G d d           G fdd          } t          |           }dt          |          v sJ d S )Nc                   "    e Zd ZddZd Zd ZdS )2test_nonstandard_property.<locals>.SpecialPropertyr   r   c                 "    || _         || _        d S r   )axisr~   )rt   rm  r   s      r   __init__z;test_nonstandard_property.<locals>.SpecialProperty.__init__  s    DIDLLLr   c                 8    || S |j         j        | j                 S r   )_dataaxesrm  )rt   r   r   s      r   __get__z:test_nonstandard_property.<locals>.SpecialProperty.__get__  s    {y~di00r   c                 <    |                     | j        |           d S r   )	_set_axisrm  )rt   r   values      r   __set__z:test_nonstandard_property.<locals>.SpecialProperty.__set__  s    MM$)U+++++r   N)r   r   )r{   r|   r}   rn  rr  rv  r/   r   r   SpecialPropertyrk    sF        	 	 	 		1 	1 	1	, 	, 	, 	, 	,r   rw  c                   (    e Zd Z  d          ZdS )(test_nonstandard_property.<locals>.Dummytest attributer"   N)r{   r|   r}   attr)rw  s   r   r   ry    s"        #3444r   r   rz  )r   r   )r   r   rw  s     @r   test_nonstandard_propertyr|    s    , , , , , , , ,5 5 5 5 5 5 5 5 5 5 

Cs3xx''''''r   c                  ~    t                      } t          d|           }t          t          |          d           d S )Nz
    Parameters
    ----------
    param1 : int
        First parameter
    *args : tuple
        Arguments
    **kwargs : dict
        Keyword arguments
    r#  z
:Parameters:

    **param1** : int
        First parameter

    **\*args** : tuple
        Arguments

    **\*\*kwargs** : dict
        Keyword arguments
    )r%  r   r   r   r'  s     r   test_args_and_kwargsr~    sU    
&&C
		   C C	    r   c                      t          dd          } t          t          d|           }t          t          |          dd           d S )NTr?  z.
A top section before

.. autoclass:: str
    r#  zE
A top section before

.. autoclass:: str

.. rubric:: Methods


       )r%  r
   r   r   r'  s     r   test_autoclassr    sf    
$T
J
J
JC
	
   C C	 	
    r   ae  
Test xref in Parameters, Other Parameters and Returns

Parameters
----------
p1 : int
    Integer value

p2 : float, optional
    Integer value

Other Parameters
----------------
p3 : list[int]
    List of integers
p4 : :class:`pandas.DataFrame`
    A dataframe
p5 : sequence of `int`
    A sequence

Returns
-------
out : array
    Numerical return value
a  
Test xref in Parameters, Other Parameters and Returns


:Parameters:

    **p1** : :class:`python:int`
        Integer value

    **p2** : :class:`python:float`, optional
        Integer value

:Returns:

    **out** : :obj:`array <numpy.ndarray>`
        Numerical return value


:Other Parameters:

    **p3** : :class:`python:list`\[:class:`python:int`]
        List of integers

    **p4** : :class:`pandas.DataFrame`
        A dataframe

    **p5** : :obj:`python:sequence` of `int`
        A sequence
c                  p   ddi}  G d d          }t          t                    }| D ]}| |         ||<    || |          } t          dd          |          }t          |           h d}t	          t
          t          d||          	          }t          t          |          t                     d S )
Nsequencez:obj:`python:sequence`c                       e Zd Zd ZdS )test_xref.<locals>.Configc                     || _         || _        t                      | _        t                      | _        t                      | _        d S r   )numpydoc_xref_aliasesnumpydoc_xref_aliases_completesetnumpydoc_validation_checksnumpydoc_validation_excluder%  numpydoc_validation_overridesrs   s      r   rn  z"test_xref.<locals>.Config.__init__6  s<    )*D&23D/.1eeD+/2uuD,15D...r   N)r{   r|   r}   rn  r/   r   r   Configr  5  s#        	8 	8 	8 	8 	8r   r  r$  >   ofr   optionalT)xref_param_typexref_aliasesxref_ignorer#  )
r   r   r   r   r   xref_doc_txtr%  r   r   xref_doc_txt_expected)r  r  xref_aliases_completekeyr$  appr  r   s           r   	test_xrefr  0  s    ,L8 8 8 8 8 8 8 8 %]33 7 7%1#%6c""VL"788F
(*Xx
(
(
0
0C#///K
 .#
 
 
  C S#899999r   c                     ddl m}   G d d          } |            }t          ||           sJ t          |          }d}t	          j        t          |          5  |                    |           ddd           dS # 1 swxY w Y   dS )	z
    Ensure that NumpyDocString._error_location doesn't fail when self._obj
    does not have a __name__ attr.

    See gh-362
    r   )Callablec                       e Zd Zd ZdS ).test__error_location_no_name_attr.<locals>.Fooc                     d S r   r/   r1  s    r   __call__z7test__error_location_no_name_attr.<locals>.Foo.__call__^  s    Dr   N)r{   r|   r}   r  r/   r   r   rZ  r  ]  s#        	 	 	 	 	r   rZ  z)Potentially wrong underline length.*Foo.*rm   )msgN)collections.abcr  r  r   r   r   r   _error_location)r  rZ  foondsr  s        r   !test__error_location_no_name_attrr  S  s    )(((((        #%%Cc8$$$$$ 

C
5C	z	-	-	- % %$$$% % % % % % % % % % % % % % % % % %s   B  BBc                      ddl m  G fdd          } t          |           }t          |d                   dk    sJ |d         d         j        dk    sJ dS )	zuEnsure that properties marked with the `cached_property` decorator
    are listed in the Methods section. See gh-432.r   cached_propertyc                   .    e Zd Zg dZ d             ZdS )1test_class_docstring_cached_property.<locals>.Foo)r<   r=   r?   c                     | j         S r   )_xr1  s    r   valz5test_class_docstring_cached_property.<locals>.Foo.valt  s	    7Nr   N)r{   r|   r}   r  r  r  s   r   rZ  r  q  s7        YY		 	 
	 	 	r   rZ  
Attributesr<   r  N)	functoolsr  r   rA   r   )rZ  class_docstringr  s     @r   $test_class_docstring_cached_propertyr  l  s     *)))))          %S))O|,--2222<(+0E999999r   c                  d    ddl m}   | dd          }t          |          }|d         g k    sJ dS )zd
    Ensure that attributes of namedtuples are not duplicated in the docstring.

    See gh-257
    r   r   rZ  r=  bazr  N)collectionsr   r   )r   r  sdss      r   'test_namedtuple_no_duplicate_attributesr  }  sR     '&&&&&
*UN
+
+C 

C|""""""r   c                     ddl m}   | dd          } G d d|          }t          |          }|d         dgk    sJ  G d	 d
|          }t          |          }d|d         v sJ t          |d                   dk    sJ t          |d                   dk    sJ |d         d         j        d         dk    sJ |d         d         j        d         dk    sJ dS )z^Ensure that class docstring is preserved when inheriting from namedtuple.

    See gh-257
    r   r   rZ  r  c                       e Zd ZdZdS ).test_namedtuple_class_docstring.<locals>.MyFooMyFoo's class docstringNr   r/   r   r   MyFoor    s        %%%%r   r  r%   r  c                   (    e Zd ZU dZeed<   eed<   dS )8test_namedtuple_class_docstring.<locals>.MyFooWithParamsz
        MyFoo's class docstring

        Parameters
        ----------
        bar : str
           The bar attribute
        baz : str
           The baz attribute
        r=  r  N)r{   r|   r}   r~   r   __annotations__r/   r   r   MyFooWithParamsr    s.         		 		 r   r  r  r,   r=   zThe bar attributer<   zThe baz attributeN)r  r   r   rA   rG   )r   r  r  r  r  s        r   test_namedtuple_class_docstringr    sQ   
 '&&&&&
*UN
+
+C& & & & & & & & 

Cy>788888
    #    
)
)C$I6666s< !!Q&&&&s< !!Q&&&&|Q$Q'+>>>>>|Q$Q'+>>>>>>>r   __main__r   )`r   r   r  r  r   copyr   rf  r   r   r  numpydoc.docscraper   r   r	   numpydoc.docscrape_sphinxr
   r   r   r   numpydoc.numpydocr   numpydoc.xrefr   r   fixturer   r   r\   doc_sent_txtrg   r#   r'   r*   rH   rN   rV   rc   rh   rk   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   markparametrizer   r   r  r  r  r  r  r  r  r  r  r   r)  rB  rD  rF  rG  r[  rc  rh  r|  r~  r  r  r  r  r  r  r  r  r{   mainr/   r   r   <module>r     s   				   " " " " " "         ( ( ( ( ( ( D D D D D D D D D D            , + + + + + ' ' ' ' ' 'nb H~G5G+HIII3 3 JI3 ^N++
  >,''3 3 3
6 6 6
L L L3 3 3,> > >% % %(% % %% % %# # #,5& 5& 5&p# # #3 3 3
1 1 1
. . .     u u up  "  (  :| | |~  ( ~	 ( ( ( ~ # # # ~D * * * ~ "3 3 3' ' ' B>22C C 32CL	 	 	! ! !"
 
 
&  : ~ 7 7 7 ~	 & & &0 0 0  = = =.'3 '3 '3TQ: Q: Q:h5 5 5 1h4 4 4nd d dN"M "M "MJ  2( ( (2  @  46 > :  :  :F% % %2: : :"# # #'? '? '?T zMMMFKMMMMM r   