Team Ai
Datasetpublic

codekingpro/portable-devtools

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

2�j�*��z�SSKJr SSKrSSKrSSKrSSKJr SSKJ	r	J3r4JrJr \	(a'SSK
r
SSKJr \
RS:�aSSKJr OSSKJr /SQrS%S	jr\"S55r"SS\5r\"S
\S9rS&SjrS'SjrS(SjrS)Sjr\R6"S5rS*SjrS+Sjr"SS\5r "SS\ 5r!\RD"SSS9"SS55r#\RD"SSS9"SS 55r$\RD"SSS9"S!S"55r%\RD"SSS9"S#S$55r&g),�)�annotationsN)�Mapping)�
TYPE_CHECKING�Any�Protocol�TypeVar)�6Collection)��)�Self)�ArchiveInfo�DirInfo�	DirectUrl�DirectUrlValidationError�VcsInfoc��[$�N)�__all__���FD:\code\apps\devtools\python\Lib\site-packages\packaging/direct_url.py�__dir__rs���Nr�_Tc�(�\rSrSr\SSj5rSrg)�_FromMappingProtocol�"c��grr��cls�ds  r�7_from_dict�_FromMappingProtocol._from_dict#s��7:rrN�r �Mapping[str, Any]�returnr)�__name__�8__module__�__qualname__�__firstlineno__�classmethodr!�__static_attributes__rrrrr"s���:��:rr�_FromMappingProtocolT)�boundc�F�UVVs0sHupUcM9X_M snn$s snnfrr)�data�key�values   r�_json_dict_factoryr2*s"��)-�C��:�3��J�C�J��C�C��Cs�	�c��URU5=ncg[X15(d.[S[U5RSURS3US9eU$)zBGet a value from the dictionary and verify it's the expected type.NzUnexpected type z (expected �)��context)�get�10isinstancer�typer&�r �
expected_typer0r1s    r�_getr<.sd�����s����$���e�+�+�&��t�E�{�3�3�4�5�&�/�/�0��
3��11�	12�13�Lrc�:�[XU5=nc[U5eU$)zKGet a required value from the dictionary and verify it's the expected type.)r<�_DirectUrlRequiredKeyErrorr:s    r�
_get_requiredr?;s$���a��,�,��5�(��-�-��Lrc��[U[U5=ncgURU5$![an[	XBS9UeSnAff=f)zIGet a dictionary value from the dictionary and convert it to a dataclass.Nr5)r<rr!�	Exceptionr)r �target_typer0r1�es     r�_get_objectrDBsN���a��#�&�&��/��>��%�%�e�,�,���>�&�q�6�A�=��>�s�(�14A�15<�Az.^\$\{[A-Za-z0-9-_]+\}(:\$\{[A-Za-z0-9-_]+\})?$c��SU;aU$URSS5up#X!;aU$[RU5(aU$U$)N�@�)�split� _PEP610_USER_PASS_ENV_VARS_REGEX�match)�netloc�safe_user_passwords�	user_pass�netloc_no_user_passs    r�_strip_auth_from_netlocrOSsI��16�&���
�%+�\�\�#�q�%9�"�I��'��
�'�-�-�i�8�8��
��rc��[RRU5n[URU5n[RRURUURURUR45$)z�url with user:password part removed unless it is formed with17environment variables as specified in PEP 610, or it is a safe user:password18such as `git`.19)20�urllib�parse�urlsplitrOrK�21urlunsplit�scheme�path�query�fragment)�urlrL�22parsed_urlrKs    r�23_strip_urlr[^sl��24���&�&�s�+�J�
$�Z�%6�%6�8K�
L�F��<�<�"�"������O�O�������	25��rc�X�\rSrSr%SrSrS\S'S\S'SS.SS	jjrS
S26jrSr	g)r�pz2Raised when when input data is not spec-compliant.N�27str | Noner6�str�messager5c��[U[5(aSUR(a*U(aUSUR3OURUlOX lURUlgX l[	U5Ulg)N�.)r8rr6r`r_)�self�causer6s   r�__init__�!DirectUrlValidationError.__init__vs\���e�5�6�6��}�}�4;�w�i�q�����0������ '�� �=�=�D�L�"�L��u�:�D�Lrc�t�UR(aURSUR<3$UR$)Nz in �r6r`�rcs r�__str__� DirectUrlValidationError.__str__�s-���<�<��l�l�^�4����'7�8�8��|�|�rrh)rdzstr | Exceptionr6r^r%�None)r%r_)28r&r'r(r)�__doc__r6�__annotations__rerjr+rrrrrps?��<��G�Z��
�L�#�	&��&��	&�2930�&�$rrc�,^�\rSrSrSU4SjjrSrU=r$)r>�c�">�[TU]SUS9 g)NzMissing required valuer5)�superre)rcr0�	__class__s  �rre�#_DirectUrlRequiredKeyError.__init__�s���
���1�3��?rr)r0r_r%rl)r&r'r(r)rer+�
__classcell__)rss@rr>r>�s���@�@rr>TF)�frozen�initc�l�\rSrSr%S\S'S\S'SrS\S'SS.SS	jjr\S
S31j5rSr	g)r�r_�vcs�	commit_idNr^�requested_revision)r|c��[RUSU5 [RUSU5 [RUSU5 g)Nrzr{r|��object�__setattr__)rcrzr{r|s    rre�VcsInfo.__init__�s<��	���4���,����4��i�8����4�!5�7I�Jrc	�l�U"[U[S5[U[S5[U[S5S9$)Nrzr|r{)rzr|r{)r?r_r<rs  rr!�VcsInfo._from_dict�s6����a��e�,�#�A�s�,@�A�#�A�s�K�8�32�	33rr)rzr_r{r_r|r^r%rlr#)34r&r'r(r)rnr|rer*r!r+rrrrr�sb��	�H��N�%)��35�)�*.�	K��	K��		K�36'�	K�37�
	K��38��39rrc�P�\rSrSr%SrS\S'SS.S	Sjjr\S40Sj5rSr	g)r
�N�Mapping[str, str] | None�hashes�r�c�2�[RUSU5 g)Nr�r~)rcr�s  rre�ArchiveInfo.__init__�s��41	���4��6�2rc�h�[U[S5nUb/[SUR555(d42[	SSS9e[U[43S5nUbVSU;a44[	SSS9eUR
SS5upEUcXE0nO+XB;a[	S	U<S453SS9eX$U:wa[	S	U<S3SS9eU"US9$)
Nr�c3�B# �UHn[U[5v� M g7fr)r8r_)�.0�hs  r�	<genexpr>�)ArchiveInfo._from_dict.<locals>.<genexpr>�s���)V�o��*�Q��*<�*<�o�s�zHash values must be stringsr5�hash�=z3Invalid hash format (expected '<algorithm>=<hash>')rGz46Algorithm z2 used in hash field is not present in hashes fieldz7 used in hash field has different value in hashes fieldr�)r<r�all�valuesrr_rH)rr r��legacy_hash�hash_algorithm�47hash_values      rr!�ArchiveInfo._from_dict�s����a��(�+����c�)V�f�m�m�o�)V�&V�&V�*�-�x��
��1�c�6�*���"��+�%�.�I�"���*5�):�):�3��)B�&�N��~�(�5��"�/�2�$�^�$6�79�:� (���48�)�Z�7�2�$�^�$6�7>�?� &���49�&�!�!rr)r�r�r%rlr#)50r&r'r(r)r�rnrer*r!r+rrrr
r
�s?��'+�F�$�+�51,0�3�)�3�52�	3��"��"rr
c�P�\rSrSr%SrS\S'SS.S	Sjjr\S53Sj5rSr	g)r��N�bool | None�editable�r�c�2�[RUSU5 g)Nr�r~)rcr�s  rre�DirInfo.__init__�s��54	���4��X�6rc�,�U"[U[S5S9$)Nr�r�)r<�boolrs  rr!�DirInfo._from_dict�s����!�T�:�.�55�	56rr)r�r�r%rlr#)57r&r'r(r)r�rnrer*r!r+rrrrr�s>�� �H�k� �58!%�7��7�59�	7��60��61rrc���\rSrSr%SrS\S'SrS\S'SrS\S	'SrS62\S'Sr	S\S
'SSSSS.SSjjr63\SSj5r\SSj5r
SSSS.SSjjrSSjrSrg)r��z"A class representing a direct URL.r_rYN�ArchiveInfo | None�archive_info�VcsInfo | None�vcs_info�DirInfo | None�dir_infor^�subdirectory)r�r�r�r�c���[RUSU5 [RUSU5 [RUSU5 [RUSU5 [RUSU5 g)NrYr�r�r�r�r~)rcrYr�r�r�r�s      rre�DirectUrl.__init__�s^��	���4���,����4���>����4��X�6����4��X�6����4���>rc��U"[U[S5[U[S5[U[S5[U[64S5[
U[S5S9n[UR5[UR5-[UR5-S:wa[S5eURb*URRS	5(d65[S66SS9eU$)NrYr�r�r�r�)rYr�r�r�r�rGz?Exactly one of vcs_info, archive_info, dir_info must be presentzfile://z3URL scheme must be file:// when dir_info is presentr5)r?r_rDr
rrr<r�r�r�r�rrY�67startswith)rr �68direct_urls   rr!�DirectUrl._from_dicts�����a��e�,�$�Q��^�D� ��G�Z�8� ��G�Z�8��a��n�5�69�70�
��$�$�%��:�*�*�+�
,��:�&�&�'�
(��	�71+�Q��
����*�:�>�>�3L�3L�Y�3W�3W�*�E���
�72�rc�$�URU5$)z@Create and validate a DirectUrl instance from a JSON dictionary.)r!rs  r�	from_dict�DirectUrl.from_dict s���~�~�a� � rFT)�git)�generate_legacy_hash�strip_user_passwordrLc�h�[R"U[S9nU(aqUR(a`URR(aE[[
URRR555upVUSU3USS'U(a[URU5US'U$)a>Convert the DirectUrl instance to a JSON dictionary.73 74:param generate_legacy_hash: If True, include a legacy `hash` field in75    `archive_info` for backward compatibility with tools that don't76    support the `hashes` field.77:param strip_user_password: If True, strip user:password from the URL78    unless it is formed with environment variables as specified in PEP79    610, or it is a safe user:password such as `git`.80:param safe_user_passwords: A collection of user:password strings that81    should not be stripped from the URL even if `strip_user_password` is82    True.83)�dict_factoryr�r�r�rY)84�dataclasses�asdictr2r�r��next�iter�itemsr[rY)rcr�r�rL�resr�r�s       r�to_dict�DirectUrl.to_dict%s���&� � ��4F�G���D�$5�$5�$�:K�:K�:R�:R�)-�d�4�3D�3D�3K�3K�3Q�3Q�3S�.T�)U�&�N�-;�,<�A�j�\�*J�C����'��#�D�H�H�.A�B�C��J��85rc�B�URUR55 g)zqValidate the DirectUrl instance against the specification.86 87Raises :class:`DirectUrlValidationError` if invalid.88N)r�r�ris r�validate�DirectUrl.validate@s��89	
���t�|�|�~�&rr)rYr_r�r�r�r�r�r�r�r^r%rlr#)r�r�r�r�rL�Collection[str]r%r$)r%rl)r&r'r(r)rmrnr�r�r�r�rer*r!r�r�r�r+rrrrr�s���,�	�H�'+�L�$�+�#�H�n�#�#�H�n�#�#�L�*�#�,0�#'�#'�#'�
?��
?�)�	
?�90!�
?�!�

?�!�
?�91�
?�����0�!��!�&+�$(�/7��#��"�	�92-��93�
�6'rr)r%z	list[str])r/zlist[tuple[str, Any]]r%zdict[str, Any])r r$r;�type[_T]r0r_r%z	_T | None)r r$r;r�r0r_r%r)r r$rBztype[_FromMappingProtocolT]r0r_r%z_FromMappingProtocolT | None)rKr_rLr�r%r_)rYr_rLr�r%r_)'�94__future__rr��re�urllib.parserQ�collections.abcr�typingrrrr�sysr	�version_infor�typing_extensionsrrrrr,r2r<r?rD�compilerIrOr[rArr>�	dataclassrr
rrrrr�<module>r�su��"��	��#�8�8���*�95���7�"��*����
�T�]��;�8�;�96 � 7�?S�T��D�97��	>��	>�'B�	>�IL�	>�!�	>�$&�:�:�5�$� �98��$�y��<@�!9�@�99
���d��/�100�101�0�102�4
���d��/�*"�*"�0�*"�Z
���d��/�103�104�0�105�"
���d��/�V'�V'�0�V'r
codekingpro/portable-devtools · Team Ai