a  zeT@sddlZddlZddlZddlZddlZddlZddlZddlm Z m Z ddl m Z ddlmZddlmZddlmZddlmZddlmZdd lmZmZmZdd lmZd Zee Z!d d Z"GdddZ#ddZ$ddZ%dS)N)AnyDict)parse) LinkCollector) PackageFinder)get_default_environment)SelectionPreferences) PipSession)adjacent_tmp_filecheck_path_ownerreplace) ensure_dirz%Y-%m-%dT%H:%M:%SZcCs|}t|}|SN)encodehashlibsha224 hexdigest)key key_bytesnamerc/opt/bitninja-python-dojo/embedded/lib/python3.9/site-packages/pip/_internal/self_outdated_check.py_get_statefile_namesrc@s(eZdZddZeddZddZdS)SelfCheckStatec Csi|_d|_|rtj|dt|j|_z>t|jdd}t ||_Wdn1sZ0YWnt t t fy~Yn0dS)N selfcheckzutf-8)encoding) statestatefile_pathospathjoinrropenjsonloadOSError ValueErrorKeyError)self cache_dir statefilerrr__init__"s .zSelfCheckState.__init__cCstjSr)sysprefix)r'rrrr4szSelfCheckState.keycCs|js dSttj|js dSttj|j|j|t|d}t j |ddd}t |j}| | Wdn1s0Yzt|j|jWntyYn0dS)N)r last_check pypi_versionT),:) sort_keys separators)rr rrdirnamer rstrftimeSELFCHECK_DATE_FMTr"dumpsr writerr rr$)r'r. current_timertextfrrrsave9s  , zSelfCheckState.saveN)__name__ __module__ __qualname__r*propertyrr;rrrrr!s rcCst|}|duod|jkS)zChecks whether pkg was installed by pip This is used not to display the upgrade message when pip is in fact installed by system package manager, such as dnf on Fedora. Npip)rget_distribution installer)pkgdistrrrwas_installed_by_pip]s rEcCsRtd}|sdS|j}d}z t|jd}tj}d|jvrzd|jvrztj|jdt }|| dkrz|jd}|durt j ||dd}t d d d } tj || d } | dj} | durWdSt| j}|||t|} || ko|j| jkotd} | s WdStjd }td |||Wn"tyLtjdddYn0dS)zCheck for an update for pip. Limit the frequency of checks to once per week. State is stored either in the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix of the pip script path. r@N)r(r-r.i: T)optionssuppress_no_indexF) allow_yankedallow_all_prereleases)link_collectorselection_prefsz -m pipzYou are using pip version %s; however, version %s is available. You should consider upgrading via the '%s install --upgrade pip' command.z5There was an error checking the latest version of pip)exc_info)rrAversionrr(datetimeutcnowrstrptimer5 total_secondsrcreaterrfind_best_candidatebest_candidatestrr; parse_version base_versionrEr+ executableloggerwarning Exceptiondebug)sessionrFinstalled_dist pip_versionr.rr8r-rJrKfinderrTremote_versionlocal_version_is_olderpip_cmdrrrpip_self_version_checkhsh         rd)&rNrr"loggingoptparseos.pathrr+typingrrZpip._vendor.packaging.versionrrVpip._internal.index.collectorr"pip._internal.index.package_finderrpip._internal.metadatar$pip._internal.models.selection_prefsrpip._internal.network.sessionr pip._internal.utils.filesystemr r r pip._internal.utils.miscr r5 getLoggerr<rYrrrErdrrrrs*        <