File: //usr/local/lib/python3.9/site-packages/celery/utils/dispatch/__pycache__/signal.cpython-39.pyc
a
X>h#6 � @ s� d Z ddlZddlZddlZddlZddlmZ ddlmZ ddlm Z ddl
mZmZ ddl
mZ ddlmZ dd lmZ d
Zee�Zdd� Zd
d� Zdd� Zed�Ze� ZdZG dd� d�ZdS )z'Implementation of the Observer pattern.� N)�
WeakMethod)�retry_over_time)�CDeprecationWarning)�PromiseProxy�Proxy)�fun_accepts_kwargs)�
get_logger)�humanize_seconds)�Signalc C s@ t | t�r| �� } t | ttf�r$| S t| d�r8t| j�S t| �S )N�__func__)�
isinstancer �_get_current_object�bytes�str�hasattr�idr )�target� r �F/usr/local/lib/python3.9/site-packages/celery/utils/dispatch/signal.py�_make_id s
r c C s: z| j | j t| jfW S ty4 tj| f Y S 0 dS )a Get weakref constructor appropriate for `obj`. `obj` may be a bound method.
Bound method objects must be special-cased because they're usually garbage
collected immediately, even if the instance they're bound to persists.
Returns:
a (weakref constructor, main object) tuple. `weakref constructor` is
either :class:`weakref.ref` or :class:`weakref.WeakMethod`. `main
object` is the instance that `obj` is bound to if it is a bound method;
otherwise `main object` is simply `obj.
N)r �__self__r �AttributeError�weakref�ref)�objr r r �_boundmethod_safe_weakref s r c C s<