Team Ai
Datasetpublic

codekingpro/portable-devtools

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

2�jI��f�%SSKJr SSKrSSKJr SSKrSSKrSSKrSSK	r	SSK3rSSKJ
r
 SSKJr \	R R#S5r\	R R#S5rSrS\S'\R,"S	5rS;S<S4jjrS=SjrS>Sjr"S
S\R65r"SS5rS?S@SjjrS?S@SjjrSASjr SASjr!SBSjr"SCSjr#SDSjr$S;SESjjr%S?SFSjjr&S?SGSjjr'SHSjr(SHSjr)SHSjr*SISJSjjr+SISJSjjr,SISJS jjr-SKS!jr.SLSMS"jjr/"S#S$5r0SNS%jr1SOS&jr2SISPS'jjr3\	R R#S5(a&\(aS(S)K4J5r5 SQS*jr6\"5r7S+\S,'SRSSS-jjrOSQS.jr6STS/jr5SUS0jr8SOS1jr9SVS2jr:\:"S3\+5r;\:"S4\,5r<\:"S5\-5r=\(\)\*S6.r>S7\S8'\+\,\-S6.r?S9\S:'g)W�)�annotationsN)�
TracebackType��WeakKeyDictionary�cygwin�winz't.Callable[[t.TextIO], t.TextIO] | None�auto_wrap_for_ansiz\033\[[;?0-9]*[a-zA-Z]c	�D�Uc[U5nUcSn[UUUSUUS9$)N�replaceT)�line_buffering�force_readable�force_writable)�get_best_encoding�_NonClosingTextIOWrapper)�stream�encoding�errorsr
rs     �SD:\code\apps\devtools\python\user_packages\Python313\site-packages\click/_compat.py�_make_text_streamrs=����$�V�,��
�~���#�����%�%�
��c�j�[R"U5RS:H$![a gf=f)z$Checks if a given encoding is ascii.�asciiF)�codecs�lookup�name�LookupError)rs r�is_ascii_encodingr(s3����}�}�X�&�+�+�w�6�6������s�"%�52�2c�z�[USS5=(d [R"5n[U5(agU$)z1Returns the default stream encoding if not found.rNzutf-8)�getattr�sys�getdefaultencodingr)r�rvs  rrr0s1��	���T�	*�	F�c�.D�.D�.F�B������
�Irc�b^�\rSrSrSSU4SjjjrSSjrS	SjrSrU=r$)6r�8c�>�[R"[R[XU55=Uln[7TU]"XU40UD6 g�N)�t�cast�BinaryIO�_FixupStream�_stream�super�__init__)�selfrrrr
r�extra�	__class__s       �rr-�!_NonClosingTextIOWrapper.__init__9sB���!"���
�J�J��V�^�L�!8�	9���v�	����6�;�U�;rc�F�UR5 g![a gf=fr&)�detach�	Exception�r.s r�__del__� _NonClosingTextIOWrapper.__del__Gs"��	��K�K�M���	��	�s��10 � c�6�URR5$r&)r+�isattyr5s rr9�_NonClosingTextIOWrapper.isattyMs���|�|�"�"�$�$r)r+�FF)r�11t.BinaryIOr�12str | Nonerr=r
�boolrr>r/�t.Any�return�None)r@rA�r@r>)	�__name__�13__module__�__qualname__�__firstlineno__r-r6r9�__static_attributes__�
__classcell__)r0s@rrr8sh��� %�$�
<��<��<��	<�14�<��
<��<�15�<�<��%�%rrc�f�\rSrSrSrSSSjjrS
SjrSSjrSSjrSSjr	SSjr16S	rg17)r*�Ra9The new io interface needs more from streams than streams18traditionally implement.  As such, this fix-up code is necessary in19some circumstances.20 21The forcing of readable and writable flags are there because some tools22put badly patched objects on sys (one such offender are certain version23of jupyter notebook).24c�(�XlX lX0lgr&)r+�_force_readable�_force_writable)r.rr
rs    rr-�_FixupStream.__init__\s����-��-�rc�.�[URU5$r&)rr+�r.rs  r�__getattr__�_FixupStream.__getattr__fs���t�|�|�T�*�*rc��[URSS5nUb![R"[U"U55$URRU5$)N�read1)rr+r'r(�bytes�read)r.�size�fs   rrT�_FixupStream.read1isC���D�L�L�'�4�0���=��6�6�%��4��)�)��|�|� � ��&�&rc���UR(ag[URSS5nUb [R"[25U"55$URR
S5 g![a gf=f)NT�readablerF)rLrr+r'r(r>rVr4�r.�xs  rr[�_FixupStream.readableqsh�������D�L�L�*�d�3���=��6�6�$���$�$�	��L�L���a� ����	��	�s�A*�*26A7�6A7c�N�UR(ag[URSS5nUb [R"[27U"55$URR
S5 g![a0 URR
S5 g![a gf=ff=f)NT�writablerF)rMrr+r'r(r>�writer4r\s  rr`�_FixupStream.writable}s��������D�L�L�*�d�3���=��6�6�$���$�$�	��L�L���s�#����	�
����"�"�3�'����
��
��	�s*�A*�*28B$�5B�29B �B$�B � B$c��[URSS5nUb [R"[U"55$URRURR
55 g![a gf=f)N�seekableFT)rr+r'r(r>�seek�tellr4r\s  rrd�_FixupStream.seekable�si���D�L�L�*�d�3���=��6�6�$���$�$�	��L�L���d�l�l�/�/�1�2����	��	�s�3A0�030A=�<A=)rLrMr+Nr;)rr<r
r>rr>�r�strr@r?)rW�intr@rUrB)rCrDrErF�__doc__r-rQrTr[r`rdrG�rrr*r*RsI��� %�$�	.��.��.��	.�+�'�31�
�rr*c�f�[URS5[5$![a Us$f=f�Nr)�32isinstancerVrUr4�r�defaults  r�_is_binary_readerrr�s0����&�+�+�a�.�%�0�0�������s�!�0�0c��URS5 g![a) URS5 g![a Of=fUs$f=f)Nr�FT)rar4rps  r�_is_binary_writerru�sT������S������	��L�L������	��	����
�s%��33A�2�34?�A�?�A�Ac���[US5(a%[R"[RU5$[	USS5nUb6[US5(a%[R"[RU5$g�NF�bufferT)rrr'r(r)r�r�bufs  r�_find_binary_readerr{��`��35���'�'��v�v�a�j�j�&�)�)�36�&�(�D�37)�C���,�S�$�7�7��v�v�a�j�j�#�&�&�rc���[US5(a%[R"[RU5$[	USS5nUb6[US5(a%[R"[RU5$grw)rur'r(r)rrys  r�_find_binary_writerr~�r|rc�@�[[USS5=(d S5$)z3A stream is misconfigured if its encoding is ASCII.rNr)rr�rs r�_stream_is_misconfiguredr��s���W�V�Z��>�I�'�J�Jrc�N�[XS5nX2:H=(d USL=(a USL$)z�A stream attribute is compatible if it is equal to the38desired value or the desired value is unset and the attribute39has a value.40N)r)r�attr�value�stream_values    r�_is_compat_stream_attrr��s,��41�6��.�L�� �P�U�d�]�%O�|�4�7O�Prc�D�[USU5=(a
 [USU5$)z[Check if a stream's encoding and errors attributes are42compatible with the desired values.43rr)r�)rrrs   r�_is_compatible_text_streamr��s)��"��44�H��;�45 ���6�46:�;rc�B�U"US5(a&[R"[RU5nOZ[R"[RU5n[	XU5(aUc[U5(dU$U"U5nUcU$UnUcSn[
UUUUUS9$)NFr)r
r)r'r(r)�TextIOr�r�r)	�text_streamrr�	is_binary�find_binaryr
r�
binary_reader�possible_binary_readers	         r�_force_correct_text_streamr��s�����e�$�$����q�z�z�;�7�
��f�f�Q�X�X�{�3��&�k�V�D�D���!9�+�!F�!F���"-�[�!9��"�)���.�
��~�������%�%��rc	�.�[UUU[[US9$)N�r
)r�rrr{)�text_readerrrr
s    r�_force_correct_text_readerr��#��&������%�
�rc	�.�[UUU[[US9$)N�r)r�rur~)�text_writerrrrs    r�_force_correct_text_writerr�,r�rc�T�[[R5nUc[S5eU$)Nz6Was not able to determine binary stream for sys.stdin.)r{r �stdin�RuntimeError)�readers r�get_binary_stdinr�<s&��
 ����
+�F�
�~��S�T�T��Mrc�T�[[R5nUc[S5eU$)Nz7Was not able to determine binary stream for sys.stdout.)r~r �stdoutr���writers r�get_binary_stdoutr�C�&��
 ����
,�F�
�~��T�U�U��Mrc�T�[[R5nUc[S5eU$)Nz7Was not able to determine binary stream for sys.stderr.)r~r �stderrr�r�s r�get_binary_stderrr�Jr�rc�r�[[RX5nUbU$[[RXSS9$)NTr�)�_get_windows_console_streamr r�r��rrr"s   r�get_text_stdinr�Qs0��	$�S�Y�Y��	A�B�	�~��	�%�c�i�i��RV�W�Wrc�r�[[RX5nUbU$[[RXSS9$�NTr�)r�r r�r�r�s   r�get_text_stdoutr�X�0��	$�S�Z�Z��	B�B�	�~��	�%�c�j�j�(�SW�X�Xrc�r�[[RX5nUbU$[[RXSS9$r�)r�r r�r�r�s   r�get_text_stderrr�_r�rc�8�SU;a[X5$[XX#S9$)z?Handles not passing ``encoding`` and ``errors`` in binary mode.�b�rr)�open)�file�moderrs    r�
_wrap_io_openr�fs#���d�{��D�����X�=�=rc�2^�ST;n[R"U5n[R"U5S:XaV[U4SjS55(aU(a[	5S4$[X#S9S4$U(a[
5S4$[X#S9S4$U(d[UTX#5S4$ST;a[S	5eS47T;a[S5eST;a[S
5eSSK48nSSKn[R"U5Rn[R[R -[R"-n	U(aU	[%[SS5-n	[R&R)[R&R+U5SUR-S5S35n49[R."X�UcSOU5nUb[R>"X�5 [UTX#5n
[AX�[R&RCU55n[DRF"[DRH[DRJU5S4$![a SnGNRf=f![a�nURUR0:Xd�[R2S:Xa�URUR4:Xai[R&R7UR85(a;[R:"UR8[R<5(aSnAGM�eSnAff=f)Nr��-c3�,># �UH	oT;v� M g7fr&rl)�.0�mr�s  �r�	<genexpr>�open_stream.<locals>.<genexpr>�s����2�/�Q�D�y�/�s�)�w�ar]Fr�Tr�z�Appending to an existing file is not supported, because that would involve an expensive `copy`-operation to a temporary file. Open the file in normal `w`-mode and copy explicitly if that's what you're after.r]z&Use the `overwrite`-parameter instead.r�z,Atomic writes only make sense with `w`-mode.r�O_BINARYz.__atomic-writel�08xi��nt)&�os�fspath�fsdecode�anyr�r�r�r�r��50ValueError�errno�random�stat�st_mode�OSError�O_RDWR�O_CREAT�O_EXCLr�path�join�dirname�	randranger��EEXISTr�EACCES�isdir�filename�access�W_OK�chmod�_AtomicFile�realpathr'r(�IO�Any)r�r�rr�atomic�binaryr�r��perm�flags�tmp_filename�fd�erX�afs `             r�open_streamr�sst����D�[�F��y�y��"�H�51�{�{�8���#��2�/�2�2�2��(�*�E�1�1�"�H�D�e�K�K��#�%�u�,�,��x�?��F�F���X�t�X�>��D�D��d�{��
,�52�	53��d�{��A�B�B�54�$���G�H�H�����7�7�8�,�4�4��
�I�I��55�56�"�R�Y�Y�.�E�
�
���Z��+�+��57��w�w�|�|��G�G�O�O�H�%��f�.�.�w�7��<�=�58��	�����t�|�e��N�B����59����$��b�$��1�A�	�Q�b�g�g�&6�&6�x�&@�	A�B��6�6�!�$�$�q�u�u�+�r�"�D�(�(��?������ �	��w�w�%�,�,�&����4���G�G�u�|�|�+��G�G�M�M�!�*�*�-�-��I�I�a�j�j�"�'�'�2�2����	�s1� I�I�I�I�60L�B*L�L�Lc�x�\rSrSrSSjr\SSj5rS
SSjjrSSjrSSjr	SSjr61SSjrS	rg62)r�i�c�6�XlX lX0lSUlg�NF)�_f�
_tmp_filename�_real_filename�closed)r.rXr��
real_filenames    rr-�_AtomicFile.__init__�s����)��+����rc��UR$r&)r�r5s rr�_AtomicFile.name�s���"�"�"rc���UR(agURR5 [R"UR63UR5 SUlg)NT)r�r��closer�rr�r�)r.�deletes  rr��_AtomicFile.close�s:���;�;�����
�
��64�65�66�4�%�%�t�':�':�;���rc�.�[URU5$r&)rr�rPs  rrQ�_AtomicFile.__getattr__�s���t�w�w��%�%rc��U$r&rlr5s r�	__enter__�_AtomicFile.__enter__�s���rc�&�URUSLS9 g)N)r�)r�)r.�exc_type�	exc_value�tbs    r�__exit__�_AtomicFile.__exit__�s��	
�67�68�(�$�.�69�/rc�,�[UR5$r&)�reprr�r5s r�__repr__�_AtomicFile.__repr__�s���D�G�G�}�r)r�r�r�r�N)rX�t.IO[t.Any]r�rir�rir@rA�r@ri�F)r�r>r@rArh)r@r�)r�ztype[BaseException] | NonerzBaseException | NonerzTracebackType | Noner@rA)
rCrDrErFr-�propertyrr�rQr�rrrGrlrrr�r��sZ����#��#��&��0�,�0�(�0�
!�	0�7071�0�rr�c�.�[RSU5$)Nrt)�_ansi_re�sub)r�s r�72strip_ansir�s���<�<��E�"�"rc���[U[[45(a)URn[U[[45(aM)URR73R
S5$)Nz74ipykernel.)ror*rr+r0rD�75startswithr�s r�_is_jupyter_kernel_outputr�sR��76�V�l�,D�E�77F�78F������V�l�,D�E�79F�80F����&�&�1�1�,�?�?rc��Uc:Uc[Rn[U5(+=(a [U5(+$U(+$r&)r r�r9r)r�colors  r�should_strip_ansir�s:��
�}��>��Y�Y�F��&�>�!�K�*C�F�*K�&K�K��9�r�)r�c�*�SSKnUR5$rn)�locale�getpreferredencoding)rs r�_get_argv_encodingrs����*�*�,�,rz'cabc.MutableMapping[t.TextIO, t.TextIO]�_ansi_stream_wrappersc�j^^�[RU5nUbU$SSKn[	X5nURXS9m[R"[RTR5nURmSUU4SjjnXel81U[U'U$![a SnN�f=f![a U$f=f)zRSupport ANSI color and style codes on Windows by wrapping a82stream with colorama.83Nr)�stripc�T>�T"U5$![a TR5 ef=fr&)�
BaseException�	reset_all)�s�_write�ansi_wrappers ��r�_safe_write�'auto_wrap_for_ansi.<locals>._safe_writes0���
��a�y� �� �
��&�&�(��
�s��')r!rir@rj)r�getr4�coloramar�AnsiToWin32r'r(r�rra)	rr�cachedr'rr"r$r"r#s	       @@rr	r	84s����	�*�.�.�v�6�F����M��!�&�0���+�+�F�+�@��
�V�V�A�H�H�l�1�1�
2������	�	���	�,.�!�&�)��	��7�	��F�	��0�	���	�	�s#�B�	B$�B!� B!�$85B2�1B2c�p�[[RSS5=(d [R"5$)Nr)rr r��getfilesystemencodingrlrrrr/s#���s�y�y�*�d�3�R�s�7P�7P�7R�Rrc��gr&rl)rXrrs   rr�r�2s��rc�*�[[U55$r&)�lenr)r]s r�term_lenr/8s���z�!�}��rc�D�UR5$![a gf=fr�)r9r4r�s rr9r9<s%����}�}��������s��86�c�4^^^�[5mSUUU4SjjnU$)Nc�>�T"5nUcgTRU5nUbU$T"5nUTU'U$![a SnN"f=f![a U$f=fr&)r&r4)rr"�cache�src_func�wrapper_funcs  ���r�func�&_make_cached_stream_func.<locals>.funcIs{�������>��	����6�"�B��>��I�
�^��	��E�&�M��	���	��B�	���	���	�	�s �3�A�A�A�87A�A)r@�t.TextIO | Noner)r4r5r6r3s`` @r�_make_cached_stream_funcr9Cs���6G�5H�E���&�Krc�"�[R$r&)r r�rlrr�<lambda>r;_s��s�y�yrc�"�[R$r&)r r�rlrrr;r;`����88�89rc�"�[R$r&)r r�rlrrr;r;ar=r)r�r�r�z-cabc.Mapping[str, t.Callable[[], t.BinaryIO]]�binary_streamszAcabc.Mapping[str, t.Callable[[str | None, str | None], t.TextIO]]�text_streamsr;)rr<rr=rr=r
r>rr>r@�t.TextIO)rrir@r>)rrr@rir90)rrrqr>r@r>)rrr@zt.BinaryIO | None)rrAr@r>)rrAr�rir�r=r@r>)rrArr=rr=r@r>)r�rrr=rr=r�z%t.Callable[[t.IO[t.Any], bool], bool]r�z,t.Callable[[t.IO[t.Any]], t.BinaryIO | None]r
r>rr>r@rA)91r�rrr=rr=r
r>r@rA)92r�rrr=rr=rr>r@rA)r@r<)NN)rr=rr=r@rA)93r�zstr | os.PathLike[str] | intr�rirr=rr=r@r)�rN�strictF)r�zstr | os.PathLike[str]r�rirr=rr=r�r>r@ztuple[t.IO[t.Any], bool])r�rir@ri)rrr@r>)rzt.IO[t.Any] | Noner�bool | Noner@r>r	r&)rrArrDr@rA)rXrArr=rr=r@r8)r]rir@rj)r4�t.Callable[[], t.TextIO | None]r5zt.Callable[[], t.TextIO]r@rE)@�94__future__rr�collections.abc�abc�cabc�ior��rer �typingr'�typesr�weakrefr�platformr�CYGWIN�WINr	�__annotations__�compiler
rrr�
TextIOWrapperrr*rrrur{r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr�_winconsoler�rrr/r9r9�_default_text_stdin�_default_text_stdout�_default_text_stderrr?r@rlrr�<module>rYs���"�
��	�	�	�95���%�	���	 �	 ��	*��	�l�l���e�$��>B��;�B�
�:�:�/�0��!� ������
���	�96���
�*��%�r�/�/�%�4B�B�J�97��$�$K�Q�;��;� *�;�4>�;�	�;�"!� �+��+��+�
�+�5�	+�98>�+��
+��+��+�d!�	
��
��
�
�
��	
�99�
�(!�	
��
��
�
�
��	
�100�
� ���X�Y�Y�101>�102&�103>�104
�105>��106>�
�	107>�108�109>���!��N)�$�N)�110
�N)��N)�
�	N)�111
�N)��
N)�b!�!�H#�@�=A����.9��	���<�<���5�!�!�c�8�-�112FW�EX��B�X�!�JS����)��3=��	�����-��*��%��8/�/@�.�Q��/�0B�O�T��/�0B�O�T�����A��=�����S��O�r
codekingpro/portable-devtools · Team Ai