
    Rtf                        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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j8                  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! Z0dPd"Z1d# Z2d$ Z3d% Z4d& Z5d' Z6d( Z7 ed)      Z8d* Z9 ed+      Z:d, Z; ed-      Z<d. Z= ed/      Z>d0 Z?d1 Z@ej                  j                  d2ddg      d3        ZCd4 ZDd5 ZEd6 ZFd7 ZG ed8      ZHd9 ZI ed:      ZJd; ZKd< ZLd= ZMd> ZNd? ZOd@ ZPdA ZQdBZRdC ZSdD ZTdE ZUdF ZVdG ZWdH ZXdI ZYdJZZdKZ[dL Z\dM Z]dN Z^e_dOk(  rd dlZ ej                          yy)Q    )
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    ?/usr/lib/python3/dist-packages/numpydoc/tests/test_docscrape.pydocr      s    '--'1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                 \    | d   j                  d      sJ | d   j                  d      sJ y )N	Signatureznumpy.multivariate_normal(z
spam=None)
startswithendswithr   s    r   test_signaturer$      s5    {&&'CDDD{$$\222r   c                 h    | d   d   j                  d      sJ | d   d   j                  d      sJ y )NSummaryr   zDraw valueszcovariance.r    r#   s    r   test_summaryr(      s<    y>!''666y>"&&}555r   c                 6    | d   d   j                  d      sJ y )NExtended Summaryr   zThe multivariate normal)r!   r#   s    r   test_extended_summaryr+      s"    !"1%001JKKKr   c                    t        | d         dk(  sJ | d   D cg c]  \  }}}|
 }}}t        d t        |g d      D              sJ | d   d   \  }}}|dk(  sJ |d   j                  d      sJ | d   d   d	   d	   d
k(  sJ | d   d   \  }}}|dk(  sJ |dk(  sJ |d   j                  d      sJ | d   d   d	   d	   d
k(  sJ | d   d   \  }}}|dk(  sJ |dk(  sJ |d   j                  d      sJ y c c}}w )N
Parameters   c              3   ,   K   | ]  \  }}||k(    y wr    ).0abs      r   	<genexpr>z"test_parameters.<locals>.<genexpr>   s     G$!QqAvGs   )meancovshape   z(N, N) ndarrayr   zCovariance matrixr'   z   (1+2+3)/3   r7   ztuple of intsGiven   dtypez,data type object, optional (default : float)zThe type and size)lenallzipr!   )r   n_namesargarg_typedescs          r   test_parametersrF      sm   s< !Q&&&!,/071aQ0E0G#e-E"FGGGGl+A.C4''''71222|Q#B'>999l+A.C4'>>&&&7g&&&|Q#B'>999l+A.C4'>>EEEE71222# 1s   C<c                     t        | d         dk(  sJ | d   D cg c]  \  }}}|
 c}}dgk(  sJ | d   d   \  }}}|dk(  sJ |d   j                  d      sJ y c c}}w )NzOther Parametersr8   spamr   parrotzA parrot off its mortal coil)r=   r!   )r   r@   rA   rC   rD   rE   s         r   test_other_parametersrJ      s    s%&'1,,, !345'!QA5&AAA01!4C4x7<=== 6s   Ac                    t        | d         dk(  sJ | d   d   \  }}}|dk(  sJ |dk(  sJ |d   j                  d      sJ |d   j                  d      sJ | d   d	   \  }}}|d
k(  sJ |dk(  sJ |d   j                  d      sJ |d   j                  d      sJ | d   d   \  }}}|d
k(  sJ |dk(  sJ d
j                  |      j	                         rJ y )NReturnsr;   r   outndarrayzThe drawn samplesr'   zdistribution.r8   r   zlist of strzThis is not a realzanonymous return values.r9   no_description)r=   r!   r"   joinstrip)r   rC   rD   rE   s       r   test_returnsrR      s'   s9~!###i.+C4%<<y   712228_---i.+C4"99}$$$7233387888i.+C4"99''''wwt}""$$$$r   c                      t         d   } t        |       dk(  sJ g d}t        | |      D ]G  \  \  }}}\  }}}||k(  sJ ||k(  sJ |d   j                  d      sJ |d   j	                  |      rGJ  y )NYieldsr;   ))r2   intzapples.r3   rU   zbananas.)r   rU   z	unknowns.r   The number of)
doc_yieldsr=   r?   r!   r"   sectiontruthrC   rD   rE   arg_	arg_type_ends           r   test_yieldsr_      s    "Gw<1E
 :=We9L %5h5id{{9$$$Aw!!/222Aw$$$	%r   c                      t         d   } t        |       dk(  sJ ddg}t        | |      D ]G  \  \  }}}\  }}}||k(  sJ ||k(  sJ |d   j                  d      sJ |d   j	                  |      rGJ  y )NReceivesr9   rV   )crU   zoranges.r   rW   )doc_sentr=   r?   r!   r"   rY   s           r   	test_sentrd      s    z"Gw<1%'?@E9<We9L %5h5id{{9$$$Aw!!/222Aw$$$	%r   c                  2    d} t        t        t        |        y )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_returnyieldri   	  s    H  *nh7r   c                     d} t        j                  t        d      5  t        |        d d d         G d d      }d }t        j                  t        d      5  t	        |       d d d        t        j                  t        d      5  t        |       d d d        y # 1 sw Y   uxY w# 1 sw Y   ExY w# 1 sw Y   y xY w)	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y)!test_section_twice.<locals>.Dummyz
        Dummy class.

        Notes
        -----
        First note.

        Notes
        -----
        Second note.

        c                      yzSpam

Spam spam.Nr0   selfr2   r3   s      r   rH   z&test_section_twice.<locals>.Dummy.spam;      r   c                      yzCheese

No cheese.Nr0   rr   rb   ds      r   hamz%test_section_twice.<locals>.Dummy.ham?  rs   r   N)__name__
__module____qualname____doc__rH   rx   r0   r   r   Dummyrn   -  s    			r   r}   c                      y)z
        Dummy function.

        Notes
        -----
        First note.

        Notes
        -----
        Second note.
        Nr0   )rC   s    r   
dummy_funcz&test_section_twice.<locals>.dummy_funcC  s    r   zDummy classr   )pytestr   rg   r   r   r   )rh   r}   r   s      r   test_section_twicer     s    
H 
z)J	K !x ! , 
z	7 u 
z	6 &*%& &U! !N & &s#   BB*	B6B'*B36B?c                     | d   d   j                  d      sJ | d   d   j                  d      sJ t        | d         dk(  sJ y )NNotesr   Insteadr'   z	definite.   )r!   r"   r=   r#   s    r   
test_notesr   W  sR    w<?%%i000w<$$[111s7|"""r   c                 h    | d   d   j                  d      sJ | d   d   j                  d      sJ y )N
Referencesr   z..r'   z2001.r    r#   s    r   test_referencesr   ]  s>    |Q**4000|R ))'222r   c                 h    | d   d   j                  d      sJ | d   d   j                  d      sJ y )NExamplesr   z>>>r'   zTrue]r    r#   s    r   test_examplesr   b  s<    z?1((///z?2''000r   c                 p    | d   d   dk(  sJ t        | d         dk(  sJ t        | d   d         dk(  sJ y )Nindexdefaultrandomr9   refguide)r=   r#   s    r   
test_indexr   g  sL    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   m  s=    
y"a A
y"a A
z7A&AHr   c                    t        j                  |       } t        j                  |      }t        |       j                  d      D cg c]  }|j	                          c}d | } t        |      j                  d      D cg c]  }|j	                          c}d | }t        |       t        |      k(  sJ t        t        | |            D ]  \  }\  }}||k(  rJ  y c c}w c c}w )N
)textwrapdedentr   splitrstripr=   	enumerater?   )r2   r3   n_linesliiaabbs          r   line_by_line_comparer   u  s    AA/288>??IA/288>??IAq6SV!#a), HRRxx 	@?s   C C#c                 .    t        t        |       d       y )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     s     Cn	4qr   c                  6    t        t        t              d       y )NzTest generator

Yields
------
a : int
    The number of apples.
b : int
    The number of bananas.
int
    The number of unknowns.
)r   r   rX   r0   r   r   test_yield_strr     s    J
	r   c                  6    t        t        t              d       y )NzTest generator

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

Receives
--------
b : int
    The number of bananas.
c : int
    The number of oranges.
)r   r   rc   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 y )Nr   zTest idx

    z%Test idx

    .. index :: random
    z*Test idx

    .. index ::
        foo
    )r   r   r0   r   r   test_no_index_in_strr     sx    #	
    c	
    c	
   r   c                  L    t        t              } t        t        |       d       y )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   9  s"     )JJw	zr   c                  L    t        t              } t        t        |       d       y )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     s      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                  2    t        t        d         dk(  sJ y )Nr-   r9   )r=   doc2r0   r   r   ,test_parameters_without_extended_descriptionr     s    tL!"a'''r   zB
    my_signature(*params, **kwds)

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

    Return an array with all complex-valued elements conjugated.c                       t         d   g k(  sJ y )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 y )NRaisesr8   r   r   LinAlgExceptionzIf array is singular.r=   doc5nametyperE   r   s    r   test_raisesr     sb    tH~!###N1E::::****::1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 y )NWarnsr8   r   r   SomeWarningz	If neededr   r   s    r   
test_warnsr     s_    tG}"""M!E::::&&&::+&&&r   prefixc                     t        | dz         }t        |d         dk(  sJ |d   D ]  \  }}|D ]  \  }}|dv r|r>J t        ||g             |dv r|s&J t        ||g             |sJ t        ||g             |dk(  r|dk(  s>J |dk(  s|d	k(  r|d
k(  s-J |dk(  r|dk(  s!J |dv r|dk(  sJ |J t        ||g             |dk(  r	|dgk(  rJ |dk(  r
|ddgk(  rJ |dk(  r
|ddgk(  rJ |dv s|dgk(  rJ t        |dgg               y )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   r=   r   )r   doc6funcsrE   r   roles         r   test_see_alsor   $  s   	D* tJ B&&&J' ,t +	JD$     2dD\!22xEE.S$..t.S$..txv~%~$(<u}$}"w&//v~%~|6S$%66|x 67777% 68HIIII"2222EE 9:: C567= :S+	,r   c                  ~    d} t        j                  t        d      5  t        |        d d d        y # 1 sw Y   y xY w)Nz@
    z(x,theta)

    See Also
    --------
    :func:`~foo`
    zSee Also entry ':func:`~foo`'rk   )r   r   rg   r   )texts    r   test_see_also_parse_errorr   k  s7    D 
z)H	I t  s   3<c                  h     G d d      } t        t        | d            }d|v sJ d|v sJ d|v sJ y )Nc                       e Zd ZdZy)"test_see_also_print.<locals>.Dummyz
        See Also
        --------
        func_a, func_b
        func_c : some relationship
                 goes here
        func_d
        Nry   rz   r{   r|   r0   r   r   r}   r   x  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   w  sI    
 
 	KF+,A+q000"a'''q   r   c                      t        j                  d       t        t        d      5  t	        d       d d d        y # 1 sw Y   y xY w)NerrorzEUnexpected comma or period after function list at index 43 of line .*rk   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     sB    G$	U
 
 	
	
	
 
 
s	   <Ac                  L   d}  G d d      }t        j                  t        d      5 }t        |        d d d        t	              dk(  sJ d}t        j                  t        |      5 }t        |       d d d        t	        |      dk(  sJ y # 1 sw Y   [xY w# 1 sw Y   &xY w)NzS
Test having an unknown section

Mope
----
This should be ignored and warned about
c                       e Zd ZdZy)(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 Moperk   r8   z3Unknown section Nope in the docstring of BadSection)r   r   UserWarningr   r=   r   )rh   r  record	msg_matchs       r   test_unknown_sectionr    s    H  
k)?	@ !Fx !v;! FI	k	3 #vz"#v;!! !# #s   B)BBB#z.

        Doc starts on second line.

        c                  >    t         d   d   j                  d      sJ y )Nr&   r   z
Doc starts)doc7r!   r0   r   r   test_empty_first_liner
    s    	?1((666r   z

        Parameters with colon and no types:

        Parameters
        ----------

        data :
            some stuff, technically invalid
        c                  j    t        d      } d}| d   d   j                  |k(  sJ |t        |       v sJ y)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`rL   r   N)r   r   r   )	docstringexpecteds     r    test_returns_with_roles_no_namesr    sJ     	I 0HY"''8333s9~%%%r   c                  :    t         d   d   j                  dk(  sJ y )Nr-   r   data)doc8r   r0   r   r   test_trailing_colonr    s     a %%///r   c                  ,    t        t        d             y )Nz
    Parameters
    ----------)r   r   r0   r   r   test_no_summaryr    s    	
r   c                  d    t        d      } t        | d   d   t              sJ | d   d   dk(  sJ y )Nu   
    öäöäöäöäöåååå

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

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

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

    r&   r   u   öäöäöäöäöåååå)r   
isinstancer   r#   s    r   test_unicoder    sD    
	C$ c)nQ'---y>! <<<<r   c                  8   t        d      } t        d|       }dt        |      v sJ t        |             t        d|       }dt        |      v sJ t        |             t        d|       }t        |      j                  d      dk(  sJ t        |             y )	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()
    r8   )dictr   r   countcfgr   s     r   test_plot_examplesr     s    

C
	 	C s3x)S)
	 	C s3x)S)
	 C s8>>(#q(2#c(2(r   c                  L    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 rZJ t        |             d
t        |      v ryJ 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        |             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 rJ t        |             d
t        |      v rJ t        |              y )Nc                   @    e Zd ZdZd Zd Zed        Z G d d      Zy)!test_class_members.<locals>.Dummyz
        Dummy class.

        c                      yrp   r0   rq   s      r   rH   z&test_class_members.<locals>.Dummy.spam<  rs   r   c                      yru   r0   rv   s      r   rx   z%test_class_members.<locals>.Dummy.ham@  rs   r   c                      y)Spammity indexgffffff?r0   rr   s    r   spammityz*test_class_members.<locals>.Dummy.spammityD       r   c                       e Zd ZdZy)+test_class_members.<locals>.Dummy.Ignorablezlocal class, to be ignoredNr   r0   r   r   	Ignorabler,  I  s    ,r   r-  N)	ry   rz   r{   r|   rH   rx   propertyr)  r-  r0   r   r   r}   r#  6  s/    	
		 
	 
		 	r   r}   F)show_class_membersr  MethodsrH   rx   r)  r'  Tz.. autosummary::c                       e Zd ZdZd Zd Zy)$test_class_members.<locals>.SubDummyz+
        Subclass of Dummy class.

        c                      y)z'Cheese

No cheese.
Overloaded Dummy.hamNr0   rv   s      r   rx   z(test_class_members.<locals>.SubDummy.hamg  rs   r   c                      y)zBar

No barNr0   rq   s      r   barz(test_class_members.<locals>.SubDummy.bark  rs   r   N)ry   rz   r{   r|   rx   r5  r0   r   r   SubDummyr2  a  s    	
		r   r6  r/  show_inherited_class_membersr5  )r	   r   r  r   )r}   clsr   r6  s       r   test_class_membersr:  5  s    0 .) :% >?C(93C/9(SX%6SX6%CH$5sCHo5$S):CS?:)s3x/@#s3x@/% =>CH$5sCHo5$S!2CS?2!C 13C/1 SX%6SX6%. %S1;3s8;1#s3x/9S9/#:&5  .) :4eT
 CH$5sCHo5$SX%6SX6%C 13C/1 C 13C/1 S):CS?:). %S1;3s8;1#3s83=SX=34dS
 CH$5sCHo5$S!2CS?2!C 13C/1 C 13C/1 SX%6SX6%. %S1;3s8;1#s3x/9S9/;:r   c                  J    t        d      } | d   j                         dk(  sJ y )Nz$
    z(x1, x2)

    z(a, theta)
    r   zz(a, theta))r   rQ   r#   s    r   test_duplicate_signaturer<    s1    
 	C {!!#}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                  N    t        d t              } t        t        |       d       y )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_docr?    s"    
4
'CC&	)r   c                  b     G d d      } t        | t              }t        t        |      d       y )Nc                   l    e Zd Zed        Zed        Zed        Zed        Zed        Zed        Z	y)*test_class_members_doc_sphinx.<locals>.Fooc                      yzTest attributeNr0   r(  s    r   an_attributez7test_class_members_doc_sphinx.<locals>.Foo.an_attribute  r*  r   c                      y r   r0   r(  s    r   no_docstringz7test_class_members_doc_sphinx.<locals>.Foo.no_docstring      r   c                      y r   r0   r(  s    r   no_docstring2z8test_class_members_doc_sphinx.<locals>.Foo.no_docstring2  rH  r   c                      y)z8This is a
            sentence. It spans multiple lines.Nr0   r(  s    r   multiline_sentencez=test_class_members_doc_sphinx.<locals>.Foo.multiline_sentence  s     r   c                      y)zThe sentence for numpy.org.Nr0   r(  s    r   midword_periodz9test_class_members_doc_sphinx.<locals>.Foo.midword_period  r*  r   c                      y)zThis does not have a period
            so we truncate its summary to the first linebreak

            Apparently.
            Nr0   r(  s    r   	no_periodz4test_class_members_doc_sphinx.<locals>.Foo.no_period  s     r   N)
ry   rz   r{   r.  rE  rG  rJ  rL  rN  rP  r0   r   r   FoorB    sx    		 
	 
	 
	 
	 
	 
	 
	
 
	 
	 
	 
	r   rQ  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   r>  r   r   )rQ  r   s     r   test_class_members_doc_sphinxrR    s/       D m
,CC4	7r   c                       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 y )	Nc                        e Zd ZdZed        Zy)1test_class_attributes_as_member_list.<locals>.Fooz
        Class docstring.

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

        c                      yrD  r0   r(  s    r   rE  z>test_class_attributes_as_member_list.<locals>.Foo.an_attribute`  r*  r   N)ry   rz   r{   r|   r.  rE  r0   r   r   rQ  rU  U  s    	 
	 
	r   rQ  zK:Attributes:

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

.. autosummary::
   :toctree:

   an_attributeF)attributes_as_param_listr  )r   r   r  )rQ  attr_doc	attr_doc2r  s       r   $test_class_attributes_as_member_listrZ  T  s      H
 s>#.//// N3,?(@@@@I 
.CN3s;<<<< N3s,K(LLLLr   c                  |    t        d t        dt        j                  d      i      } t	        t        |       d       y )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   r>  jinja2Templater   r   r#   s    r   test_templated_sectionsr_  y  s:    
FOO,JKLC
 C	r   c                  f     G d d       G fdd      } t        |       }dt        |      v sJ y )Nc                        e Zd ZddZd Zd Zy)2test_nonstandard_property.<locals>.SpecialPropertyc                      || _         || _        y r   )axisr|   )rr   rd  r   s      r   __init__z;test_nonstandard_property.<locals>.SpecialProperty.__init__  s    DIDLr   c                 P    || S |j                   j                  | j                     S r   )_dataaxesrd  )rr   r   r   s      r   __get__z:test_nonstandard_property.<locals>.SpecialProperty.__get__  s#    {yy~~dii00r   c                 <    |j                  | j                  |       y r   )	_set_axisrd  )rr   r   values      r   __set__z:test_nonstandard_property.<locals>.SpecialProperty.__set__  s    MM$))U+r   N)r   r   )ry   rz   r{   re  ri  rm  r0   r   r   SpecialPropertyrb    s    		1	,r   rn  c                   "    e Zd Z W  d      Zy)(test_nonstandard_property.<locals>.Dummytest attributer#   N)ry   rz   r{   attr)rn  s   r   r}   rp    s    #34r   r}   rq  )r   r   )r}   r   rn  s     @r   test_nonstandard_propertyrs    s5    , ,5 5 
Cs3x'''r   c                  \    t               } t        d|       }t        t        |      d       y )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_kwargsru    s3    
&C
		 C C	r   c                  n    t        dd      } t        t        d|       }t        t        |      dd       y )NTr7  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_autoclassrx    s@    
$T
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                     ddi}  G d d      }t        t              }| D ]
  }| |   ||<     || |      } t        dd      |      }t        |       h d}t	        t
        t        d||      	      }t        t        |      t               y )
Nsequencez:obj:`python:sequence`c                       e Zd Zd Zy)test_xref.<locals>.Configc                 z    || _         || _        t               | _        t               | _        t               | _        y r   )numpydoc_xref_aliasesnumpydoc_xref_aliases_completesetnumpydoc_validation_checksnumpydoc_validation_excluder  numpydoc_validation_overridesrq   s      r   re  z"test_xref.<locals>.Config.__init__%  s0    )*D&23D/.1eD+/2uD,15D.r   N)ry   rz   r{   re  r0   r   r   Configr|  $  s    	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    s    ,L8 8 %]3 7%1#%6c"7L"78F
(*Xx
(
0C#/K
 .#
C S#89r   c                      ddl m}   G d d      } |       }t        ||       sJ t        |      }d}t	        j
                  t        |      5  |j                  |       ddd       y# 1 sw Y   yxY w)	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y).test__error_location_no_name_attr.<locals>.Fooc                      y r   r0   r(  s    r   __call__z7test__error_location_no_name_attr.<locals>.Foo.__call__M  s    r   N)ry   rz   r{   r  r0   r   r   rQ  r  L  s    	r   rQ  z)Potentially wrong underline length.*Foo.*rk   )msgN)collections.abcr  r  r   r   r   rg   _error_location)r  rQ  foondsr  s        r   !test__error_location_no_name_attrr  B  so     )  %Cc8$$$ 
C
5C	z	- %$% % %s   A**A3c                      ddl m  G fdd      } t        |       }t        |d         dk(  sJ |d   d   j                  dk(  sJ y)	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W  d        Zy)1test_class_docstring_cached_property.<locals>.Foo)r8   r9   r;   c                     | j                   S r   )_xr(  s    r   valz5test_class_docstring_cached_property.<locals>.Foo.valc  s    77Nr   N)ry   rz   r{   r  r  r  s   r   rQ  r  `  s    		 
	r   rQ  
Attributesr8   r  N)	functoolsr  r   r=   r   )rQ  class_docstringr  s     @r   $test_class_docstring_cached_propertyr  [  sT     *  %S)O|,-222<(+00E999r   __main__r   )acollectionsr   copyr   r   r   r   r]  numpydoc.numpydocr   numpydoc.xrefr   numpydoc.docscraper   r   r	   r
   numpydoc.docscrape_sphinxr   r   r   r   r   r   rf   r   r   r   fixturer   r   rX   doc_sent_txtrc   r$   r(   r+   rF   rJ   rR   r_   rd   ri   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   r:  r<  r>  r?  rR  rZ  r_  rs  ru  rx  r  r  r  r  r  ry   mainr0   r   r   <module>r     s_   "  	    + ' P P   * (nb H~G5G+HI3 J3 N+
  ,'3
6
L3,>%(%%8(7&t#3
1
.up"(:|~( 	( # D* "3' B>2C 3CL	!&
&> 7 	&0=.'3TW:t5 &R+\[|"MJ2(2@46 > :F%2:" zFKKM r   