o
    i                     @   sf   d dl Z d dlZd dlZdZdZdddZdd Z		ddd	Zd
d ZdddZ	dd Z
dd ZdS )    N)builtins
exceptionsTc                 C   sB   t sdS |du r
t}|du rtj| |d dS tj| ||d dS )a  Warns about some type of deprecation that has been (or will be) made.

    This helper function makes it easier to interact with the warnings module
    by standardizing the arguments that the warning function receives so that
    it is easier to use.

    This should be used to emit warnings to users (users can easily turn these
    warnings off/on, see https://docs.python.org/2/library/warnings.html
    as they see fit so that the messages do not fill up the users logs with
    warnings that they do not wish to see in production) about functions,
    methods, attributes or other code that is deprecated and will be removed
    in a future release (this is done using these warnings to avoid breaking
    existing users of those functions, methods, code; which a library should
    avoid doing by always giving at *least* N + 1 release for users to address
    the deprecation warnings).
    N)category)r   
stacklevel)_enabledDeprecationWarningwarningswarn)messager   r    r   W/home/ubuntu/.local/lib/python3.10/site-packages/ddtrace/vendor/debtcollector/_utils.pydeprecation   s   r   c                 C   s*   zd| j fW S  ty   d| jf Y S w )NTF)__qualname__AttributeError__name__)objr   r   r   get_qualified_name3   s
   r   c                 C   sh   | g}|r| d|  |r|dkr| d n| d|  |r&| | |r/| d|  d|S )zDHelper to generate a common message 'style' for deprecation helpers.z in version '%s'?z( and will be removed in a future versionz$ and will be removed in version '%s'z: %s )appendjoin)prefixpostfixr
   versionremoval_versionmessage_componentsr   r   r   generate_message;   s   

r   c                 C   s   t jS )z:Helper to fix/workaround https://bugs.python.org/issue3445)	functoolsWRAPPER_ASSIGNMENTS)	decoratorr   r   r   get_assignedO   s   r    c                 C   sb   t | ts	t| } z| jtv }W n	 ty   Y nw |r| jS |r.t| dr.d| j| jf S | jS )zGet class name for object.

    If object is a type, fully qualified name of the type is returned.
    Else, fully qualified name of the type of the object is returned.
    For builtin types, just name is returned.
    
__module__z%s.%s)
isinstancetyper!   _BUILTIN_MODULESr   r   hasattr)r   fully_qualifiedbuilt_inr   r   r   get_class_nameT   s   
r(   c                 C   s0   t | sdS zt| dW S  ty   Y dS w )z;Gets the ``self`` object attached to this method (or none).N__self__)inspectismethodgetattrr   )methodr   r   r   get_method_selfk   s   
r.   c                 C   s4  t | }|dur.t|tr|}nt|}z|j| jf}W nf ty-   |j|j| jf}Y nVw t| s8t	| raz| j| jf}W nB ty`   t
| drX| j}|j|j| jf}n| j| jf}Y n#w t| }|tu rk| }z|j|jf}W n ty   |j|jf}Y nw |d |dd }}|sd|S d|S )zeGenerate a name from callable.

    Tries to do the best to guess fully qualified callable name.
    Nim_classr      .)r.   r"   r#   r!   r   r   r   r*   r+   
isfunctionr%   r/   r   )functionmethod_selfr/   partsmodrestr   r   r   get_callable_nameu   sD   

	

r8   )NN)NNNN)T)r   r*   r   r$   r   r   r   r   r    r(   r.   r8   r   r   r   r   <module>   s   



