idbdZddlmZddlmZGddeZd dZGd d eZd S) zeLegacy routines to resolve circular module imports at runtime. These routines are replaced in 1.4. )update_wrapper)compatc eZdZdZddZdZdS)_memoized_propertyzivendored version of langhelpers.memoized_property. not needed in the 1.4 version of preloaded. NcH||_|p|j|_|j|_dSN)fget__doc____name__)selfr docs O/opt/cloudlinux/venv/lib/python3.11/site-packages/sqlalchemy/util/_preloaded.py__init__z_memoized_property.__init__s$ *dl   cV||S||x|j|j<}|Sr )r __dict__r )r objclsresults r__get__z_memoized_property.__get__s. ;K/3yy~~= T]#f rr )r __module__ __qualname__r rrrrrrsA &&&& rrTctj|rtj|}n|}tj|}|dr|dd}n|dr d|dz}nd}tj|d|d|dd|d}d}|dr|t |dz }|dr|t |dz }|d|dz}|r|d|z d}nd}tj||d|d|d } |rt |||| St |dd ||dd | dd  S) zlvendored version of langhelpers._format_argspec_plus. not needed in the 1.4 version of preloaded. rrz%s[0]Nrc d|zS)N=r)xs rz&_format_argspec_plus..Ms cAgr) formatvalue)argsself_arg apply_posapply_kw)rcallableinspect_getfullargspecinspect_formatargspeclendict) fngroupedspecr$r%r& num_defaults name_argsdefaulted_valsr's r_format_argspec_plusr4&s r,R00  ' .D Aw71: aT!W$, Qa$q'4aIL Aw%DG $  Aw%DG $ Q$q'!I"1|#3#5#56+ Q Q%% H       ad"oad^     rcheZdZdZdZdZedZeZ iZ Gdde Z dS) dependenciesaApply imported dependencies as arguments to a function. E.g.:: @util.dependencies( "sqlalchemy.sql.widget", "sqlalchemy.engine.default" ); def some_func(self, widget, default, arg1, arg2, **kw): # ... Rationale is so that the impact of a dependency cycle can be associated directly with the few functions that cause the cycle, and not pollute the module-level namespace. c g|_|D]k}|d}|jtd|dd|dldS)N.rr() import_depssplitappendr6 _importlaterjoin)r depsdeptokenss rrzdependencies.__init__qs}  CYYs^^F   # #))#((6!B$<*@*@&*MM      rc |j}tj|}t|d}|ddv}t t |D]}d|z|d||rdndz<t |d}|D] }||rdnd= ||ddd<t |d} d| d|d d z} t| t} t|d |j | _ t| |S) Nr)r rzimport_deps[%r]rF)r/z!lambda %(args)s: fn(%(apply_kw)s)r$r')r$r'im_func) r9rr*listranger,r4evallocalsgetattr __defaults__r) r r.r9r0 spec_zerohasselfi inner_specimpname outer_speccode decorateds r__call__zdependencies.__call__ys4& ,R00aMM A,/1s;''(( G GA1BQ1FDGAg,1- . .)$>>> " / /Gw-!!A..Q )$>>> 2v&":.6 6   vxx(( !(Y!;!;!H i,,,rcttjD]0}|j|r|1dSr )rCr6 _unresolved _full_path startswith_resolve)rpathms r resolve_allzdependencies.resolve_allsLl.//  A|&&t,,    rcjeZdZeZiZdZdZedZ e dZ dZ dZ dS)dependencies._importlaterc|dz|z}|tjvrtj|St|xtj|<}|SNr8)r6_by_keyobject__new__)rrWaddtlkeyimps rr`z!dependencies._importlater.__new__sO*u$Cl***#+C0028..2E2EE $S)C rc`||_||_tj|dSr )_il_path _il_addtlr6rSadd)r rWras rrz"dependencies._importlater.__init__s- DM"DN  $ ( ( . . . . .rc&|jdz|jzSr])rerfr s rrTz$dependencies._importlater._full_paths=3&7 7rc|tjvr td|jd|jdt |j|jS)Nz6importlater.resolve_all() hasn't been called (this is  ))r6rS ImportErrorrerfrG_initial_importris rmodulez dependencies._importlater.modulesS|///!k}}}dnnn6 4/@@ @rctj|tj|jt t|jg|_ dSr ) r6rSdiscardrimport_reglobalsrFrfrnris rrVz"dependencies._importlater._resolvesK  $ , ,T 2 2 2#)> wyy&((T^4D$$D rc|dkrtd|jz t|j|}n)#t$rt d|jd|dwxYw||j|<|S)NrozCould not resolve module %szModule z has no attribute '')rmrTrGroAttributeErrorr)r rbattrs r __getattr__z%dependencies._importlater.__getattr__sh!1DOC t{C00!   $n9=###N "&DM# Ks 5&AN)r rrsetrSr^r`rpropertyrTrrorVrxrrrr<r[scee     / / /  8 8  8  A A   A        rr<N) r rrr rrQ classmethodrYryrSr^r_r<rrrr6r6_s"---6[ #%%KG33333v33333rr6N)T) r functoolsrrr_rr4r6rrrr~s %$$$$$&6 6 6 6 rqqqqq6qqqqqr