
    uYf                         d dl mZ d dl mZ d dlZd dlmZ d dlmZ dedeeeef      fdZ	dedee   fd	Z
deddfd
Zd Zd Zy)    )List)TupleN)DDTraceDeprecationWarning)	deprecateraw_dd_trace_methodsreturnc           	         | sg S g }| j                  d      D ]  }d|vrt        d|z        |j                  d      \  }}|dk(  rt        d|z        |j                  d      D ]Z  }t        j                  |j                  d      d         st        d	|d
|dk(  rd      d      |j	                  ||f       \  |S )a  Return a list of the module,methodname tuples to trace based on the
    specification of DD_TRACE_METHODS.

    DD_TRACE_METHODS is specified to be FullyQualifiedModuleName:comma-separated-methods;...

    Note that support for wildcard methods with * is not implemented.
    ;:zkInvalid DD_TRACE_METHODS: %s. Methods must be specified after a colon following the fully qualified module.__main__zInvalid DD_TRACE_METHODS: %s. Methods cannot be traced on the __main__ module. __main__ when sitecustomize module is run is the builtin __main__.,.Invalid method name: .   You might have a trailing comma..Method names must be valid Python identifiers.split
ValueErrorstrisidentifierappend)r   dd_trace_methodsqualified_methodsqualified_method_prefixmethodsmethods         ]/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/ddtrace/internal/tracemethods.py_parse_trace_methodsr!   
   s.     	177< #G''d $	$  ,=+B+B3+G("j0 GIZ[  mmC( 	GF##FLL$5b$9:  !R< ; N  NN  ##%<f$EF	G1#GH     c           	         | sg S g }| j                  d      D ]  }d|vsd|vrt        d|z        |j                  d      d   }|dk(  rt        d|z        |j                  d      d	   }|j                  d      d
   }|dd	 }|j                  d      D ]K  }t        j                  |      st        d|d|dk(  rd      d      |j	                  |d|       M  |S )aX  
    Return a list of method names to trace based on the specification of
    DD_TRACE_METHODS.

    Note that support for wildcard methods with [*] is not implemented.

    This square bracket notation will be deprecated in favor of the new ':' notation
    TODO: This method can be deleted once the legacy syntax is officially deprecated
    r
   []z~Invalid DD_TRACE_METHODS: %s. Methods must be specified in square brackets following the fully qualified module or class name.r   r   zNInvalid DD_TRACE_METHODS: %s. Methods cannot be traced on the __main__ module.r   r      Nr   r   r   r   r   r   r   )r   r   r   r   class_or_module_with_methodsr   r   s          r    _parse_legacy_trace_methodsr(   <   s\     	177< (Q''36G+Gw $	$  #4"9"9#">q"A"j0 `ctt 
 (9'>'>s'CB'G$ /44S9!<#2, mmC( 	QF##F+  !R< ; N  NN  ##/F$OP	Q;(QR r"   c                    d| v rt        dddt               t        |       D ]f  }dj                  |j	                  d      dd       }|j	                  d      d   }d}|r	 t        |      }	 |t        d	|z        t        ||       h yt        |       D ]  \  }}t        ||        y# t        $ r? |j	                  d      d   d|}dj                  |j	                  d      dd       }Y nw xY w|r)
z%Install tracing on the given methods.r$   z;Using DD_TRACE_METHODS with the '[]' notation is deprecatedz=Please use DD_TRACE_METHODS with the new ':' notation insteadz3.0.0)messageremoval_versioncategoryr   Nr   zCould not import module for %r)	r   r   r(   joinr   
__import__ImportErrortrace_methodr!   )r   qualified_methodbase_module_guessmethod_namemodulemodule_names         r    _install_trace_methodsr6   u   s*   
""IS#.		
 !<<P Q 	9 !$)9)?)?)DSb)I J*005b9KF#'(9:F ~!"BEU"UVV*K8)	9. )==Q(R 	3$Kk2	3 # T->-D-DS-I"-M{"[K(+1B1H1H1Mcr1R(S%T $s   "B--AC54C5c                 T    t         j                  j                  |       fd       }y )Nc                 <    t        j                  | t               y )N)wraptwrap_function_wrappertrace_wrapper)mr3   s    r    _ztrace_method.<locals>._   s    ##A{MBr"   )r9   importerwhen_imported)r4   r3   r=   s    ` r    r0   r0      s(     ^^!!&)C *Cr"   c                 (   ddl m} | j                  }t        |d      r2|j                  t        d       ur|j                  j                  d|}|j                  d|      5 }|j                  dd        | |i |cd d d        S # 1 sw Y   y xY w)	Nr   )tracer	__class__r   ztrace.annotation)resource	componenttrace)ddtracerA   __name__hasattrrB   typerE   set_tag_str)wrappedinstanceargskwargsrA   rC   spans          r    r;   r;      s    Hx%(*<*<DJ*N&00998D	(8	< (g.''( ( (s   $BB)typingr   r   r9   #ddtrace.internal.utils.deprecationsr   ddtrace.vendor.debtcollectorr   r   r!   r(   r6   r0   r;    r"   r    <module>rT      sl       I 2/s /tE#s(O7L /d6c 6d3i 6r"3 "3 "3JC	(r"   