� B�g���F�dZddlZddlZddlZddlZddlmZmZmZm Z ddl Z ddl m Z ddl m Z eje��ZdZGd�dejd d ��e j��ZGd �d e j��ZGd �de j��Zde jdefd�Zdededefd�ZdS)z#Internal utilities for gRPC Python.�N)�Callable�Dict�Optional�Sequence)�_common)�DoneCallbackTypez6Exception calling connectivity future "done" callback!c��eZdZdS)�RpcMethodHandlerN)�__name__� __module__� __qualname__���_/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/grpc/_utilities.pyr r !s������  �Drr �_RpcMethodHandler)�request_streaming�response_streaming�request_deserializer�response_serializer� unary_unary� unary_stream� stream_unary� stream_streamc��eZdZUeed<eeejfed<dedeeejffd�Zdefd�Z dej de ejfd �Z d S) �DictionaryGenericHandler�_name�_method_handlers�service�method_handlersc�`���|_�fd�|���D��|_dS)Nc�B��i|]\}}tj�|��|��Sr)r�fully_qualified_method)�.0�method�method_handlerrs �r� <dictcomp>z5DictionaryGenericHandler.__init__.<locals>.<dictcomp><s<���! �! �! �&��� � *�7�F� ;� ;�^�! �! �! r)r�itemsr)�selfrrs ` r�__init__z!DictionaryGenericHandler.__init__8sI����� �! �! �! �! �*9�*?�*?�*A�*A�! �! �! ����r�returnc��|jS�N)r�r(s r� service_namez%DictionaryGenericHandler.service_nameAs ���z�r�handler_call_detailsc�D�|j}|j�|��Sr,)r$r�get)r(r/�details_methods rrz DictionaryGenericHandler.serviceDs*��.�4���$�(�(� � � � rN) r r r �str�__annotations__r�grpcr r)r.�HandlerCallDetailsrrrrrrr4s�������� �J�J�J��3�� 5�5�6�6�6�6� �� �-1�#�t�7L�2L�-M� � � � ��c����� �$(�$;� � �$�'� (� � � � � � rrc�\�eZdZUejed<ejed<eed<eed<e e ed<dejfd�Z de e d d fd �Zd e ejd d fd �Zd efd�Zd efd�Zd efd�Zd efd�Zdde e d d fd�Zdde e d d fd�Zdde e d d fd�Zdefd�Zd�Zd�Zd S)�_ChannelReadyFuture� _condition�_channel�_matured� _cancelled�_done_callbacks�channelc�n�tj��|_||_d|_d|_g|_dS)NF)� threading� Conditionr9r:r;r<r=)r(r>s rr)z_ChannelReadyFuture.__init__Ts5��#�-�/�/����� ��� ����!����r�timeoutr*Nc��|�dntj��|z}|j5 |jrtj���|jr ddd��dS|�|j���nJ|tj��z }|dkrtj���|j�|�����#1swxYwYdS)NTr)rB)�timer9r<r5�FutureCancelledErrorr;�wait�FutureTimeoutError)r(rB�until� remainings r�_blockz_ChannelReadyFuture._block\s-������T�Y�[�[�7�-B�� �_� D� D� D��?� D��3�5�5�5��]� D��  D� D� D� D� D� D� D� D��}���,�,�.�.�.�.�$)�D�I�K�K�$7� �$�q�=�=�"&�"9�";�";�;� �O�0�0��0�C�C�C� D� D� D� D� D���� D� D� D� D� D� Ds�$B:�A'B:�:B>�B>� connectivityc���|j5|jsn|tjjur[d|_|j�|j��|j� ��t|j ��}d|_ n ddd��dS ddd��n #1swxYwY|D]=} ||���#t$r"t�t��Y�:wxYwdS)NT)r9r<r5�ChannelConnectivity�READYr;r:� unsubscribe�_update� notify_all�tupler=� Exception�_LOGGER� exception�$_DONE_CALLBACK_EXCEPTION_LOG_MESSAGE)r(rK�done_callbacks� done_callbacks rrPz_ChannelReadyFuture._updatensj�� �_� � ��O� � �D�$<�$B�B�B� $�� �� �)�)�$�,�7�7�7���*�*�,�,�,�!&�t�';�!<�!<��'+��$�$�� � � � � � � � �%� � � � � � � � � � � ���� � � � �,� H� H�M� H�� �d�#�#�#�#��� H� H� H��!�!�"F�G�G�G�G�G� H���� H� Hs$�A7B�B� B�) B5�5)C!� C!c��|j5|js[d|_|j�|j��|j���t|j��}d|_n ddd��dS ddd��n #1swxYwY|D]=} ||���#t$r"t� t��Y�:wxYwdS)NTF) r9r;r<r:rOrPrQrRr=rSrTrUrV)r(rWrXs r�cancelz_ChannelReadyFuture.cancel�sT�� �_� � ��=� �"&���� �)�)�$�,�7�7�7���*�*�,�,�,�!&�t�';�!<�!<��'+��$�$�� � � � � � � � � %�  � � � � � � � � � � ���� � � � �,� H� H�M� H�� �d�#�#�#�#��� H� H� H��!�!�"F�G�G�G�G�G� H�����ts$�A$B�B � B � B"�")C� Cc�R�|j5|jcddd��S#1swxYwYdSr,)r9r<r-s r� cancelledz_ChannelReadyFuture.cancelled�ss�� �_� #� #��?� #� #� #� #� #� #� #� #� #� #� #� #���� #� #� #� #� #� #s �� � c�d�|j5|j o|j cddd��S#1swxYwYdSr,�r9r<r;r-s r�runningz_ChannelReadyFuture.running�s��� �_� =� =���&�<�t�}�+<� =� =� =� =� =� =� =� =� =� =� =� =���� =� =� =� =� =� =s �%�)�)c�`�|j5|jp|jcddd��S#1swxYwYdSr,r^r-s r�donez_ChannelReadyFuture.done�sz�� �_� 4� 4��?�3�d�m� 4� 4� 4� 4� 4� 4� 4� 4� 4� 4� 4� 4���� 4� 4� 4� 4� 4� 4s �#�'�'c�0�|�|��dSr,�rJ�r(rBs r�resultz_ChannelReadyFuture.result���� � � �G�����rc�0�|�|��dSr,rcrds rrUz_ChannelReadyFuture.exception�rfrc�0�|�|��dSr,rcrds r� tracebackz_ChannelReadyFuture.traceback�rfr�fnc���|j5|js/|js(|j�|�� ddd��dSddd��n #1swxYwY||��dSr,)r9r<r;r=�append)r(rjs r�add_done_callbackz%_ChannelReadyFuture.add_done_callback�s��� �_� � ��?� �4�=� ��$�+�+�B�/�/�/�� � � � � � � � � � � � � � � � � � � ���� � � � � ��4�����s�*A � A�Ac��|j5|j�|jd���ddd��dS#1swxYwYdS)NT)�try_to_connect)r9r:� subscriberPr-s r�startz_ChannelReadyFuture.start�s��� �_� G� G� �M� #� #�D�L�� #� F� F� F� G� G� G� G� G� G� G� G� G� G� G� G���� G� G� G� G� G� Gs �"7�;�;c��|j5|js&|js|j�|j��ddd��dS#1swxYwYdSr,)r9r<r;r:rOrPr-s r�__del__z_ChannelReadyFuture.__del__�s��� �_� 8� 8��?� 8�4�=� 8�� �)�)�$�,�7�7�7� 8� 8� 8� 8� 8� 8� 8� 8� 8� 8� 8� 8���� 8� 8� 8� 8� 8� 8s�.A�A� Ar,)r r r r@rAr4r5�Channel�boolrrr)r�floatrJrMrPrZr\r_rarerUrirrmrqrsrrrr8r8Ms���������#�#�#�#��l�����N�N�N������h�'�'�'�'�"�� �"�"�"�"�D�h�u�o�D�$�D�D�D�D�$H�H�T�-E�$F�H�4�H�H�H�H�(������&#�4�#�#�#�#�=��=�=�=�=�4�d�4�4�4�4���h�u�o����������%���D��������%���D������$4�����G�G�G�8�8�8�8�8rr8r>r*c�L�t|��}|���|Sr,)r8rq)r>� ready_futures r�channel_ready_futurery�s'��&�w�/�/�L������� �r�version1�version2c��|�d��}|�d��} td��D]`}t||��t||��krdSt||��t||��krdS�an#t$rYdSwxYwt |��t |��kS)a� Compares two versions in the format '1.60.1' or '1.60.1.dev0'. This method will be used in all stubs generated by grpcio-tools to check whether the stub version is compatible with the runtime grpcio. Args: version1: The first version string. version2: The second version string. Returns: True if version1 is lower, False otherwise. �.�TF)�split�range�int� ValueError�len)rzr{� version1_list� version2_list�is r�first_version_is_lowerr��s����N�N�3�'�'�M��N�N�3�'�'�M���q��� � �A��=��#�$�$�s�=��+;�'<�'<�<�<��t�t��]�1�%�&�&��]�1�-=�)>�)>�>�>��u�u�?� �� �����u�u����� �}� � ��M� 2� 2� 2�2s�>B�,-B�B� B+�*B+)�__doc__� collections�loggingr@rD�typingrrrrr5r� grpc._typingr� getLoggerr rTrV� namedtupler �ServiceRpcHandlerr�Futurer8rtryr3rur�rrr�<module>r�s���*�)������������� � � � �5�5�5�5�5�5�5�5�5�5�5�5� � � � �������)�)�)�)�)�)� �'� �H� %� %��=�%�  � � � � ��K��� � � � �� � � �& � � � � �t�5� � � �2l8�l8�l8�l8�l8�$�+�l8�l8�l8�^�$�,��3F����� 3�S�3�C�3�D�3�3�3�3�3�3r
Memory