| Server IP : 217.160.0.135 / Your IP : 216.73.217.85 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib/python3/dist-packages/asgiref/__pycache__/ |
Upload File : |
�
"z�c�P �
�� � d dl Z d dlZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl Z d dl
mZmZ d dl
mZmZmZmZmZ ddlmZ ddlmZ d� Zded efd
�Zded efd�Zded efd�Z G d
� d� � Z G d� d� � Z G d� d� � ZeZe ddddeded d eedef gef fd�� � Z e ddedef deded d efd�� � Z dd�Z dS )� N)�Future�ThreadPoolExecutor)�Any�Callable�Dict�Optional�overload� )�CurrentThreadExecutor)�Localc �( � | D ]�} |� � � | � |� � k r(|� | � |� � � � �W# t $ r+ |� | � |� � � � Y ��w xY wd S �N)�get�set�LookupError)�context�cvars �./usr/lib/python3/dist-packages/asgiref/sync.py�_restore_contextr s� � � � (� (�� (��x�x�z�z�W�[�[��.�.�.�.�������T�*�*�+�+�+���� (� (� (��H�H�W�[�[��&�&�'�'�'�'�'� (���� (� (s �AA�2B�B�func�returnc � � t t d� � rt j | � � S t j j | _ | S �N�markcoroutinefunction)�hasattr�inspectr �asyncio�
coroutines�
_is_coroutine�r s r r r $ s9 � ��w�/�0�0� ��,�T�2�2�2�$�/�=����� c �| � t t d� � rt j | � � S t j | � � S r )r r �iscoroutinefunctionr r s r r# r# , s7 � ��w�/�0�0� 1��*�4�0�0�0��*�4�0�0�0r! c �2 � t j dk rt | � � S t j | � � r| j } t j | � � �t
| t j � � r!| j } t
| t j � � �!t | � � S )N)� � )
�sys�version_infor# r �ismethod�__func__�
isinstance� functools�partialr r s r �_iscoroutinefunction_or_partialr. 3 s� � � ��6�!�!�"�4�(�(�(���t�$�$� !��=�D� ��t�$�$� !���y�0�1�1� ��9�D� ��y�0�1�1� � #�4�(�(�(r! c �$ � e Zd ZdZd� Zd� Zd� ZdS )�ThreadSensitiveContextai Async context manager to manage context for thread sensitive mode
This context manager controls which thread pool executor is used when in
thread sensitive mode. By default, a single thread pool executor is shared
within a process.
In Python 3.7+, the ThreadSensitiveContext() context manager may be used to
specify a thread pool per context.
This context manager is re-entrant, so only the outer-most call to
ThreadSensitiveContext will set the context.
Usage:
>>> import time
>>> async with ThreadSensitiveContext():
... await sync_to_async(time.sleep, 1)()
c � � d | _ d S r )�token��selfs r �__init__zThreadSensitiveContext.__init__V s
� ���
�
�
r! c � � K � t j � � � n4# t $ r' t j � | � � | _ Y nw xY w| S r )�SyncToAsync�thread_sensitive_contextr r r r2 r3 s r �
__aenter__z!ThreadSensitiveContext.__aenter__Y sf � � � � H��0�4�4�6�6�6�6��� H� H� H�$�=�A�A�$�G�G�D�J�J�J� H���� �s �# �.A�Ac � �� K � | j sd S t j � | d � � }|r|� � � t j � | j � � d S r )r2 r7 �context_to_thread_executor�pop�shutdownr8 �reset)r4 �exc�value�tb�executors r � __aexit__z ThreadSensitiveContext.__aexit__a sf � � � ��z� ��F��9�=�=�d�D�I�I��� ��������,�2�2�4�:�>�>�>�>�>r! N)�__name__�
__module__�__qualname__�__doc__r5 r9 rC � r! r r0 r0 B sK � � � � � �� �&� � �� � �?� ?� ?� ?� ?r! r0 c �d � e Zd ZU dZi Zded<