CoolFace
Apppublic

fred-dev/comfy_ui_ali

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
terminal_service.cpython-312.pyc7 linesDownload Raw Back to __pycache__
1�

2���g���4�ddlmZddlZddlZGd�d�Zy)�)�on_flushNc�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�TerminalServicec�v�||_d|_d|_t�|_t|j�y�N)�server�cols�rows�set�
subscriptionsr�
send_messages)�selfrs  �o/Users/fredrodrigues/Library/CloudStorage/Dropbox/Code/comfyui_hardware/api_server/services/terminal_service.py�__init__zTerminalService.__init__s/�������	���	� �U�����#�#�$�c���	tj�}|j|jfS#t$r@	tj�}|j|jfcYS#t$rYYywxYwwxYw)N)�P�)�os�get_terminal_size�columns�lines�OSError�shutil)r�sizes  rrz!TerminalService.get_terminal_sizeso��	 ��'�'�)�D��L�L�$�*�*�-�-���	 �
 ��/�/�1�����d�j�j�1�1���
 ��
 ��		 �s,�+.�	A7�+A&�#A7�&	A3�/A7�2A3�3A7c���|j�\}}d}||jk7r	||_d}||jk7r	||_d}|r|j|jd�Sy)NFT)r	r3)rr	r4)rrr�changeds    r�update_sizezTerminalService.update_sizesb���/�/�1�������d�i�i���D�I��G��D�I�I���D�I��G�� �I�I�t�y�y�9�9�rc�:�|jj|�yr)r�add�r�	client_ids  r�	subscribezTerminalService.subscribe*s�������y�)rc�:�|jj|�yr)r�discardr!s  r�unsubscribezTerminalService.unsubscribe-s�����"�"�9�-rc�8�t|�rt|j�sy|j�}|jj�D]L}||jj5vr|j
|��-|jjd||d�|��Ny)N�logs)�entriesr)�lenrr�copyr�socketsr&�	send_sync)rr)�new_sizer"s    rr
zTerminalService.send_messages0s���7�|�3�t�'9�'9�#:���#�#�%���+�+�0�0�2�I����� 3� 3�3�� � ��+���K�K�!�!�&�g�x�*P�R[�\�
3rN)	�__name__�6__module__�__qualname__rrrr#r&r
�rrrrs!��%�	 ��"*�.�]rr)�7app.loggerrrrrr2rr�<module>r4s���	�
�6]�6]r