403Webshell
Server IP : 127.0.0.1  /  Your IP : 216.73.216.109
Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10
System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64
User : SERVERWEB ( 0)
PHP Version : 8.1.10
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : OFF |  Perl : OFF |  Python : OFF |  Sudo : OFF |  Pkexec : OFF
Directory :  C:/cygwin64/lib/python3.9/site-packages/sphinx/ext/napoleon/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : C:/cygwin64/lib/python3.9/site-packages/sphinx/ext/napoleon/__pycache__/iterators.cpython-39.pyc
a

�ab��@sBdZddlZddlmZmZmZGdd�d�ZGdd�de�ZdS)z�
    sphinx.ext.napoleon.iterators
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


    A collection of helpful iterators.


    :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�Any�Iterable�Optionalc@s�eZdZdZedd�dd�Zdd�dd�Zdeed	�d
d�Ze	edd	�dd
�Z
ed�dd�Zdeed	�dd�Z
de	eed	�dd�ZdS)�	peek_iteralAn iterator object that supports peeking ahead.

    Parameters
    ----------
    o : iterable or callable
        `o` is interpreted very differently depending on the presence of
        `sentinel`.

        If `sentinel` is not given, then `o` must be a collection object
        which supports either the iteration protocol or the sequence protocol.

        If `sentinel` is given, then `o` must be a callable object.

    sentinel : any value, optional
        If given, the iterator will call `o` with no arguments for each
        call to its `next` method; if the value returned is equal to
        `sentinel`, :exc:`StopIteration` will be raised, otherwise the
        value will be returned.

    See Also
    --------
    `peek_iter` can operate as a drop in replacement for the built-in
    `iter <https://docs.python.org/3/library/functions.html#iter>`_ function.

    Attributes
    ----------
    sentinel
        The value used to indicate the iterator is exhausted. If `sentinel`
        was not given when the `peek_iter` was instantiated, then it will
        be set to a new object instance: ``object()``.

    N)�args�returncGs8t|�|_t��|_t|�dkr,|d|_nt�|_dS)z__init__(o, sentinel=None)��N)�iter�	_iterable�collections�deque�_cache�len�sentinel�object)�selfr�r�A/usr/lib/python3.9/site-packages/sphinx/ext/napoleon/iterators.py�__init__2s


zpeek_iter.__init__)rcCs|S�Nr�rrrr�__iter__;szpeek_iter.__iter__��nrcCs
|�|�Sr)�next�rrrrr�__next__>szpeek_iter.__next__cCsd|sd}z&t|j�|kr,|j�t|j��q
Wn0ty^t|j�|krZ|j�|j�q<Yn0dS)z<Cache `n` items. If `n` is 0 or None, then 1 item is cached.r	N)rr�appendrr�
StopIterationrrrrr�
_fillcacheAszpeek_iter._fillcachecCs|��|jkS)z�Determine if iterator is exhausted.

        Returns
        -------
        bool
            True if iterator has more items, False otherwise.

        Note
        ----
        Will never raise :exc:`StopIteration`.

        )�peekrrrrr�has_nextLs
zpeek_iter.has_nextcsn��|�|s<�jd�jkr"t�|dur6�j��}qjg}n.�j|d�jkrTt��fdd�t|�D�}|S)aKGet the next item or `n` items of the iterator.

        Parameters
        ----------
        n : int or None
            The number of items to retrieve. Defaults to None.

        Returns
        -------
        item or list of items
            The next item or `n` items of the iterator. If `n` is None, the
            item itself is returned. If `n` is an int, the items will be
            returned in a list. If `n` is 0, an empty list is returned.

        Raises
        ------
        StopIteration
            Raised if the iterator is exhausted, even if `n` is 0.

        rNr	csg|]}�j���qSr)r�popleft��.0�irrr�
<listcomp>{�z"peek_iter.next.<locals>.<listcomp>)r rrrr#�range�rr�resultrrrr
zpeek_iter.nextcs8��|�|dur�jd}n�fdd�t|�D�}|S)ahPreview the next item or `n` items of the iterator.

        The iterator is not advanced when peek is called.

        Returns
        -------
        item or list of items
            The next item or `n` items of the iterator. If `n` is None, the
            item itself is returned. If `n` is an int, the items will be
            returned in a list. If `n` is 0, an empty list is returned.

            If the iterator is exhausted, `peek_iter.sentinel` is returned,
            or placed as the last item in the returned list.

        Note
        ----
        Will never raise :exc:`StopIteration`.

        Nrcsg|]}�j|�qSr)rr$rrrr'�r(z"peek_iter.peek.<locals>.<listcomp>)r rr)r*rrrr!~s

zpeek_iter.peek)N)N)N)�__name__�
__module__�__qualname__�__doc__rrr�intrrr �boolr"rr!rrrrrs 	#rcs>eZdZdZeedd��fdd�Zeedd�dd�Z�Z	S)	�modify_iteraTAn iterator object that supports modifying items as they are returned.

    Parameters
    ----------
    o : iterable or callable
        `o` is interpreted very differently depending on the presence of
        `sentinel`.

        If `sentinel` is not given, then `o` must be a collection object
        which supports either the iteration protocol or the sequence protocol.

        If `sentinel` is given, then `o` must be a callable object.

    sentinel : any value, optional
        If given, the iterator will call `o` with no arguments for each
        call to its `next` method; if the value returned is equal to
        `sentinel`, :exc:`StopIteration` will be raised, otherwise the
        value will be returned.

    modifier : callable, optional
        The function that will be used to modify each item returned by the
        iterator. `modifier` should take a single argument and return a
        single value. Defaults to ``lambda x: x``.

        If `sentinel` is not given, `modifier` must be passed as a keyword
        argument.

    Attributes
    ----------
    modifier : callable
        `modifier` is called with each item in `o` as it is iterated. The
        return value of `modifier` is returned in lieu of the item.

        Values returned by `peek` as well as `next` are affected by
        `modifier`. However, `modify_iter.sentinel` is never passed through
        `modifier`; it will always be returned from `peek` unmodified.

    Example
    -------
    >>> a = ["     A list    ",
    ...      "   of strings  ",
    ...      "      with     ",
    ...      "      extra    ",
    ...      "   whitespace. "]
    >>> modifier = lambda s: s.strip().replace('with', 'without')
    >>> for s in modify_iter(a, modifier=modifier):
    ...   print('"%s"' % s)
    "A list"
    "of strings"
    "without"
    "extra"
    "whitespace."

    N)r�kwargsrcsdd|vr|d|_n.t|�dkr8|d|_|dd�}n
dd�|_t|j�sTtd��t�j|�dS)z0__init__(o, sentinel=None, modifier=lambda x: x)�modifierrNcSs|Srr)�xrrr�<lambda>�r(z&modify_iter.__init__.<locals>.<lambda>z3modify_iter(o, modifier): modifier must be callable)r4r�callable�	TypeError�superr)rrr3��	__class__rrr�s


zmodify_iter.__init__rcCsj|sd}z,t|j�|kr2|j�|�t|j���q
Wn0tydt|j�|kr`|j�|j�qBYn0dS)z�Cache `n` modified items. If `n` is 0 or None, 1 item is cached.

        Each item returned by the iterator is passed through the
        `modify_iter.modified` function before being cached.

        r	N)rrrr4rrrrrrrrr �szmodify_iter._fillcache)
r,r-r.r/rrrr0r �
__classcell__rrr:rr2�s6r2)r/r�typingrrrrr2rrrr�<module>s


Youez - 2016 - github.com/yon3zu
LinuXploit