Dashboard
PHP:
8.2.30
OS:
Linux
User:
dh_nv8b2m
/
/
usr
/
lib
/
python3
/
dist-packages
/
asgiref
/
__pycache__
📤 Upload
📝 New File
📁 New Folder
Close
Editing: sync.cpython-310.pyc
o �6�ahK � @ sT d dl Zd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl Z d dl mZmZ d dl mZmZmZmZmZ ddlmZ ddlmZ dd� Zd ed efdd�ZG d d� d�ZG dd� d�ZG dd� d�ZeZe dd ddeded d eedef gef fdd��Ze dd edef deded d efdd��Z ddd�ZdS )� N)�Future�ThreadPoolExecutor)�Any�Callable�Dict�Optional�overload� )�CurrentThreadExecutor)�Localc C sV | D ]&}z|� � | � |�kr|�| � |�� W q ty( |�| � |�� Y qw d S �N)�get�set�LookupError)�context�cvar� r �./usr/lib/python3/dist-packages/asgiref/sync.py�_restore_context s ���r �func�returnc C sV t jdkr t�| �S t�| �r| j} t�| �st| tj �r&| j } t| tj �st�| �S )N)� � )�sys�version_info�asyncio�iscoroutinefunction�inspect�ismethod�__func__� isinstance� functools�partialr )r r r r �_iscoroutinefunction_or_partial s �� r# c @ s( e Zd ZdZdd� Zdd� Zdd� 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 C s d | _ d S r )�token��selfr r r �__init__? s zThreadSensitiveContext.__init__c � s6 �zt j�� W | S ty t j�| �| _Y | S w r )�SyncToAsync�thread_sensitive_contextr r r r% r&