Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
_link.cpython-313.pyc40 linesDownload Raw Back to __pycache__
1�

2s�j?�	��SSKJrJrJrJr SSKJr SSKJrJ	r	J3r4JrJrJ
r
 \(aSSKJr SSKJr SSKJr "S	S55r"SS5r\\\4rS
SSSS\\\\44SjrS\6SSS\\4SjrS\SSS\\4Sjrg)�)�
TYPE_CHECKING�Optional�Union�cast�)�logger_warning�)�ArrayObject�DictionaryObject�IndirectObject�	PdfObject�TextStringObject�is_null_or_none)�7PageObject)�	PdfReader)�	PdfWriterc�\�\rSrSrSrS\SSSS4SjrS\\S44S	jr	S8SS\SS4S
jr9Srg)�NamedReferenceLink�*zGNamed reference link being preserved until we can resolve it correctly.�	reference�10source_pdfr�returnNc��XlX lg)z0reference: TextStringObject with named referenceN��11_reference�_source_pdf)�selfrrs   �YD:\code\apps\devtools\python\user_packages\Python313\site-packages\pypdf/generic/_link.py�__init__�NamedReferenceLink.__init__-s
��#��%��c��URRR[UR55nU(aUR12$S$�N)r�named_destinations�get�strr�page)r�destinations  r�find_referenced_page�'NamedReferenceLink.find_referenced_page2s:���&�&�9�9�=�=�c�$�/�/�>R�S��#.�{���8�D�8r!�13target_pdfr�new_pagec��[UR5UR;a0UR[UR5UR5 gg)�2target_pdf: PdfWriter which the new link went intoN)r&rr$�add_named_destination�page_number�rr+r,s   r�patch_reference�"NamedReferenceLink.patch_reference6s@���t����z�'D�'D�D��,�,�S����-A�8�CW�CW�X�Er!r)�__name__�14__module__�__qualname__�__firstlineno__�__doc__rrrrr)r2�__static_attributes__�r!rrr*sV��Q�&�"2�&��&�PT�&�159�e�N�D�,@�&A�9�Y�+�Y��Y�TX�Yr!rc�N�\rSrSrSrS\SS4SjrS\4SjrSS	S16\SS4Sjr	Sr17g)
�DirectReferenceLink�=zHDirect reference link being preserved until we can resolve it correctly.rrNc��Xlg)zIreference: an ArrayObject whose first element is the Page indirect objectN�r)rrs  rr�DirectReferenceLink.__init__@s��#�r!c�<�[[URS5$)Nr)rrr)rs rr)�(DirectReferenceLink.find_referenced_pageDs���N�D�O�O�A�$6�7�7r!r+rr,c� �X RS'g)r.rNr?r1s   rr2�#DirectReferenceLink.patch_referenceGs��%����r!r?)r4r5r6r7r8r18rrr)r2r9r:r!rr<r<=s?��R�$�+�$�$�$�8�n�8�&�+�&��&�TX�&r!r<r,r�old_pagerc��URS[55R5nURS[55R5n[U5(a19[5n[U5(a20[5n[	U[5(a[	U[5(d[SUSUS3[5 /$UVs/sHn[X@5=ncMUPM nnUVs/sHn[XA5=ncMUPM nn[U5[U5:wa[SUSU3[5 [[Xg55$s snfs snf)aExtracts links from two pages on the assumption that the two pages are21the same. Produces one list of (new link, old link) tuples.22 23Non-link annotations are ignored before pairing to avoid dropping valid24links when one page includes additional non-link annotation entries.25z/AnnotszExpected annotation arrays: � z. Ignoring annotations.zAnnotation sizes differ: z vs. )r%r26�27get_objectr�28isinstancerr4�_build_link�len�list�zip)r,rE�new_annotations�old_annotations�29annotation�link�	new_links�	old_linkss        r�
extract_linksrTOsF���l�l�9�k�m�<�G�G�I�O��l�l�9�k�m�<�G�G�I�O���'�'�%�-����'�'�%�-���o�{�3�3�:�o�Wb�;c�;c��*�?�*;�1�_�<M�Md�e��	30��	�*��)�J��31�5�5�D�	
�)���*��)�J��32�5�5�D�	
�)����9�~��Y��'��'�	�{�%�	�{�C��	33�34��I�)�*�*��#��35s�E�"E�.E�E�indirect_objectr'c�v�[SUR5n[[UR55n[	U[5(aURS5S:wagSU;a?[[US5nURS5S:wagSU;ag[
USU5$SU;a[
USU5$g)	Nrz/Subtypez/Linkz/Az/Sz/GoToz/Dz/Dest)r�pdfrrHrIr%�_create_link)rUr'�srcrQ�actions     rrJrJvs���36�{�D�H�H�37%�C�� �/�"<�"<�">�?�D��t�-�.�.�4�8�8�J�3G�7�3R���t�|��&��T�38�3���:�:�d��w�&���v����F�4�L�#�.�.��$���D��M�3�/�/�r!rrrc��[U[5(a[X5$[U[5(a[	U5$gr#)rIrrr39r<)rrs  rrXrX�s6���)�-�.�.�!�)�8�8��)�[�)�)�"�9�-�-�r!N)�typingrrrr�_utilsr�r40rrr
rr�_pager�_readerr�_writerrrr<�
ReferenceLinkrL�tuplerTrJrXr:r!r�<module>rds���>8�7�#�i�i��"�#�#�Y�Y�&&�&��(�*=�=�>�
�$+�L�$+�L�$+�T�%�P]�_l�Pl�Jm�En�$+�N���|���Q^�H_��*�I��;��8�M�CZ�r!
codekingpro/portable-devtools · Team Ai