\h1 ddlZddlZddlmZddlmZmZmZmZm Z m Z m Z ddl m Z ddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZmZdd lmZdd lm Z ddl!m"Z"ddl#m$Z$m%Z%erddl&m'Z'GddeZ(e e(Z)ddl*m+Z+ejXe-Z.GddeZ/dddede eee0ee0ffdZ1dddede0fdZ2y)N)Values) TYPE_CHECKING GeneratorListOptionalSequenceTuplecastcanonicalize_name) cmdoptions)IndexGroupCommand)SUCCESS) CommandError) LinkCollector) PackageFinder)BaseDistributionget_environment)SelectionPreferences) PipSession) stdlib_pkgs)tabulate write_output)DistributionVersionc&eZdZUdZeed<eed<y)_DistWithLatestInfozGive the distribution object a couple of extra fields. These will be populated during ``get_outdated()``. This is dirty but makes the rest of the code much cleaner. latest_versionlatest_filetypeN)__name__ __module__ __qualname____doc__r__annotations__str^/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pip/_internal/commands/list.pyrrs ,+r&r)parseceZdZdZdZdZddZdedede fd Z ded e e de fd Zd d dedd fdZd d dedd fdZd d dedd fdZd d dededfdZd d deddfdZde e e de e ddfdZy) ListCommandzt List installed packages, including editables. Packages are listed in a case-insensitive sorted order. Tz %prog [options]returnNc|jjddddd|jjddddd |jjd d ddd |jjd dddd|jjddddd|jjtj|jjdddd|jjdddddd|jjdddd |jjd!d"d#d$ |jjd%dd#d&d'(|jjtjtj tj |j}|jjd)||jjd)|jy)*Nz-oz --outdated store_trueFzList outdated packages)actiondefaulthelpz-uz --uptodatezList uptodate packagesz-ez --editablezList editable projects.z-lz--localzSIf in a virtualenv that has global access, do not list globally-installed packages.z--useruserz,Only output packages installed in user-site.)destr.r/r0z--prezYInclude pre-release and development versions. By default, pip only finds stable versions.z--formatstore list_formatcolumns)r5freezejsonzSelect the output format among: columns (default), freeze, or json. The 'freeze' format cannot be used with the --outdated option.)r.r2r/choicesr0z--not-required not_requiredz>List packages that are not dependencies of installed packages.)r.r2r0z--exclude-editable store_falseinclude_editablez%Exclude editable package from output.z--include-editablez%Include editable package from output.T)r.r2r0r/r) cmd_opts add_optionr list_path list_excludemake_option_group index_groupparserinsert_option_group)self index_optss r' add_optionszListCommand.add_options4s    ) !     ) !     * !     / !    ? !    !5!5!78   2 !    1Q !    Q !     #8 !   #8 !    !8!8!:;11*2H2H$++V  '':6 ''4==9r&optionssessionctj||}td|j}t j||S)zK Create a package finder appropriate to this list command. )rGF) allow_yankedallow_all_prereleases)link_collectorselection_prefs)rcreaterprer)rDrGrHrLrMs r'_build_package_finderz!ListCommand._build_package_findersG '--gwG/")++  ##)+  r&argsc|jr|jr td|jr|jdk(r tdt j |t t}|jr"|jd|jDt|jj|j|j|j|j |Dcgc]}t#d|}}|j$r|j'||}|jr|j)||}n|jr|j+||}|j-||t.Scc}w)Nz5Options --outdated and --uptodate cannot be combined.r6z?List format 'freeze' cannot be used with the --outdated option.c32K|]}t|ywNr ).0ns r' z"ListCommand.run..sG)!,Gs) local_only user_onlyeditables_onlyinclude_editablesskipr)outdateduptodaterr4r check_list_path_optionsetrexcludesupdaterpathiter_installed_distributionslocalr1editabler;r r9get_not_required get_outdated get_uptodateoutput_package_listingr)rDrGrQr\dpackagess r'runzListCommand.runsQ    0 0VW W    3 3x ?Q  ))'2;    KKGg6F6FG G%W\\2OO"==!,,&//")":": P '  & * '  '    ,,Xw?H   ((7;H   ((7;H ##Hg61 ' s/E7rl_ProcessedDistsc |j||Dcgc]A}tt|jtt|jkDr|Cc}Scc}wrTiter_packages_latest_infosr(r$rversionrDrlrGdists r'rhzListCommand.get_outdatedsW 77'J S,,-.s4<<7H1II    AAc |j||Dcgc]A}tt|jtt|jk(r|Cc}Scc}wrTrprss r'rizListCommand.get_uptodatesW 77'J S,,-.%DLL8I2JJ    ruc|Dchc]0}|jxsdD]}t|j2}}}t|Dchc]}|j|vs|c}Scc}}wcc}w)Nr%)iter_dependenciesr namelistcanonical_name)rDrlrGrtdepdep_keyspkgs r'rgzListCommand.get_not_requireds} ! ..06B  chh ' '  HSS0B0B(0RSSTT Ts5A&A,A,)rNNc#K|j5}|j|dddtdffd }t||D] }||  dddy#1swYyxYww)Nrtrr+ctj|j}js%|Dcgc]}|jjs|}}j |j}|j |}|y|j}|jjrd}nd}||_ ||_ |Scc}w)N) project_namewheelsdist) find_all_candidatesr{rOrr is_prereleasemake_candidate_evaluatorsort_best_candidatelinkis_wheelrr) rtall_candidates candidate evaluatorbest_candidateremote_versiontypfinderrGs r' latest_infoz;ListCommand.iter_packages_latest_infos..latest_infos"(!;!;D>"&N& #;;!%!4!4< "+!>!>~!N!)!/!7!7!&&//!C!C&4#'*$ )&sB5)_build_sessionrPrmap)rDrlrGrHrrtrs ` @r'rqz&ListCommand.iter_packages_latest_infoss}  )! W//AF + /0 8K2 #J ?! ! ! s"A)6A A A)A&"A)ct|d}|jdk(r$|r"t||\}}|j||y|jdk(re|D]_}|jdk\r-t d|j |j|j?t d|j |jay|jdk(rt t||yy) Nc|jSrT)r{)rts r'z4ListCommand.output_package_listing..s T00r&)keyr5r6z %s==%s (%s)z%s==%sr7) sortedr4format_for_columnsoutput_package_listing_columnsverboserraw_namerrlocationformat_for_json)rDrlrGdataheaderrts r'rjz"ListCommand.output_package_listings 0    ) +-h@LD&  / /f =  H ,  H??a' %t}}dllDMM!4==$,,G  H F * 7; <+r&rrct|dkDr|jd|t|\}}t|dkDr(|jddjd|D|D] }t |y)Nrr c3&K|] }d|z yw)-Nr%rUxs r'rWz=ListCommand.output_package_listing_columns...s*Bq37*Bs)leninsertrjoinr)rDrr pkg_stringssizesvals r'rz*ListCommand.output_package_listing_columns#sn t9q= KK6 "%d^ U t9q=   q#((*BE*B"B C C   r&)r+N)rr r!r"ignore_require_venvusagerFrrrrPrr$intrmrhrirgrrqrjrr%r&r'r*r*)s  EV:p  (2  &'6'c's'R ) 4:   ) 4:   U) U4: U  U$)$4:$ 4 5$L=)=4:= =*cO-1#Y r&r*pkgsrnrGr+cddg}|j}|r|jddgtd|D}|r|jd|jdk\r|jd|jdk\r|jd g}|D]}|j t |jg}|r?|jt |j|j|j|r|j|jxsd |jdk\r|j|jxsd |jdk\r|j|j|j|||fS) z_ Convert the package data into something usable by output_package_listing_columns. PackageVersionLatestTypec34K|]}|jywrT)rfrs r'rWz%format_for_columns..As1q 1szEditable project locationrLocation Installer) r]extendanyappendrrr$rrrreditable_project_locationr installer)rrGrrunning_outdated has_editablesrprojrows r'rr4sF #F'' x()1D11M 12! j!! k" D}}c$,,/0  JJs4../ 0 JJt++ ,  JJt55; < ??a  JJt}}* + ??a  JJt~~ & C#& <r&rlcg}|D]}|jt|jd}|jdk\r"|jxsd|d<|j |d<|j r't|j|d<|j|d<|j}|r||d<|j|tj|S) N)ryrrrrrrrrr) rr$rrrrrr]rrrrr7dumps)rlrGrrtinfors r'rras DMM4<<(  ??a #}}2D  $D    %()<)<%=D! "&*&:&:D" #$($B$B! $0ID, - D ::d r&)3r7loggingoptparsertypingrrrrrr r pip._vendor.packaging.utilsr pip._internal.clir pip._internal.cli.req_commandrpip._internal.cli.status_codesrpip._internal.exceptionsrpip._internal.index.collectorr"pip._internal.index.package_finderrpip._internal.metadatarr$pip._internal.models.selection_prefsrpip._internal.network.sessionrpip._internal.utils.compatrpip._internal.utils.miscrrpip._internal.metadata.baserrrnpip._vendor.packaging.versionr( getLoggerrloggerr*r$rrr%r&r'rs RRR9(;217<DE42;?.23O0   8 $H#HV* *&,* 4S ?DI %&*Z/&Sr&