[ SYSTEM ]: Linux srv.persadacompanies.com 4.18.0-553.56.1.el8_10.x86_64 #1 SMP Tue Jun 10 05:00:59 EDT 2025 x86_64
[ SERVER ]: Apache | PHP: 8.4.19
[ USER ]: persadamedika | IP: 45.64.1.108
GEFORCE FILE MANAGER
/
usr
/
lib64
/
python3.12
/
importlib
/
resources
/
UPLOAD:
NAME
SIZE
QUICK PERMS
ACTIONS
📁 __pycache__
SET
[ DEL ]
📄 __init__.py
532 B
SET
[ EDIT ]
|
[ DEL ]
📄 _adapters.py
4,482 B
SET
[ EDIT ]
|
[ DEL ]
📄 _common.py
5,486 B
SET
[ EDIT ]
|
[ DEL ]
📄 _itertools.py
1,277 B
SET
[ EDIT ]
|
[ DEL ]
📄 _legacy.py
2,949 B
SET
[ EDIT ]
|
[ DEL ]
📄 abc.py
5,203 B
SET
[ EDIT ]
|
[ DEL ]
📄 readers.py
4,370 B
SET
[ EDIT ]
|
[ DEL ]
📄 simple.py
2,584 B
SET
[ EDIT ]
|
[ DEL ]
DELETE SELECTED
[ CLOSE ]
EDIT: _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