Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
futures.cpython-314.pyc132 linesDownload Raw Back to __pycache__
1+
2��i�A����RtRt^RIt^RIt^RIt^RIt^RIHt^RI	H3t4^RI	Ht^RI	Ht^RI	H
t
]5Pt]6Pt]7P t]8P"t]P$^,9t!RR4t]tR	tR10tRtRtR
tRtRR/RltRtRt]t]t ^RI!t!]!P(;tt"]!P:t]!P<t]t#]t$R# ]%dR#i;i)z.A Future class similar to the one in PEP 3148.�FutureN)�GenericAlias)�base_futures)�events)�11exceptions)�format_helpersc�a�]tRt^toRt]tRtRtRt	Rt12RtRtRt
RtRtRR/RltRtRt]!]4t]R4t]P0R	4t]R134tRtRtRR
ltRtRtRtRt Rt!RR/Rlt"Rt#Rt$Rt%Rt&]&t'Rt(Vt)R#)ra�This class is *almost* compatible with concurrent.futures.Future.14 15Differences:16 17- This class is not thread-safe.18 19- result() and exception() do not take a timeout argument and20  raise an exception when the future isn't done yet.21 22- Callbacks registered with add_done_callback() are always called23  via the event loop's call_soon().24 25- This class is not compatible with the wait() and as_completed()26  methods in the concurrent.futures package.27 28NF�loopc��Vf\P!4VnMWn.VnVPP	4'd2\29P!\P!^44Vn	R#R#)z�Initialize the future.30 31The optional event_loop argument allows explicitly setting the event32loop object used by the future. If it's not provided, the future uses33the default event loop.34N)35r�get_event_loop�_loop�36_callbacks�	get_debugr�
extract_stack�sys�	_getframe�_source_traceback��selfr	s&$�Lib\asyncio\futures.py�__init__�Future.__init__Ks\���<��.�.�0�D�J��J�����:�:���!�!�%3�%A�%A��
�
�a� �&"�D�"�"�c�.�\P!V4#�N)r�_future_repr�rs&r�__repr__�Future.__repr__[s���(�(��.�.rc���VP'gR#VPpRVPPR2RVRV/pVP'dVPVR&VP37P
V4R#)N�messagez exception was never retrieved�	exception�future�source_traceback)�_Future__log_traceback�38_exception�	__class__�__name__rr�call_exception_handler)r�exc�contexts&  r�__del__�Future.__del__^sw���#�#�#�
��o�o����>�>�*�*�+�+I�J����d�	39���!�!�!�*.�*@�*@�G�&�'��40�41�)�)�'�2rc��VP#r)r$rs&r�_log_traceback�Future._log_tracebackps���#�#�#rc�:�V'd\R4hRVnR#)z'_log_traceback can only be set to FalseFN)�42ValueErrorr$)r�vals&&rr.r/ts����F�G�G�$��rc�L�VPfR#\VP4#r)�_Future__asyncio_awaited_by�	frozensetrs&r�_asyncio_awaited_by�Future._asyncio_awaited_byzs"���$�$�,����2�2�3�3rc�<�VPpVf\R4hV#)z-Return the event loop the Future is bound to.z!Future object is not initialized.)r�RuntimeErrorrs& r�get_loop�Future.get_loop�s!���z�z���<��B�C�C��rc���VPeVPpRVnV#VPf\P!4pV#\P!VP4pV#)z�Create the CancelledError to raise if the Future is cancelled.43 44This should only be called once when handling a cancellation since45it erases the saved context exception value.46N)�_cancelled_exc�_cancel_messager�CancelledError)rr)s& r�_make_cancelled_error�Future._make_cancelled_error�sf�����*��%�%�C�"&�D���J����'��+�+�-�C��47��+�+�D�,@�,@�A�C��48rc��RVnVP\8wdR#\VnWnVP4R#)z�Cancel the future and schedule callbacks.49 50If the future is already done or cancelled, return False.  Otherwise,51change the future's state to cancelled, schedule the callbacks and52return True.53FT)r$�_state�_PENDING�54_CANCELLEDr>�_Future__schedule_callbacks)r�msgs&&r�cancel�
Future.cancel�s7�� %����;�;�(�"�� ���"���!�!�#�rc��VPR,pV'gR#.VPR&VF"wr#VPPW VR7K$	R#)z�Internal: Ask the event loop to call all callbacks.55 56The callbacks are scheduled to be called as soon as possible. Also57clears the callback list.58�NNNN�r*)r
r�	call_soon)r�	callbacks�callback�ctxs&   r�__schedule_callbacks�Future.__schedule_callbacks�sI���O�O�A�&�	���������&�M�H��J�J� � ��� �=�'rc�(�VP\8H#)z(Return True if the future was cancelled.)rCrErs&r�	cancelled�Future.cancelled�s���{�{�j�(�(rc�(�VP\8g#)z�Return True if the future is done.59 60Done means either that a result / exception are available, or that the61future was cancelled.62)rCrDrs&r�done�Future.done�s���{�{�h�&�&rc�.�VP\8XdVP4hVP\8wd\P63!R4hRVnVPe&VPPVP4hVP#)z�Return the result this future represents.64 65If the future has been cancelled, raises CancelledError.  If the66future's result isn't yet available, raises InvalidStateError.  If67the future is done and has an exception set, this exception is raised.68zResult is not ready.F)rCrEr@�	_FINISHEDr�InvalidStateErrorr$r%�with_traceback�
_exception_tb�_resultrs&r�result�
Future.result�st���;�;�*�$��,�,�.�.��;�;�)�#��.�.�/E�F�F�$����?�?�&��/�/�0�0��1C�1C�D�D��|�|�rc���VP\8XdVP4hVP\8wd\P69!R4hRVnVP#)z�Return the exception that was set on this future.70 71The exception (or None if no exception was set) is returned only if72the future is done.  If the future has been cancelled, raises73CancelledError.  If the future isn't done yet, raises74InvalidStateError.75zException is not set.F)rCrEr@rZrr[r$r%rs&rr!�Future.exception�sO���;�;�*�$��,�,�.�.��;�;�)�#��.�.�/F�G�G�$������rr*c���VP\8wd VPPWVR7R#Vf\P76!4pVPPW34R#)z�Add a callback to be run when the future becomes done.77 78The callback is called with a single argument - the future object. If79the future is already done when this is called, the callback is80scheduled with call_soon.81rLN)rCrDrrM�contextvars�copy_contextr
�append)r�fnr*s&&$r�add_done_callback�Future.add_done_callback�sN���;�;�(�"��J�J� � ��7� �;���%�2�2�4���O�O�"�"�B�=�1rc���VPUUu.uFwr#W!8wgK
W#3NK	ppp\VP4\V4,82pV'dW@PR&V#uuppi)zmRemove all instances of a callback from the "call when done" list.83 84Returns the number of callbacks removed.85rK)r
�len)rrg�frP�filtered_callbacks�
removed_counts&&    r�remove_done_callback�Future.remove_done_callback�sh��/3�o�o�*�.=�(�1�!"��'�q�h�.=�	�*��D�O�O�,�s�3E�/F�F�
��!3�O�O�A�����
*s86�87A&�A&c��VP\8wd'\P!VPRV:24hWn\88VnVP
4R#)z~Mark the future done and set its result.89 90If the future is already done when this method is called, raises91InvalidStateError.92�: N)rCrDrr[r^rZrF)rr_s&&r�93set_result�Future.set_resultsH���;�;�(�"��.�.�$�+�+��b���/I�J�J�������!�!�#rc��VP\8wd'\P!VPRV:24h\	V\944'dV!4p\	V\4'd\R4pWnWn	TpWn95VPVn\VnVP4RVnR#)z�Mark the future done and set an exception.96 97If the future is already done when this method is called, raises98InvalidStateError.99rrzPStopIteration interacts badly with generators and cannot be raised into a FutureTN)rCrDrr[�100isinstance�type�
StopIterationr9�	__cause__�__context__r%�
__traceback__r]rZrFr$)rr!�new_excs&& r�
set_exception�Future.set_exception
s����;�;�(�"��.�.�$�+�+��b���/I�J�J��i��&�&�!��I��i��/�/�"�$,�-�G�!*��"+���I�#��&�4�4�������!�!�#�#��rc#�"�VP4'gRVnVx�VP4'g\R4hVP4#5i)Tzawait wasn't used with future)rW�_asyncio_future_blockingr9r_rs&r�	__await__�Future.__await__$s@����y�y�{�{�,0�D�)��J��y�y�{�{��>�?�?��{�{�}��s101�7A�A)�__log_tracebackr�r
r>r=r%r]rr^rrCr)*r'�102__module__�__qualname__�__firstlineno__�__doc__rDrCr^r%rrr>r=r�r4r$rrr+�classmethodr�__class_getitem__�propertyr.�setterr6r:r@rHrFrTrWr_r!rhrorsr}r��__iter__�__static_attributes__�__classdictcell__)�
__classdict__s@rrrs������$�F��G��J��E����O��N� %�� ���O�"�t�"� /�3� $�L�1��
�$��$����%��%�103�4��4�104��"
�>�)�'�� 
�2�t�2� �105$�$�.��Hrc�b�VPpV!4# \dTP#i;ir)r:�AttributeErrorr)�futr:s& r�	_get_loopr�3s:����<�<���z����
���9�9��	
�s��.�.c�X�VP4'dR#VPV4R#)z?Helper setting the result only if the future was not cancelled.N)rTrs)r�r_s&&r�_set_result_unless_cancelledr�?s��106�}�}�����N�N�6�rc�p�\V4pV\PPJd8\P!VP107!P
VP4#V\PPJd8\P!VP108!P
VP4#V#r)	rw�109concurrent�futuresr?r�argsr\r{r[)r)�	exc_classs& r�_convert_future_excr�Fs����S�	�I��J�&�&�5�5�5��(�(�#�(�(�3�B�B�3�CT�CT�U�U�	�j�(�(�:�:�	:��+�+�S�X�X�6�E�E�c�FW�FW�X�X��110rc�\�VP4'gQhVP4'dVP!4VP!4'gR#VP	4pVeVP111!\
V44R#VP4pVP!V4R#)z8Copy state from a future to a concurrent.futures.Future.N)	rWrTrH�set_running_or_notify_cancelr!r}r�r_rs)r��sourcer!r_s&&  r�_set_concurrent_future_stater�Ps����;�;�=�=��=�
����������2�2�4�4��� � �"�I���� � �!4�Y�!?�@���������f�%rc��VP4'gQhVP4'dR#VP4'dQhVP4'dVP4R#VP4pVeVP	\V44R#VP
4pVPV4R#)ziInternal helper to copy state from another Future.112 113The other Future may be a concurrent.futures.Future.114N)rWrTrHr!r}r�r_rs)r��destr!r_s&&  r�_copy_future_stater�_s���115�;�;�=�=��=��~�~�����y�y�{�{��?�
��������
��$�$�&�	�� ����2�9�=�>��]�]�_�F��O�O�F�#rc�aaaaa�\S4'g6\S\PP4'g\R4h\S4'g6\S\PP4'g\R4h\S4'd\
S4MRo\S4'd\
S4MRoRoVV3RlpVVV3RlpSPV4SPV4R#)aChain two futures so that when one completes, so does the other.116 117The result (or exception) of source will be copied to destination.118If destination is cancelled, source gets cancelled too.119Compatible with both asyncio.Future and concurrent.futures.Future.120z(A future is required for source argumentz-A future is required for destination argumentNc�X�\V4'd\W4R#\W4R#r)�isfuturer�r�)r"�others&&r�121_set_state�!_chain_future.<locals>._set_state�s���F����u�-�(��7rc��<�VP4'dMSeS\P!4JdSP4R#SP	SP4R#R#r)rTr�_get_running_looprH�call_soon_threadsafe)�destinationr��source_loops&��r�_call_check_cancel�)_chain_future.<locals>._call_check_cancel�sH���� � �"�"��"�k�V�5M�5M�5O�&O��
�
���0�0����?�	#rc�<�SP4'dSeSP4'dR#SeS\P!4JdS!SV4R#SP4'dR#SP	SSV4R#r)rT�	is_closedrr�r�)r�r��	dest_loopr�s&���r�_call_set_state�&_chain_future.<locals>._call_set_state�sm����!�!�#�#��%�)�*=�*=�*?�*?����	�V�-E�-E�-G� G��{�F�+��"�"�$�$���*�*�:�{�F�Kr)r�rvr�r�r�	TypeErrorr�rh)r�r�r�r�r�r�r�sff  @@@r�
_chain_futurer�ss�����F���J�v�/9�/A�/A�/H�/H�%J�%J��B�C�C��K� � ��K�4>�4F�4F�4M�4M�*O�*O��G�H�H�'/��'7�'7�)�F�#�T�K�*2�;�*?�*?�	�+�&�T�I�8�@�	L��!�!�"4�5�122���_�-rr	c���\V4'dV#\V\PP4'gQRV:24hVf\123P!4pVP4p\W4V#)z&Wrap concurrent.futures.Future object.z+concurrent.futures.Future is expected, got )	r�rvr�r�rrr�
create_futurer�)r"r	�124new_futures&$ r�wrap_futurer��ss�������
��f�j�0�0�7�7�8�8�A�1255�f�Z�@�A�8��|��$�$�&���#�#�%�J��&�%��rc���\V\4'dS\V\4'd;VPf\4VnVPP	V4R#R#R#)z,Record that `fut` is awaited on by `waiter`.N)rv�	_PyFuturer4�set�add�r��waiters""r�future_add_to_awaited_byr��sP��,�#�y�!�!�j���&C�&C��*�*�2�.1�e�C�+��'�'�+�+�F�3�'D�!rc��\V\4'dF\V\4'd.VPeVPPV4R#R#R#R#)z6Record that `fut` is no longer awaited on by `waiter`.N)rvr�r4�discardr�s""r�future_discard_from_awaited_byr��sK���#�y�!�!�j���&C�&C��*�*�6��+�+�3�3�F�;�7�'D�!r)rr�r�r�r�)&r��__all__�concurrent.futuresr�rd�loggingr�typesr�rrrrr�rDrErZ�DEBUG�STACK_DEBUGrr�r�r�r�r�r�r�r�r�r��_py_future_add_to_awaited_by�"_py_future_discard_from_awaited_by�_asyncio�_CFuture�_c_future_add_to_awaited_by�!_c_future_discard_from_awaited_by�ImportError�rr�<module>r�s��4���126���127������� � ��� � ��
�
$�
$�128��"�"�	��m�m�a���M�M�b
�	�	���&�$�().�X129��130�4�8	<� 8��%C�"�131G��132!���'�F�X�'�@�@��%-�%L�%L�"�":��(F�%���	��	�s�&C�C!� C!
codekingpro/portable-devtools · Team Ai