
    cF                        d dl mZ d dlmZ d dlZd dlZ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mZmZmZmZ d dlmZmZmZmZ d dl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  Z0d! Z1dSd"Z2d# Z3d$ Z4d% Z5d& Z6d' Z7d( Z8 ed)          Z9d* Z: ed+          Z;d, Z< ed-          Z=d. Z> ed/          Z?d0 Z@d1 ZAejB        C                    d2ddg          d3             ZDd4 ZEd5 ZFd6 ZGd7 ZH ed8          ZId9 ZJ ed:          ZKd; ZLd< ZMd= ZNd> ZOd? ZPd@ ZQdA ZRdBZSdC ZTdD ZUdE ZVdF ZWdG ZXdH ZYdI ZZdJZ[dKZ\dL Z]dM Z^ejB        _                    ej`        dNk     dOP          dQ             ZaebdRk    rd dlZ ejc                     dS dS )T    )
namedtuple)deepcopyN)update_config)DEFAULT_LINKS)NumpyDocStringFunctionDocClassDoc
ParseError)SphinxDocStringSphinxClassDocSphinxFunctionDocget_doc_object)raises)warnsaI    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    =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  r0   .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   r0   )r2   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_parametersrI      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 r0   r0   r1   s      r   r5   z)test_other_parameters.<locals>.<listcomp>   s    555'!QA555r   spamr   parrotzA parrot off its mortal coil)rB   r!   r   rF   rG   rH   s       r   test_other_parametersrO      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)rB   r!   r"   joinstriprN   s       r   test_returnsrW      se   s9~!####i.+C4%<y    71222228_-----i.+C4"9}$$$$72333338788888i.+C4"9'''''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@   ))r7   intzapples.r8   rZ   zbananas.)r   rZ   z	unknowns.r   The number of)
doc_yieldsrB   rD   r!   r"   sectiontruthrF   rG   rH   arg_	arg_type_ends           r   test_yieldsrd      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>   r[   )crZ   zoranges.r   r\   )doc_sentrB   rD   r!   r"   r^   s           r   	test_sentri      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          t          |            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.

)assert_raises
ValueErrorr   )doc_texts    r   test_returnyieldrn   
  s#    H  *nh77777r   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.Nr0   selfr7   r8   s      r   rL   z&test_section_twice.<locals>.Dummy.spam<      Dr   c                     dS zCheese

No cheese.Nr0   rw   rg   ds      r   hamz%test_section_twice.<locals>.Dummy.ham@  rx   r   N)__name__
__module____qualname____doc__rL   r}   r0   r   r   Dummyrs   .  s<        	 		 	 		 	 	 	 	r   r   c                     dS )z
        Dummy function.

        Notes
        -----
        First note.

        Notes
        -----
        Second note.
        Nr0   )rF   s    r   
dummy_funcz&test_section_twice.<locals>.dummy_funcD  s      r   zDummy classr   )pytestr   rl   r   r   r   )rm   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"   rB   r#   s    r   
test_notesr   X  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   c  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)rB   r#   s    r   
test_indexr   h  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   n  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 r0   rstripr2   ls     r   r5   z(line_by_line_compare.<locals>.<listcomp>y       ??????r   
c                 6    g | ]}|                                 S r0   r   r   s     r   r5   z(line_by_line_compare.<locals>.<listcomp>z  r   r   )textwrapdedentr   splitrB   	enumeraterD   )r7   r8   n_linesiiaabbs         r   line_by_line_comparer   v  s    AA??/2288>>???IA??/2288>>???IAq66SVV!#a)),,  HRRx 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]   r0   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   rh   r0   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   r0   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   :  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>   )rB   doc2r0   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   r0   )r7   r8   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*   )doc4r0   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.rB   doc5nametyperH   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 nL|dk    s|d	k    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   methr   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   rB   r   )r   doc6funcsrH   r   roles         r   test_see_alsor   %  sm   	 D* tJ  B&&&&J' , ,t +	 +	JD$   /   22dD\!2!22222EE /..S$........S$.....x 	7v~%%%%$ 7(< 7u}$$$$" 7w&&&&// 7v~%%%%66S$%6%66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  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`'rp   )r   r   rl   r   )texts    r   test_see_also_parse_errorr   l  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   r0   r   r   r   r   y  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  x  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 .*rp   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   r0   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  r0   r   r   
BadSectionr    s        	 	 	r   r  zUnknown section Moperp   r=   z3Unknown section Nope in the docstring of BadSection)r   r   UserWarningr   rB   r   )rm   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!   r0   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`rQ   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   r0   r   r   test_trailing_colonr    s&    a %//////r   c                  >    t          t          d                     d S )Nz
    Parameters
    ----------)r   r   r0   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(22#c((22222r   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 ru   r0   rv   s      r   rL   z&test_class_members.<locals>.Dummy.spam=  rx   r   c                     dS rz   r0   r{   s      r   r}   z%test_class_members.<locals>.Dummy.hamA  rx   r   c                     dS )Spammity indexgffffff?r0   rw   s    r   spammityz*test_class_members.<locals>.Dummy.spammityE  	     4r   c                       e Zd ZdZdS )+test_class_members.<locals>.Dummy.Ignorablezlocal class, to be ignoredNr  r0   r   r   	Ignorabler6  J  s        ,,Dr   r7  N)	r~   r   r   r   rL   r}   propertyr3  r7  r0   r   r   r   r-  7  s        	 	
	 	 		 	 	 
	 	 
		 	 	 	 	 	 	 	 	 	r   r   F)show_class_membersr$  MethodsrL   r}   r3  r1  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.hamNr0   r{   s      r   r}   z(test_class_members.<locals>.SubDummy.hamh  rx   r   c                     dS )zBar

No barNr0   rv   s      r   barz(test_class_members.<locals>.SubDummy.barl  rx   r   N)r~   r   r   r   r}   r?  r0   r   r   SubDummyr<  b  s<        	 	
	 	 		 	 	 	 	r   r@  r9  show_inherited_class_membersr?  )r	   r   r&  r   )r   clsr   r@  s       r   test_class_membersrD  6  s=          0 .) : :c% > > >???C(993C/999SXX%66SXX666CHH$55sCHHo555S)::CS?:::s3xx/@@#s3xx@@@c% = = =>>>CHH$55sCHHo555S!22CS?222C 113C/111SXX%66SXX666.  	:%S1;;3s88;;;;#s3xx/99S9999    5    .) : :c4eTTT
 
 
 CHH$55sCHHo555SXX%66SXX666C 113C/111C 113C/111S)::CS?:::.  	>%S1;;3s88;;;;#3s883==SXX===c4dSSS
 
 
 CHH$55sCHHo555S!22CS?222C 113C/111C 113C/111SXX%66SXX666.  	:%S1;;3s88;;;;#s3xx/99S9999;: :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   rV   r#   s    r   test_duplicate_signaturerF    sB    
 	 C {!!##}444444r   aV  
    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

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

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

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

    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

    )r	   class_doc_txtr   r   r#   s    r   test_class_members_docrI    s;    
4
'
'CC&	) ) ) ) )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 attributeNr0   r2  s    r   an_attributez7test_class_members_doc_sphinx.<locals>.Foo.an_attribute  r4  r   c                     d S r   r0   r2  s    r   no_docstringz7test_class_members_doc_sphinx.<locals>.Foo.no_docstring      4r   c                     d S r   r0   r2  s    r   no_docstring2z8test_class_members_doc_sphinx.<locals>.Foo.no_docstring2  rR  r   c                     dS )z8This is a
            sentence. It spans multiple lines.Nr0   r2  s    r   multiline_sentencez=test_class_members_doc_sphinx.<locals>.Foo.multiline_sentence  s	     4r   c                     dS )zThe sentence for numpy.org.Nr0   r2  s    r   midword_periodz9test_class_members_doc_sphinx.<locals>.Foo.midword_period  r4  r   c                     dS )zThis does not have a period
            so we truncate its summary to the first linebreak

            Apparently.
            Nr0   r2  s    r   	no_periodz4test_class_members_doc_sphinx.<locals>.Foo.no_period  s	     4r   N)
r~   r   r   r8  rO  rQ  rT  rV  rX  rZ  r0   r   r   FoorL    s        		 	 
	 
	 	 
	 
	 	 
	 
	 	 
	
 
	 	 
	 
	 	 
	 	 	r   r[  a  
    Foo

    :Parameters:

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

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

    .. rubric:: Examples

    For usage examples, see `ode`.

    :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**
    =====  ==========

    )r   rH  r   r   )r[  r   s     r   test_class_members_doc_sphinxr\    sf                   D m
,
,CC4	7 7 7 7 7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 rN  r0   r2  s    r   rO  z>test_class_attributes_as_member_list.<locals>.Foo.an_attributea  r4  r   N)r~   r   r   r   r8  rO  r0   r   r   r[  r_  V  s9        	 	 
	 	 
	 	 	r   r[  zK:Attributes:

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

.. autosummary::
   :toctree:

   an_attributeF)attributes_as_param_listr$  )r   r   r&  )r[  attr_doc	attr_doc2r)  s       r   $test_class_attributes_as_member_listrd  U  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   rH  jinja2Templater   r   r#   s    r   test_templated_sectionsri  z  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   )rw   rn  r   s      r   __init__z;test_nonstandard_property.<locals>.SpecialProperty.__init__  s    DIDLLLr   c                 8    || S |j         j        | j                 S r   )_dataaxesrn  )rw   r   r   s      r   __get__z:test_nonstandard_property.<locals>.SpecialProperty.__get__  s      1y~di00r   c                 <    |                     | j        |           d S r   )	_set_axisrn  )rw   r   values      r   __set__z:test_nonstandard_property.<locals>.SpecialProperty.__set__  s    MM$)U+++++r   N)r   r   )r~   r   r   ro  rs  rw  r0   r   r   SpecialPropertyrl    sF        	 	 	 		1 	1 	1	, 	, 	, 	, 	,r   rx  c                   (    e Zd Z  d          ZdS )(test_nonstandard_property.<locals>.Dummytest attributer#   N)r~   r   r   attr)rx  s   r   r   rz    s"        #3444r   r   r{  )r   r   )r   r   rx  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 )NTrA  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                 n    || _         || _        t                      | _        t                      | _        d S r   )numpydoc_xref_aliasesnumpydoc_xref_aliases_completesetnumpydoc_validation_checksnumpydoc_validation_excluderv   s      r   ro  z"test_xref.<locals>.Config.__init__'  s0    )*D&23D/.1eeD+/2uuD,,,r   N)r~   r   r   ro  r0   r   r   Configr  &  s#        	5 	5 	5 	5 	5r   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  !  s    ,L5 5 5 5 5 5 5 5 %]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   r0   r2  s    r   __call__z7test__error_location_no_name_attr.<locals>.Foo.__call__N  s    Dr   N)r~   r   r   r  r0   r   r   r[  r  M  s#        	 	 	 	 	r   r[  z)Potentially wrong underline length.*Foo.*rp   )msgN)collections.abcr  r   r   r   r   rl   _error_location)r  r[  foondsr  s        r   !test__error_location_no_name_attrr  C  s    )(((((        #%%Cc8$$$$$ 

C
5C	z	-	-	- % %$$$% % % % % % % % % % % % % % % % % %s   B  BB)r@      z cached_property was added in 3.8)reasonc                      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   )_xr2  s    r   valz5test_class_docstring_cached_property.<locals>.Foo.valg  s	    7Nr   N)r~   r   r   r  r  r  s   r   r[  r  d  s7        YY		 	 
	 	 	r   r[  
Attributesr=   r  N)	functoolsr  r   rB   r   )r[  class_docstringr  s     @r   $test_class_docstring_cached_propertyr  \  s     *)))))          %S))O|,--2222<(+0E999999r   __main__r   )dcollectionsr   copyr   r   sysr   r  rg  numpydoc.numpydocr   numpydoc.xrefr   numpydoc.docscraper   r   r	   r
   numpydoc.docscrape_sphinxr   r   r   r   r   r   rk   r   r  r   fixturer   r   r]   doc_sent_txtrh   r$   r(   r+   rI   rO   rW   rd   ri   rn   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*  rD  rF  rH  rI  r\  rd  ri  r}  r  r  r  r  r  r  skipifversion_infor  r~   mainr0   r   r   <module>r     s   " " " " " "       				 



    + + + + + + ' ' ' ' ' ' P P P P P P P P P P P P             * * * * * * ( ( ( ( ( (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,> > >% % %(% % %% % %8 8 8(7& 7& 7&t# # #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W: W: W:t5 5 5 &R+ + +\[ [ [|"M "M "MJ  2( ( (4  @  46 >: : :D% % %2 v&H   : : :" z MMMFKMMMMM r   