관리-도구
편집 파일: utils.cpython-311.pyc
� �Cg� � �� � d Z ddlZddlZddlmZmZmZmZmZm Z ddl mZ e d� � Zdee de d eeed f fd�Zdee d ee fd �Zded eeeef f fd�Zd� ZdS )zHUtility stuff which is not directly related to the plugin domain itself.� N)�Any�Callable� Generator�Iterator�Iterable�TypeVar� )�logger�_T�iterable�n�return.c # �� K � |dk rt d� � �t | � � }t t j ||� � � � x}r*|V � t t j ||� � � � x}�(dS dS )zkbatched('ABCDEFG', 3) --> ABC DEF G Batch data into tuples of length n. The last batch may be shorter.r zn must be at least oneN)� ValueError�iter�tuple� itertools�islice)r r �it�batchs ��/builddir/build/BUILDROOT/lve-stats-4.2.10-1.el8.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/lvestats/plugins/generic/burster/utils.py�batchedr s� � � � � �1�u�u��1�2�2�2� �h���B���)�"�a�0�0�1�1� 1�%� ����� ��)�"�a�0�0�1�1� 1�%� � � � � � �upstreamc # �N K � | D ]}|}|V � � |V � n# t $ r Y d S w xY w��N)� NameError)r �item�lasts r �repeast_lastr sa � � � �� � ����� � � � �� ��J�J�J�J��� � � ��F�F� ����s � � #�#�funcc �F � � t j � � � � fd�� � }|S )Nc �B �� �| i |��}|� d � � |S r )�send)�args�kwargs�gr! s �r �wrapperzbootstrap_gen.<locals>.wrapper+ s+ �� ��D�$�!�&�!�!�� ���t�����r �� functools�wraps�r! r( s ` r � bootstrap_genr- * s8 �� ��_�T���� � � � ��� �Nr c �F � � t j � � � � fd�� � }|S )Nc �h �� �| i |��S # t $ r t j d�j � � � w xY w)NzFunction %s failed!)� Exceptionr � exception�__name__)r% r&