GRAYBYTE WORDPRESS FILE MANAGER6658

Server IP : 198.54.121.189 / Your IP : 216.73.216.140
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /opt/hc_python/lib/python3.12/site-packages/importlib_resources/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /opt/hc_python/lib/python3.12/site-packages/importlib_resources//_itertools.py
# from more_itertools 9.0
def only(iterable, default=None, too_long=None):
    """If *iterable* has only one item, return it.
    If it has zero items, return *default*.
    If it has more than one item, raise the exception given by *too_long*,
    which is ``ValueError`` by default.
    >>> only([], default='missing')
    'missing'
    >>> only([1])
    1
    >>> only([1, 2])  # doctest: +IGNORE_EXCEPTION_DETAIL
    Traceback (most recent call last):
    ...
    ValueError: Expected exactly one item in iterable, but got 1, 2,
     and perhaps more.'
    >>> only([1, 2], too_long=TypeError)  # doctest: +IGNORE_EXCEPTION_DETAIL
    Traceback (most recent call last):
    ...
    TypeError
    Note that :func:`only` attempts to advance *iterable* twice to ensure there
    is only one item.  See :func:`spy` or :func:`peekable` to check
    iterable contents less destructively.
    """
    it = iter(iterable)
    first_value = next(it, default)

    try:
        second_value = next(it)
    except StopIteration:
        pass
    else:
        msg = (
            'Expected exactly one item in iterable, but got {!r}, {!r}, '
            'and perhaps more.'.format(first_value, second_value)
        )
        raise too_long or ValueError(msg)

    return first_value

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
May 23 2025 08:31:29
root / root
0755
__pycache__
--
April 04 2025 08:00:21
root / root
0755
compat
--
April 04 2025 08:00:21
root / root
0755
future
--
April 04 2025 08:00:21
root / root
0755
tests
--
April 04 2025 08:00:21
root / root
0755
__init__.py
0.684 KB
April 04 2025 08:00:21
root / root
0644
_adapters.py
4.377 KB
April 04 2025 08:00:21
root / root
0644
_common.py
5.492 KB
April 04 2025 08:00:21
root / root
0644
_functional.py
2.679 KB
April 04 2025 08:00:21
root / root
0644
_itertools.py
1.247 KB
April 04 2025 08:00:21
root / root
0644
abc.py
5.419 KB
April 04 2025 08:00:21
root / root
0644
py.typed
0 KB
April 04 2025 08:00:21
root / root
0644
readers.py
6.104 KB
April 04 2025 08:00:21
root / root
0644
simple.py
2.529 KB
April 04 2025 08:00:21
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF