| Server IP : 121.121.20.254 / Your IP : 216.73.216.202 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Python313/Lib/importlib/resources/__pycache__/ |
Upload File : |
�
��i# � � � SS jr g )Nc � � [ U 5 n[ X15 n [ U5 nSR XE5 nU=( d [ U5 e! [ a U$ f = f)a� 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.
zLExpected exactly one item in iterable, but got {!r}, {!r}, and perhaps more.)�iter�next�format�
ValueError�
StopIteration)�iterable�default�too_long�it�first_value�second_value�msgs �3C:\Python313\\Lib\importlib\resources\_itertools.py�onlyr sf � �,
�h��B��r�#�K� *��B�x��
� &��{� A� � �)�*�S�/�)�� �
�� ��
�s �A �
A�A)NN)r � � r �<module>r s
��$r