o nhM@sddlmZddlZddlZddlZddlZddlmZddlm Z m Z m Z ddl m Z ddlmZddlmZmZmZmZe d Zd d gZGd d d Zd dZejdsrejdkrt ddddZ d d!ddZeddg7ZdSdSdS)") annotationsN)CodeType)AnyLiteralTypeVar)Version)_imp) PY_COMPILED PY_FROZEN PY_SOURCE find_module_TRequirer c@sTeZdZdZ   dddd Zd d Zd d Z ddddZdddZdddZ dS)rz7A prerequisite to building or installing a distributionNhomepagestrreturnNonecCsF|dur |dur t}|dur||}|durd}|jt|`dS)N __version__)r__dict__updatelocalsself)rnamerequested_versionmoduler attributeformatrU/opt/prometheus-monitoring-scripts/lib/python3.10/site-packages/setuptools/depends.py__init__s zRequire.__init__cCs"|jdur|jd|jS|jS)z0Return full package/distribution name, w/versionN-)rr)rrrr full_name+s zRequire.full_namecCs0|jdup|jdupt|dko|||jkS)z%Is 'version' sufficiently up-to-date?Nunknown)rrrr)rversionrrr version_ok1s  zRequire.version_okr$default_T | Literal['unknown']$_T | Literal['unknown'] | None | AnycCs|jdur#z t|j|\}}}Wn tyYdSw|r!||St|j|j||}|dur>||ur>|jdur>||S|S)aGet version number of installed module, 'None', or 'default' Search 'paths' for module. If not found, return 'None'. If found, return the extracted version attribute, or 'default' if no version attribute was specified, or the value cannot be determined without importing the module. The version is formatted according to the requirement's version format (if any), unless it is 'None' or the supplied 'default'. N)rr r ImportErrorcloseget_module_constantr)rpathsr'f_p_ivrrr get_version:s   zRequire.get_versioncCs||duS)z/Return true if dependency is present on 'paths'N)r2)rr-rrr is_presentWszRequire.is_presentcCs$||}|dur dS|t|S)z>Return true if dependency is present and up-to-date on 'paths'NF)r2r&r)rr-r%rrr is_current[s zRequire.is_current)rNN)rrrr)Nr$)r'r(rr)N) __name__ __module__ __qualname____doc__r!r#r&r2r3r4rrrr rs  cCs"tjdd}|s |St|S)Ncss dVdSr5rrrrr emptydszmaybe_close..empty) contextlibcontextmanagerclosing)r.r:rrr maybe_closecs   r>javaclir'_T | intr_T | int | None | Anyc Cszt||\}}\}}}} Wn tyYdSwt|C|tkr.|dt|} n,|tkr9t ||} n!|t krFt ||d} nt ||| } t | |dWdSWdn1sdwYt| ||S)aFind 'module' by searching 'paths', and extract 'symbol' Return 'None' if 'module' does not exist on 'paths', or it does not define 'symbol'. If the module defines 'symbol' as a constant, return the constant. Otherwise, return 'default'.Nexec)r r*r>r readmarshalloadr r get_frozen_objectr compile get_modulegetattrextract_constant) rsymbolr'r-r.path_suffix_modekindinfocodeimportedrrr r,ss&       r,rTrrNrc Cs||jvrdSt|j|}tjd}tjd}tjd}|}t|D]*}|j} |j} | |kr=| dus7J|j| }q%| |krM| |ksI| |krM|S|}q%dS)a/Extract the constant value of 'symbol' from 'code' If the name 'symbol' is bound to a constant value by the Python code object 'code', return that value. If 'symbol' is bound to an expression, return 'default'. Otherwise, return 'None'. Return value is based on the first assignment to 'symbol'. 'symbol' must be a global, or at least a non-"fast" local in the code block. That is, only 'STORE_NAME' and 'STORE_GLOBAL' opcodes are checked, and 'symbol' must be present in 'code.co_names'. N STORE_NAME STORE_GLOBAL LOAD_CONST) co_nameslistindexdisopmapBytecodeopcodearg co_consts) rTrNr'name_idxrVrWrXconst byte_codeopr`rrr rMs"      rM)rAN)r'rBrrC)rA)rTrrNrr'rBrrC) __future__rr;r\rGsystypesrtypingrrrpackaging.versionrrr r r r r r__all__rr>platform startswithr,rMrrrr s*    O  (