
    ؄_2                         d Z ddlZddlZddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 d	d
lm
Z
 ddZddZddZddZddZd Z	 ddZd Zd Z	 ddZddZdS )zSHelpers related to deprecation of functions, methods, classes, other
functionality.    N   )compat)_hash_limit_string)	decorator)inject_docstring_text)inject_param_text   )exc   c                 H    t          j        | t          j        |           d S N
stacklevelwarningswarnr
   SADeprecationWarningmsgr   s     a/var/www/book.euthymeo.com/html/venv/lib/python3.11/site-packages/sqlalchemy/util/deprecations.pywarn_deprecatedr      s"    M#s/JGGGGGG    c                 l    |rt          | d|          } t          j        | t          j        |           dS )zhIssue a deprecation warning with a parameterized string,
    limiting the number of registrations.

    
   N)r   r   r   r
   r   )r   argsr   s      r   warn_deprecated_limitedr      s:    
  0 b$//M#s/<<<<<r   c                 H    t          j        | t          j        |           d S r   )r   r   r
   SAPendingDeprecationWarningr   s     r   warn_pending_deprecationr   $   s"    M#s6:NNNNNNr   __init__c                 .    d| dpdfd}|S )N.. deprecated::   c           	      `    t          | t          j        t                    z            S Nfunc)_decorate_cls_with_warningr
   r   dict)clsconstructorheadermessages    r   decoratez deprecated_cls.<locals>.decorate+   s7    )$d,,,,
 
 	
r    )versionr.   r,   r/   r-   s    `` @r   deprecated_clsr2   (   sE     (/'-R-AF
 
 
 
 
 
 
 Or   Tc                 <    |rd| dpdnddfd}|S )a  Decorates a function and issues a deprecation warning on use.

    :param version:
      Issue version in the warning.

    :param message:
      If provided, issue message in the warning.  A sensible default
      is used if not provided.

    :param add_deprecation_to_docstring:
      Default True.  If False, the wrapped function's __doc__ is left
      as-is.  If True, the 'message' is prepended to the docs if
      provided, or sensible default if message is omitted.

    r"   r#   r$   N$Call to deprecated function %(func)sc                 h    t          | t          j        t          | j                  z            S r&   )_decorate_with_warningr
   r   r*   __name__fnr-   r.   s    r   r/   zdeprecated.<locals>.decorateP   s6    %$d,,,,	
 
 	
r   r0   r1   r.   add_deprecation_to_docstringr/   r-   s    `  @r   
deprecatedr<   7   s]    " $  ,3GGgmmE8
 
 
 
 
 
 Or   c                  x     i                                   D ]\  }\  }}t          |          |<    fd}|S )a"  Decorates a function to warn on use of certain parameters.

    e.g. ::

        @deprecated_params(
            weak_identity_map=(
                "0.7",
                "the :paramref:`.Session.weak_identity_map parameter "
                "is deprecated."
            )

        )

    c           	      j   t          j        |           }|j        t          t	          |j        t          |j                  t          |j                  z
  d          |j                            t                                                  t                    	                              ndt                    t          fd            }| j        d ur| j        pd}|r,t          |d 	                                D                       } ||           }||_        |S )Nr0   c                     D ];}||         |         k    r't          j        |         t          j        d           <D ]-}||v r't          j        |         t          j        d           . | |i |S Nr   r   r   )r9   r   kwargsmcheck_defaultscheck_kwdefaultsmessagess       r   warnedz3deprecated_params.<locals>.decorate.<locals>.warned~   s    #  !9++M S%=!      ;;M S%=!    2t&v&&&r   r$   c                 0    i | ]\  }\  }}|d |d|pdS )r"   r#   r$   r0   ).0paramr1   r.   s       r   
<dictcomp>z7deprecated_params.<locals>.decorate.<locals>.<dictcomp>   sD       11 Eggg2O  r   )r   inspect_getfullargspecrE   r*   zipr   lensetintersection
differencer   __doc__r   items)
r9   specrG   doc	decoratedrC   rD   rE   rF   specss
        @@@r   r/   z#deprecated_params.<locals>.decorateo   sS   ,R00=$Is49~~DM0B0BBEEFM  H !]]77AAN8}}//99HHN8}}H		' 	' 	' 	' 	' 	' 	' 
	' j$39r 	# 5:[[]]   C F2JJ		r   )rS   _sanitize_restructured_text)rW   rJ   r1   r.   r/   rF   s   `    @r   deprecated_paramsrY   [   se      H%*[[]] ? ?!!5g>>) ) ) ) ) )V Or   c                 <    |rd| dpdnddfd}|S )aE  Decorates a function and issues a pending deprecation warning on use.

    :param version:
      An approximate future version at which point the pending deprecation
      will become deprecated.  Not used in messaging.

    :param message:
      If provided, issue message in the warning.  A sensible default
      is used if not provided.

    :param add_deprecation_to_docstring:
      Default True.  If False, the wrapped function's __doc__ is left
      as-is.  If True, the 'message' is prepended to the docs if
      provided, or sensible default if message is omitted.
    r"   z (pending) r$   Nr4   c                 h    t          | t          j        t          | j                  z            S r&   )r6   r
   r   r*   r7   r8   s    r   r/   z%pending_deprecation.<locals>.decorate   s6    %+d,,,,	
 
 	
r   r0   r:   s    `  @r   pending_deprecationr\      s]    & $  6=gg2O8
 
 
 
 
 
 Or   c                 ,    | |S t          |           | S N)r   )parameter_valuedefault_valuewarning_texts      r   deprecated_option_valuerb      s"    %%%r   c                 4    d }t          j        d||           S )Nc                 J    |                      dd          \  }}|dv r|dz  }|S )Nr   r	   )r(   methz())group)rB   type_names      r   replz)_sanitize_restructured_text.<locals>.repl   s1    ggammt$$$DLDr   z\:(\w+)\:`~?(?:_\w+)?\.?(.+?)`)resub)textri   s     r   rX   rX      s(       63T4@@@r   c           
         | j         d ur| j         pd}||t          |          z  }t          ||d          }t          |           t          u r=t          | j                  }||d<   t          | j        | j        |          } ||         }n|| _         t          | |          }t          | |t          |||d                      | S )Nr$   r'   r   rR   )
rR   r*   r   type__dict__r7   	__bases__getattrsetattrr6   )r+   r,   wtyper.   docstring_headerrU   clsdictconstructor_fns           r   r)   r)      s     +T
!
1ck
7RC#Dk2222#C)91==993<((G!$GIs|S]G<<C$[1NNCK$S+66N~ugtDD   Jr   c                    t                    t          fd            }| j        dur| j        pd}|)|t          | j                  z  }t          ||d          } ||           }||_        fd|_        |S )z=Wrap a function with a warnings.warn and augmented docstring.c                 B    t          j        d            | |i |S r@   r   r   )r9   r   rA   r.   rs   s      r   rG   z&_decorate_with_warning.<locals>.warned   s/    gu3333r4"6"""r   Nr$   r'   r   c                  2    t          j         d          S r@   ry   )r.   rs   s   r   <lambda>z(_decorate_with_warning.<locals>.<lambda>  s    w!!L!L!L r   )rX   r   rR   r*   r7   r   _sa_warn)r(   rs   r.   rt   rG   rU   rV   s    ``    r   r6   r6      s     *'22G# # # # # Y# ,d
"
3t|
9rC#Ddm4444#C)91==tIILLLLLIr   )r   )r    )NTr^   )rR   rj   r   r$   r   langhelpersr   r   r   r   r
   r   r   r   r2   r<   rY   r\   rb   rX   r)   r6   r0   r   r   <module>r~      s~    
			        + + + + + + " " " " " " . . . . . . * * * * * *      H H H H= = = =O O O O   ! ! ! !H? ? ?F 9=# # # #L  A A A 8<   6     r   