BEKhdZddlZddlZddlmZddlmZddlmZddlmZddlm Z d d lm Z dd Z dd Z ddZ ddZddZdZ ddZdZdZ ddZddZdS)zSHelpers related to deprecation of functions, methods, classes, other functionality.N)compat)_hash_limit_string) decorator)inject_docstring_text)inject_param_text)exccHtj|tj|dSN stacklevelwarningswarnr SADeprecationWarningmsgrs /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/sqlalchemy/util/deprecations.pywarn_deprecatedrs" M#s/JGGGGGGcl|rt|d|}tj|tj|dS)zhIssue a deprecation warning with a parameterized string, limiting the number of registrations. N)rrrr r)rargsrs rwarn_deprecated_limitedrs:  0 b$// M#s/<<<<.decorate+s7)    $ d ,,, ,     r)versionr.r,r/r-s `` @rdeprecated_clsr2(sE(/'-R- AF        OrTc<|r d|dpdnddfd}|S)aDecorates 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)scht|tjt|jzSr&)_decorate_with_warningr rr*__name__fnr-r.s rr/zdeprecated..decoratePs6%   $ d ,,, ,     rr0r1r.add_deprecation_to_docstringr/r-s ` @r deprecatedr<7s]"$,3GGgmmE8       Orc xiD]\}\}}t||<fd}|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 jtj|}|jtt |jt |jt |jz d|jtt ndttfd}|j dur|j pd}|r,t|d D}||}||_ |S)Nr0cD];}|||kr'tj|tjd<D]-}||vr'tj|tjd.||i|SNr rr)r9rkwargsmcheck_defaultscheck_kwdefaultsmessagess rwarnedz3deprecated_params..decorate..warned~s#  !9 ++M  S%=!  ;;M  S%=!2t&v&& &rr$c0i|]\}\}}|d|d|pdS)r"r#r$r0).0paramr1r.s r z7deprecated_params..decorate..sD11Eggg 2 Or)rinspect_getfullargspecrEr*ziprlenset intersection differencer__doc__ritems) r9specrGdoc decoratedrCrDrErFspecss @@@rr/z#deprecated_params..decorateosS,R00 = $Is49~~DM0B0BBEEFMH !]]77AAN8}}//99HHN8}}H  ' ' ' ' ' ' '  'j$39r  #5:[[]]CF2JJ  r)rS_sanitize_restructured_text)rWrJr1r.r/rFs` @rdeprecated_paramsrY[se H%*[[]]??!!5g>>))))))V Orc<|r d|dpdnddfd}|S)aEDecorates 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$Nr4cht|tjt|jzSr&)r6r rr*r7r8s rr/z%pending_deprecation..decorates6%   + d ,,, ,     rr0r:s ` @rpending_deprecationr\s]&$6=gg 2 O8       Orc,||St||SN)r)parameter_value default_value warning_texts rdeprecated_option_valuerbs" %%%rc4d}tjd||S)NcJ|dd\}}|dvr|dz }|S)Nrr )r(methz())group)rBtype_names rreplz)_sanitize_restructured_text..repls1ggamm t $ $ $ DLD rz\:(\w+)\:`~?(?:_\w+)?\.?(.+?)`)resub)textris rrXrXs( 63T4 @ @@rc |jdur|jpd}||t|z}t||d}t|tur=t|j}||d<t|j|j|}||}n||_t||}t||t|||d|S)Nr$r'rrR) rRr*rtype__dict__r7 __bases__getattrsetattrr6)r+r,wtyper.docstring_headerrUclsdictconstructor_fns rr)r)s +T ! 1ck 7RC#Dk2222#C)91== 99  3<((G!$GI s|S]G<.warneds/ gu3333r4"6"""rNr$r'rc2tjdSr@ry)r.rssrz(_decorate_with_warning..sw!!L!L!Lr)rXrrRr*r7r_sa_warn)r(rsr.rtrGrUrVs `` rr6r6s*'22G#####Y# ,d " 3t| 9rC#Ddm4444#C)91==t IILLLLLI r)r )r )NTr^)rRrjrr$r langhelpersrrrrr rrrr2r<rYr\rbrXr)r6r0rrr~s~ ++++++""""""......******HHHH====OOOO    !!!!H???F9=####LAAA8<6r