Current Path: > > opt > alt > > python313 > lib64 > python3.13 > importlib > resources >
Operation : Linux premium131.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 Software : Apache Server IP : 162.0.232.56 | Your IP: 216.73.216.111 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
__pycache__ | Directory | - | - | |
__init__.py | File | 703 bytes | June 23 2025 14:28:03. | |
_adapters.py | File | 4482 bytes | June 23 2025 14:28:03. | |
_common.py | File | 5589 bytes | June 23 2025 14:28:03. | |
_functional.py | File | 2651 bytes | June 23 2025 14:28:03. | |
_itertools.py | File | 1277 bytes | June 23 2025 14:28:03. | |
abc.py | File | 5203 bytes | June 23 2025 14:28:03. | |
readers.py | File | 6243 bytes | June 23 2025 14:28:03. | |
simple.py | File | 2590 bytes | June 23 2025 14:28:03. |
# 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
SILENT KILLER Tool