Team Ai
Datasetpublic

codekingpro/portable-devtools

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

2��j'����SSKJr SSKrSSKJr SSKJr \R"\5r	S\3S\4S\4S	jr"S5S5r
S\\6\\\\7\4444Sjr\"5\
lg)
�)�dequeN)�Optional�)�InvalidTableIndex�name�value�returnc�6�S[U5-[U5-$)a78Calculates the size of a single entry9 10This size is mostly irrelevant to us and defined11specifically to accommodate memory management for12lower level implementations. The 32 extra bytes are13considered the "maximum" overhead that would be14required to represent each entry in the table.15 16See RFC7541 Section 4.117� )�len)rrs  �QD:\code\apps\devtools\python\user_packages\Python313\site-packages\hpack/table.py�table_entry_sizers����D�	�>�C��J�&�&�c�$�\rSrSr%SrSrSr\"\5r\	\18\\\	\19\444\
S'SSjrS	\S\\20\2144S22jrS\4SjrS\23S
\24SS4SjrS\25S
\26S\\\\27\\2844Sjr\S\4Sj5r\R.S\SS4Sj5rSSjrSrg)�HeaderTable�z�29Implements the combined static and dynamic header table30 31The name and value arguments for all the functions32should ONLY be byte strings (b'') however this is not33strictly enforced in the interface.34 35See RFC7541 Section 2.336i)=)s37:authorityr)�:methodsGET)rsPOST)�:path�/)rs/index.html)�:schemeshttp)rshttps)�:statuss200)rs204)rs206)rs304)rs400)rs404)rs500)saccept-charsetr)saccept-encodings
gzip, deflate)saccept-languager)s
accept-rangesr)sacceptr)saccess-control-allow-originr)sager)sallowr)s
authorizationr)s
cache-controlr)scontent-dispositionr)scontent-encodingr)scontent-languager)scontent-lengthr)scontent-locationr)s
content-ranger)scontent-typer)scookier)sdater)setagr)sexpectr)sexpiresr)sfromr)shostr)sif-matchr)sif-modified-sincer)s
if-none-matchr)sif-ranger)sif-unmodified-sincer)s
last-modifiedr)slinkr)slocationr)smax-forwardsr)sproxy-authenticater)sproxy-authorizationr)sranger)srefererr)srefreshr)sretry-afterr)sserverr)s38set-cookier)sstrict-transport-securityr)stransfer-encodingr)s39user-agentr)svaryr)sviar)swww-authenticater�STATIC_TABLE_MAPPINGr	Nc�h�[RUlSUlSUl[5Ulg)NrF)r�DEFAULT_SIZE�_maxsize�
_current_size�resizedr�dynamic_entries��selfs r
�__init__�HeaderTable.__init__ns(��#�0�0��
�������;@�7��r�indexc���UnUS-nSU::abU[R:a[RU$U[R-nU[UR5:aURU$[SU-5e)a.40Returns the entry specified by index41 42Note that the table is 1-based ie an index of 0 is43invalid.  This is due to the fact that a zero value44index signals that a completely unindexed header45follows.46 47The entry will either be from the static table or48the dynamic table depending on the value of index.49rrzInvalid table index %d)r�STATIC_TABLE_LENGTH�STATIC_TABLErrr)r r#�original_indexs   r
�get_by_index�HeaderTable.get_by_indexts}����
��50����:��{�6�6�6�"�/�/��6�6��[�4�4�4�E��s�4�/�/�0�0��+�+�E�2�2�� 8�>� I�J�Jrc�N�SURURUR4-$)NzHeaderTable(%d, %s, %r))rrrrs r
�__repr__�HeaderTable.__repr__�s+��(��M�M��L�L�� � �,51�52�	53rrrc���[X5nX0R:�a"URR5 SUlgURRX45 U=RU-
slUR
5 g)zu54Adds a new entry to the table55 56We reduce the table size if the entry will make the57table size greater than maxsize.58rN)rrr�clearr�59appendleft�_shrink)r rr�sizes    r
�add�HeaderTable.add�sd�� ��,���-�-��� � �&�&�(�!"�D��
� � �+�+�T�M�:����$�&���L�L�Nrc�D�Sn[RRU5nU(a#USRU5nUbXQU4$USUS4n[RS-n[	UR605H(unup�X�:XdMX�:XaXv-X�4s $UbM!Xv-US4nM* U$)z�61Searches the table for the entry specified by name62and value63 64Returns one of the following:65    - ``None``, no match at all66    - ``(index, name, None)`` for partial matches on name only.67    - ``(index, name, value)`` for perfect matches.68Nrr)rr�getr%�	enumerater)69r rr�partial�header_name_search_resultr#�offset�i�n�vs70          r
�search�HeaderTable.search�s�����$/�$D�$D�$H�$H��$N�!�$�-�a�0�4�4�U�;�E�� ��E�)�)�4�Q�7��t�D���0�0�1�4��$�T�%9�%9�:�K�Q����y��:��:�q�+�+��_� �z�1�d�3�G�;��rc��UR$)N)rrs r
�maxsize�HeaderTable.maxsize�s���}�}�r�newmaxc��[U5n[RSXR5 URnXlX:gUlUS::a"UR71R
5 SUlgX!:�aUR5 gg)Nz#Resizing header table to %d from %dr)	�int�log�debugrrrr.rr0)r rB�oldmaxs   r
r@rA�sj���V����	�	�7����O������
��(����Q�;�� � �&�&�(�!"�D��
�_��L�L�N�rc���URnXR:�aQURR5up#U[	X#5-n[72R
SX#5 XR:�aMQXlg)z573Shrinks the dynamic table to be at or below maxsize74z%Evicting %s: %s from the header tableN)rrr�poprrErF)r �cursizerrs    r
r0�HeaderTable._shrink�sb���$�$���
�
�%��.�.�2�2�4�K�D��'��4�4�G��I�I�=�t�K��
�
�%�%�r)rrrr)r	N)�__name__�75__module__�__qualname__�__firstlineno__�__doc__rr&rr%�dict�bytes�tuplerD�__annotations__r!r(�strr+r2rr=�propertyr@�setterr0�__static_attributes__�rr
rrs����L�>�L�@�l�+���u�e�C��e�S�j�1A�,A�&B�B�C�C�C�K�#�K�%��u��*=�K�076�#�77����e����$�5����8�E�#�u�h�W\�o�B]�<^�3_��:������
�^�^�78�c�79�d�80��81�	%rrc��0n[[RS5H"unup#URX!045nXSU'M$ U$)z�82Build static table mapping from header name to tuple with next structure:83(<minimal index of header>, <mapping from header value to it index>).84 85static_table_mapping used for hash searching.86r)r6rr&�87setdefault)�static_table_mappingr#rrr8s     r
�_build_static_table_mappingr]�sV��GI�� )�+�*B�*B�A� F���}��$8�$C�$C�D�RT�+�$V�!�.3�!�$�U�+�!G� �r)�collectionsr�logging�typingr�88exceptionsr�	getLoggerrLrErRrDrrrQrSr]rrYrr
�<module>rcs~�����)�
����!��'�5�'��'�3�'�B%�B%�J �T�%��s�D����<L�7L�1M�*M�%N� �$?�#@�� r
codekingpro/portable-devtools · Team Ai