Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
compression_utils.cpython-313.pyc109 linesDownload Raw Back to __pycache__
1�

2��j6/���%SSKrSSKrSSKrSSKJrJr SSKJr SSKJ	r	J3r4JrJrJ
r
Jr \RS:�aSSKJr OSSKJr \\\SS	4rSSKrS5r\RS:�aSS
KJr OSS
KJr S6rSrSrSrSr "SS\5r!"SS\5r""SS\5r#"SS\
SS9r$"SS5r%\%"\5r&\%\'S'S\#SS4Sjr(S-S \\)S!\*S\+4S"jjr,"S#S$\5r-"S%S&5r."S'S(\-5r/"S)S*\-5r0"S+S,\-5r1g!\a SSKrN�f=f!\a SrN�f=f!\a SrN�f=f).�N)�ABC�abstractmethod)�Executor)�Any�Final�Optional�Protocol�	TypedDict�cast)��)�Buffer)�Unionzmemoryview[int]zmemoryview[bytes]TF)r�)�ZstdDecompressorii�����c�<�\rSrSrS\S\4SjrS	S\S\4SjjrSr	g)7�ZLibCompressObjProtocol�,�data�returnc��g�N���selfrs  �_D:\code\apps\devtools\python\user_packages\Python313\site-packages\aiohttp/compression_utils.py�compress� ZLibCompressObjProtocol.compress-s��s��modec��grr�rr!s  r�flush�ZLibCompressObjProtocol.flush.s��#r rN�.)8�__name__�9__module__�__qualname__�__firstlineno__r�bytesr�intr$�__static_attributes__rr rrr,s��2�V�2��2�5�#�5�5�5�5r rc�\�\rSrSrSS\S\S\4SjjrSS\S\4Sjjr\	S\104Sj5rS	rg11)�ZLibDecompressObjProtocol�1r�12max_lengthrc��grr�rrr1s   r�13decompress�$ZLibDecompressObjProtocol.decompress2s��r �lengthc��grr�rr6s  rr$�ZLibDecompressObjProtocol.flush3s��Cr c��grr�rs r�eof�ZLibDecompressObjProtocol.eof5s��r rNr&)
r'r(r)r*rr,r+r4r$�property�boolr<r-rr rr/r/1s4��K�v�K�3�K��K�7�C�7�U�7�
��T���r r/c���\rSrSr%\\S'\\S'\\S'\\S'\\S'SS\S\S	\S14\S\S\\S
\4Sjjr	SS	\S\S
\154SjjrSS\S	\S\S
\4Sjjr
SS	\S\S\S
\4SjjrSrg)�ZLibBackendProtocol�9�	MAX_WBITS�Z_FULL_FLUSH�Z_SYNC_FLUSH�Z_BEST_SPEED�Z_FINISH�level�method�wbits�memLevel�strategy�zdictrc��grr)rrHrIrJrKrLrMs       r�compressobj�ZLibBackendProtocol.compressobj@s��#&r c��grr)rrJrMs   r�
decompressobj�!ZLibBackendProtocol.decompressobjIs��$'r rc��grr)rrrHrJs    rr�ZLibBackendProtocol.compressM���r �bufsizec��grr)rrrJrWs    rr4�ZLibBackendProtocol.decompressPrVr rN)......)..)r'r(r)r*r,�__annotations__rrrrOr/rRr+rr4r-rr rrArA9s����N��������M������"%�&��&��&��	&�16�&��
&����&�17!�&�14�(��(�'-�(�	"�(�18?B��&)��8;����	��AD��&)��:=����	��r rAc�4�\rSrSr%\\S'\\S'\\S'Srg)�CompressObjArgs�UrJrLrHrN)r'r(r)r*r,rZr-rr rr\r\Us���J��M��Jr r\)�totalc�$�\rSrSrS\4Sjr\S\4Sj5r\S\	4Sj5r19\S\	4Sj5r\S\	4Sj5r\S\	4S	j5r
\S\	4S20j5rS\S\S\4S
jrS\S\S\4SjrS\S\S\S\4SjrS\S\S\S\4SjrS\S\4SjrSrg)�ZLibBackendWrapper�[�
_zlib_backendc��Xlgr�rb)rrbs  r�__init__�ZLibBackendWrapper.__init__\s��2?�r rc�0�[URSS5$)Nr'�	undefined��getattrrbr;s r�name�ZLibBackendWrapper.name_s���t�)�)�:�{�C�Cr c�.�URR$r)rbrCr;s rrC�ZLibBackendWrapper.MAX_WBITScs���!�!�+�+�+r c�.�URR$r)rbrDr;s rrD�ZLibBackendWrapper.Z_FULL_FLUSHg����!�!�.�.�.r c�.�URR$r)rbrEr;s rrE�ZLibBackendWrapper.Z_SYNC_FLUSHkrqr c�.�URR$r)rbrFr;s rrF�ZLibBackendWrapper.Z_BEST_SPEEDorqr c�.�URR$r)rbrGr;s rrG�ZLibBackendWrapper.Z_FINISHss���!�!�*�*�*r �args�kwargsc�:�URR"U0UD6$r)rbrO�rrxrys   rrO�ZLibBackendWrapper.compressobjws���!�!�-�-�t�>�v�>�>r c�:�URR"U0UD6$r)rbrRr{s   rrR� ZLibBackendWrapper.decompressobjzs���!�!�/�/��@��@�@r rc�B�URR"U/UQ70UD6$r)rbr�rrrxrys    rr�ZLibBackendWrapper.compress}s#���!�!�*�*�4�A�$�A�&�A�Ar c�B�URR"U/UQ70UD6$r)rbr4r�s    rr4�ZLibBackendWrapper.decompress�s#���!�!�,�,�T�C�D�C�F�C�Cr �attrnamec�.�[URU5$rri)rr�s  r�__getattr__�ZLibBackendWrapper.__getattr__�s���t�)�)�8�4�4r rdN)r'r(r)r*rArer>�strrkr,rCrDrErFrGrrrOr/rRrr+rr4r�r-rr rr`r`[sO��@�&9�@��D�c�D��D��,�3�,��,��/�c�/��/��/�c�/��/��/�c�/��/��+�#�+��+�?��?��?�8O�?�A�3�A�#�A�:S�A�B�V�B�C�B�3�B�5�B�D�v�D�c�D�S�D�U�D�5�C�5�C�5r r`�ZLibBackend�new_zlib_backendrc��U[lgr)r�rb)r�s r�set_zlib_backendr��s21�� 0�K�r �encoding�suppress_deflate_headerc��US:XaS[R-$U(a[R*$[R$)N�gzip�)r�rC)r�r�s  r�encoding_to_moder��s9���6���K�)�)�)�)�%<�K�!�!�!�W�+�BW�BW�Wr c�|�\rSrSrS\4S\\S\\4Sjjr\	\224S\S\S\4S	jj5r\234S\S\S\4S24jjr
Srg)�DecompressionBaseHandler�N�executor�max_sync_chunk_sizec��XlX lg)z&Base class for decompression handlers.N��	_executor�_max_sync_chunk_size)rr�r�s   rre�!DecompressionBaseHandler.__init__�s��"��$7�!r rr1rc��g��Decompress the given data.Nrr3s   r�decompress_sync�(DecompressionBaseHandler.decompress_sync�s�r c��# �URb[[U5UR:�aB[R"5R	UR25URX5IShv�N$UR
X5$N7fr�)r��len�asyncio�get_event_loop�run_in_executorr�r�r3s   rr4�#DecompressionBaseHandler.decompress�so���26
�%�%�1��D�	�D�5�5�5� �/�/�1�A�A����� 4� 4�d���
��#�#�D�5�5��s�A$A>�&A<�'A>r�)r'r(r)r*�MAX_SYNC_CHUNK_SIZErrr,rer�ZLIB_MAX_LENGTH_UNLIMITEDr+r�r4r-rr rr�r��s���(,�-@�8��8�$�8�&�c�]�8��-F�)��)�'*�)�	�)��)�.G�6��6�'*�6�	�6�6r r�c��\rSrSrSSSSSS\4S\\S\S\\S\\S\\S	\\	S27\\4Sjjr28S\S
\4SjrS\S
\4Sjr
SS\\S
\4SjjrSrg)�ZLibCompressor�NFr�r�rHrJrLr�r�c��X`lXplUc[X5OUUl[	[29R5Ul0nURUS'UbXXS'UbX8S'URR"S0UD6Ulg)NrJrLrHr)	r�r�r��_moder`r�rbrO�_compressor)	rr�r�rHrJrLr�r�rys	         rre�ZLibCompressor.__init__�s���"��$7�!��}�
�X�?��	
�30�31%7�{�7P�7P�$Q���"$���*�*��w����!)�:����#�7�O��-�-�9�9�C�F�C��r rrc�8�URRU5$r)r�rrs  r�
compress_sync�ZLibCompressor.compress_sync�s�����(�(��.�.r c��0# �URSL=(a [U5UR:�nU(aL[R"5R	UR32URRU5IShv�N$URU5$N7f)a�Compress the data and returned the compressed bytes.33 34Note that flush() must be called after the last call to compress()35 36If the data size is large than the max_sync_chunk_size, the compression37will be done in the executor. Otherwise, the compression will be done38in the event loop.39 40**WARNING: This method is NOT cancellation-safe when used with flush().**41If this operation is cancelled, the compressor state may be corrupted.42The connection MUST be closed after cancellation to avoid data corruption43in subsequent compress operations.44 45For cancellation-safe compression (e.g., WebSocket), the caller MUST wrap46compress() + flush() + send operations in a shield and lock to ensure atomicity.47N)	r�r�r��get_running_loopr�r�r�rr�)rr�should_use_executors   rr�ZLibCompressor.compress�s����&
�%�%�T�1�
6��D�	�D�5�5�5�	�� �1�1�3�C�C����� 0� 0� 9� 9�4���
��!�!�$�'�'��s�A<B�>B�?Br!c�r�URRUbU5$URR5$)a�Flush the compressor synchronously.48 49**WARNING: This method is NOT cancellation-safe when called after compress().**50The flush() operation accesses shared compressor state. If compress() was51cancelled, calling flush() may result in corrupted data. The connection MUST52be closed after compress() cancellation.53 54For cancellation-safe compression (e.g., WebSocket), the caller MUST wrap55compress() + flush() + send operations in a shield and lock to ensure atomicity.56)r�r$rbrGr#s  rr$�ZLibCompressor.flush�s>�����%�%��$�D�57�	58�*.�*<�*<�*E�*E�59�	60r )r�r�r�r�rbr)r'r(r)r*r�rr�r?r,rrer+r�rr$r-rr rr�r��s���#'�(-�#�#�"&�'+�-@�D��3�-�D�"&�D���}�	D�61��}�D��3�-�
D��8�$�D�&�c�]�D�6/�%�/�E�/�(�5�(�U�(�8
62�(�3�-�
63�5�
64�
65r r�c66�^�\rSrSrSSS\4S\\S\S\\S\\	4U4Sjjjr67\4S	\S68\	S\
4SjjrSS
\	S\
4Sjjr\S\4Sj5rSrU=r$)�ZLibDecompressoriNFr�r�r�r�c��>�[TU]X4S9 [X5Ul[	[69R5UlURRURS9Ulg)N�r�r�)rJ)	�superrer�r�r`r�rbrR�
_decompressor)rr�r�r�r��	__class__s     �rre�ZLibDecompressor.__init__sT���	���(��T�%�h�H��70�$6�{�7P�7P�$Q���!�/�/�=�=�D�J�J�=�O��r rr1rc�8�URRX5$r)r�r4r3s   rr�� ZLibDecompressor.decompress_syncs���!�!�,�,�T�>�>r r6c�x�US:�aURRU5$URR5$)Nr)r�r$r8s  rr$�ZLibDecompressor.flushs?����z�
���$�$�V�,�	71��#�#�)�)�+�	72r c�.�URR$r)r�r<r;s rr<�ZLibDecompressor.eofs���!�!�%�%�%r )r�r�rb)r)r'r(r)r*r�rr�r?rr,rer�rr+r�r$r>r<r-�
__classcell__�r�s@rr�r�s����#'�(-�'+�-@�73P��3�-�74P�"&�75P��8�$�	76P�77&�c�]�78P�79P�/H�?��?�(+�?�	�?�8081�C�82��83��&�T�&��&r r�c�v^�\rSrSrS\4S\\S\\SS4U4Sjjjr\	4S\84S\S\4S	jjrS\4S85jr
SrU=r$)�BrotliDecompressori Nr�r�rc�>�[(d[S5e[R"5Ul[86TU]XS9 g)z)Decompress data using the Brotli library.zIThe brotli decompression is not available. Please install `Brotli` moduler�N)�87HAS_BROTLI�RuntimeError�brotli�Decompressor�_objr�re�rr�r�r�s   �rre�BrotliDecompressor.__init__$s>����z��1��
��'�'�)��	�
���(��Tr rr1c���[URS5(a)[[URR	X55$[[URRX55$)r�r4)�hasattrr�rr+r4�processr3s   rr��"BrotliDecompressor.decompress_sync2sM���4�9�9�l�+�+���t�y�y�3�3�D�E�F�F��E�4�9�9�,�,�T�>�?�?r c��[URS5(a([[URR	55$g)zFlush the decompressor.r$r )r�r�rr+r$r;s rr$�BrotliDecompressor.flush:s.���4�9�9�g�&�&���t�y�y���0�1�1�r �r�)r'r(r)r*r�rrr,rer�rr+r�r$r-r�r�s@rr�r� sw���(,�-@�U��8�$�U�&�c�]�U�88�	U�U�/H�@��@�(+�@�	�@��u��r r�c�v^�\rSrSrS\4S\\S\\SS4U4Sjjjr\	4S\89S\S\904S	jjrS\914S92jrSr
U=r$)�ZSTDDecompressoriANr�r�rc�j>�[(d[S5e[5Ul[TU]XS9 g)NzOThe zstd decompression is not available. Please install `backports.zstd` moduler�)�HAS_ZSTDr�rr�r�rer�s   �rre�ZSTDDecompressor.__init__Bs8���93�x��9��
�%�&��	�
���(��Tr rr1c�\�U[:Xa[OUnURRX5$r)r��ZSTD_MAX_LENGTH_UNLIMITEDr�r4)rrr1�zstd_max_lengths    rr�� ZSTDDecompressor.decompress_syncOs1���6�6�
&��	�94�y�y�#�#�D�:�:r c��g)Nr rr;s rr$�ZSTDDecompressor.flush[s��r r�)r'r(r)r*r�rrr,rer�r+r�r$r-r�r�s@rr�r�Ass���(,�-@�U��8�$�U�&�c�]�U�95�	U�U�.G�96;��97;�'*�98;�	�99;��u��r r�)NF)2r��sys�zlib�abcrr�concurrent.futuresr�typingrrrr	r100r�version_info�collections.abcrrr+�	bytearray�101brotlicffir��ImportErrorr��compression.zstdr�backports.zstdr�r��DEFAULT_MAX_DECOMPRESS_SIZEr�r�rr/rAr\r`r�rZr�r�r?r,r�r�r�r�r�r�rr r�<module>r�s����102��#�'�B�B����w��&��
�5�)�%6�8K�K�
L�F���#��J��103���7�"�5�3��H�104��#������6�h�6�105����(��8�i�u��*5�*5�Z#5�T�":��
�:�1�':�1�t�1�106#�$)�X��s�m�X�!�X�	�X�6�s�6�<H107�H108�V&�/�&�<�1��B�/���_	��������J������H��sB�D�D&�D4�109D#� D&�"D#�#D&�&D1�0D1�4D?�>D?
codekingpro/portable-devtools · Team Ai