7f tddlZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z mZmZddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd l m!Z!dd l"m#Z#ddl$m%Z%ddl&m'Z'm(Z(ddl)m*Z*m+Z+m,Z,ddl-m.Z.ej/dZ0ej1e2Z3de4de4fdZ5de4dejfdZ6GddZ7e GddZ8de4de9fdZ:de#d ej;dee4fd!ZdS)(N) dataclass)AnyCallableDictOptional)Version)parse)Group)escape)Text) LinkCollector) PackageFinder)get_default_environment)SelectionPreferences) PipSession)WINDOWS) get_best_invocation_for_this_pip#get_best_invocation_for_this_python)adjacent_tmp_filecheck_path_ownerreplace) ensure_dir)dayskeyreturncz|}tj|}|SN)encodehashlibsha224 hexdigest)r key_bytesnames /builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pip/_internal/self_outdated_check.py_get_statefile_namer&$s/ I >) $ $ . . 0 0D Kisodatechtj|ddS)zConvert an ISO format string to a date. Handles the format 2020-01-22T14:24:01Z (trailing Z) which is not supported by older versions of fromisoformat. Zz+00:00)datetime fromisoformatr)r(s r% _convert_dater-*s)   * *7??3+I+I J JJr'c~eZdZdeddfdZedefdZdejdeefdZ dedejddfd Z dS) SelfCheckState cache_dirrNchi|_d|_|rtj|dt |j|_ t|jd5}tj ||_ddddS#1swxYwYdS#tttf$rYdSwxYwdS)N selfcheckzutf-8)encoding) _state_statefile_pathospathjoinr&ropenjsonloadOSError ValueErrorKeyError)selfr0 statefiles r%__init__zSelfCheckState.__init__4s&( #  #%7<<;(;DH(E(E$$D  $.AAA7Y"&)I"6"6DK777777777777777777Z2      s6 B B: BB  BB BB/.B/ctjSr)sysprefix)r?s r%rzSelfCheckState.keyEs zr' current_timec|jsdSd|jvrdSd|jvrdSt|jd}||z }|tkrdS|jdS)z7Check if we have a not-outdated version loaded already.N last_check pypi_version)r4r-_WEEK)r?rErGtime_since_last_checks r%getzSelfCheckState.getIss{ 4 t{ * *4  , ,4#4;|#<== ,z 9 5 ( (4{>**r'rHcF|jsdSttj|jsdSt tj|j|j||d}tj |dd}t|j5}| | dddn #1swxYwY t|j|jdS#t$rYdSwxYw)N)rrGrHT),:) sort_keys separators)r5rr6r7dirnamerr isoformatr:dumpsrwriterrr$r<)r?rHrEstatetextfs r%setzSelfCheckState.set\sY#  F 0D E EFF  F 27??4#788999 8&0022(   z%4JGGG t3 4 4 # GGDKKMM " " " # # # # # # # # # # # # # # #  AFD0 1 1 1 1 1    DD s$6(C**C.1C.6D D D ) __name__ __module__ __qualname__strrApropertyrr+rrKrXr'r%r/r/3s#$"SX+ 1+hsm++++&  83D       r'r/c0eZdZUeed<eed<defdZdS) UpgradePromptoldnewrc "trtd}nt}d}tt t j|d|jd|jdt j|dt|dS)Nz -m pipz/[bold][[reset][blue]notice[reset][bold]][reset]z) A new release of pip is available: [red]z[reset] -> [green]z[reset]z To update, run: [green]z install --upgrade pip) rrrr r from_markuprarbr )r?pip_cmdnotices r%__rich__zUpgradePrompt.__rich__s  9<>>GGGGG688GB FF  FFFF48HFFF    BB //BBB     r'N)rYrZr[r\__annotations__r rgr^r'r%r`r`sC HHH HHH %      r'r`pkgcbt|}|duo d|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)ridists r%was_installed_by_pipros4 # $ $ 5 5c : :D t  7 77r'sessionoptionsctj||d}tdd}tj||}|dj}|dSt |jS)NT)rqsuppress_no_indexF) allow_yankedallow_all_prereleases)link_collectorselection_prefsrk)r createrrfind_best_candidatebest_candidater\version)rprqrvrwfinderrzs r%_get_current_remote_pip_versionr}s#)N+#O  !%'F//66ENt ~% & &&r'rUrE local_versionget_remote_versionc||}|>|}|tddS|||t |}td|td|t d}td||sdS||ko|j|jk}|rtt||SdS)NzNo remote pip version foundzRemote version of pip: %szLocal version of pip: %srkzWas pip installed by pip? %s)rarb) rKloggerdebugrX parse_versionro base_versionr`r\)rUrEr~rremote_version_strremote_versionpip_installed_by_piplocal_version_is_olders r%_self_version_check_logicrs<00!//11  % LL6 7 7 74 $l333"#566N LL,n=== LL,m<<</66 LL/1EFFF t & F  &.*E EM]!3!39KLLLL 4r'c vtd}|sdStt|jt jt jj|j tj t||}|!td|ddidSdS) 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. rkN)r0)rUrEr~rz%srichT)extra)rrlrr/r0r+nowtimezoneutcr{ functoolspartialr}rwarning)rprqinstalled_distupgrade_prompts r%pip_self_version_checkrs-..??FFN .w'8999&**8+<+@AA$,$, +Wg  N!t^FD>BBBBB"!r')?r+rr r:loggingoptparseos.pathr6rC dataclassesrtypingrrrrpip._vendor.packaging.versionrr rpip._vendor.rich.consoler pip._vendor.rich.markupr pip._vendor.rich.textr pip._internal.index.collectorr "pip._internal.index.package_finderrpip._internal.metadatar$pip._internal.models.selection_prefsrpip._internal.network.sessionrpip._internal.utils.compatrpip._internal.utils.entrypointsrrpip._internal.utils.filesystemrrrpip._internal.utils.miscr timedeltarI getLoggerrYrr\r&r-r/r`boolroValuesr}rrr^r'r%rsm  !!!!!!000000000000111111@@@@@@************&&&&&&777777<<<<<<::::::EEEEEE444444......XWWWWWWWWW//////"""  8 $ $SS K3K8#4KKKKIIIIIIIIX          08c8d8888' '"*/' c]''''8 #  !Xc]!23  m DCJCCTCCCCCCr'