\hJJxdZddlZddlZddlZddlZddlmZmZmZm Z m Z m Z m Z ddl mZddlmZmZddlmZddlmZddlmZmZdd lmZdd lmZdd lmZdd lm Z dd l!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*m+Z+gdZ,ejZe.Z/ej`jcZ2de3de e3e e3ffdZ4de e3de e3fdZ5dede e3defdZ6de3de e e3e3e e3ffdZ7de3ddfdZ8de3de3fdZ9Gd d!Z:de3de:fd"Z; d?dd#ddd#d#d#dd$de3d%e e e e3fd&e e<d'ede3d/e3de e3fd1Z?d/e3d2e e3de:fd3Z@ d?dd#ddd#dd#dd4d/e3d%e e e3e fd&e e<d'eZFy)Ba~Backing implementation for InstallRequirement's various constructors The idea here is that these formed a major chunk of InstallRequirement's size so, moving them and support code dedicated to them outside of that class helps creates for better understandability for the rest of the code. These are meant to be used elsewhere within pip to create instances of InstallRequirement. N) CollectionDictListOptionalSetTupleUnion)Marker)InvalidRequirement Requirement) Specifier)InstallationError)PyPITestPyPI)Link)Wheel)ParsedRequirement)InstallRequirement)is_archive_file)is_installable_dir)get_requirement) path_to_url)is_urlvcs)install_req_from_editableinstall_req_from_lineparse_editablepathreturnctjd|}d}|r&|jd}|jd}||fS|}||fS)Nz^(.+)(\[[^\]]+\])$)rematchgroup)rmextraspath_no_extrass a/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pip/_internal/req/constructors.py _strip_extrasr*+sT &-A F 6 !! 6 !!r'cf|s tStd|jzjS)N placeholder)setrlowerr')r's r)convert_extrasr07s( u =6<<>9 : A AAr+req new_extrasc@tjdt|tj}| Jd|d|j d}|j d}|| Jd|d|rdd j t |znd }t|||S) z Returns a new requirement based on the given one, with the supplied extras. If the given requirement already has extras those are replaced (or dropped if no new extras are given). z([\w\t .-]+)(\[[^\]]*\])?(.*))flagszregex match on requirement z! failed, this should never happenr!z®ex group selection for requirement z[%s],)r# fullmatchstrASCIIr%joinsortedr )r1r2r$prepostr's r)_set_requirement_extrasr?=s &(\\( Chh &E L $SE)JKLQC++a.D D,W /u4UVW,;E&388F:$6772F #vhtf- ..r+ editable_reqc|}t|\}}tjj|r t |}|j j drMt|j}|r)||td|j zjfS||tfStD]-}|j j |ds&|d|}nt|}|js0djtj}t!|d|d|j}|st!dj#|||tfS) aParses an editable requirement into: - a requirement name - an URL - extras - editable options Accepted requirements: svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir .[some_extra] zfile:r-:+z, zq is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with z).zZCould not detect requirement name for '{}', please specify one with #egg=your_package_name)r*osrisdirrr/ startswithr egg_fragmentrr'r.ris_vcsr; all_schemesrformat)r@url url_no_extrasr' package_nameversion_controllinkbackendss r)rrVs[ C*#.M6 ww}}]##M2 ''0M*77    >?FF   5 5 99; ! !_$5Q"7 8$%Qse,C  9D ;;99S__-n'j ,  $$L  **0&*>   ce ##r+filenamec4t|dd5}dd|DD}|D]_}d|vr|d|jd}|jdr |dd jt |d z}t |dddy dddy#1swYyxYw) a Check if file is parsable as a requirements file. This is heavily based on ``pkg_resources.parse_requirements``, but simplified to just check the first meaningful line. :raises InvalidRequirement: If the first meaningful line cannot be parsed as an requirement. zutf-8ignore)encodingerrorsc3FK|]}|r|jds|yw)#N)rF.0lines r) z2check_first_requirement_in_file..s& DOOC0  s!c3<K|]}|jywN)striprXs r)r[z2check_first_requirement_in_file..s4$4sz #N\r7)openfindendswithr^nextr )rQflinesrZs r)check_first_requirement_in_filergs h :a 4!4   Dt|-diio.}}T"CRy(4r?:   ! sA+BBBctjj|sd|dSd} t||d|dz }|S#t$rt j d|Y|SwxYw)zReturns helpful msg in case requirements file does not exist, or cannot be parsed. :params req: Requirements file path z File 'z' does not exist.z The path does exist. zThe argument you provided (zx) appears to be a requirements file. If that is the case, use the '-r' flag to install the packages specified within it.z&Cannot parse '%s' as requirements file)rDrexistsrgr loggerdebug)r1msgs r)deduce_helpful_msgrms 77>># .// "C  ', u1 2  J D =sC JDs ?A"!A"c <eZdZdeedeedeedeefdZ y)RequirementParts requirementrOmarkersr'c<||_||_||_||_yr])rprOrqr')selfrprOrqr's r)__init__zRequirementParts.__init__s!'   r+N) __name__ __module__ __qualname__rr rr rr9rtr+r)roros? k* tn &!  C r+roct|\}}}| t|}nd}t |}t ||d|S#t$rtd|dwxYw)NInvalid requirement: '')rr r rrro)r@namerKextras_overrider1rOs r)parse_req_from_editabler~sr!/ !=D#  F)4T):C 9D Ct_ ==" F#&.with_sourcehsKw{m1--r+ req_as_stringc t}|jD]/}t|}|jds d|d}t ||S#t $rot jjvrd}|tz }n!dvrtfdtDsd}nd}d }|r|d |z }t |wxYw) N]zExtras after version 'z'.zIt looks like a path.=c3&K|]}|v ywr]rx)rYoprs r)r[zAparse_req_from_line.._parse_req_string..ts2(*m#2sz,= is not a valid operator. Did you mean == ?r7zInvalid requirement: z Hint: ) r specifierr9rcrr rDrrrmany operators)rr1specspec_strrladd_msgrs` r)_parse_req_stringz.parse_req_from_line.._parse_req_stringms 1!-0C(  1t9$$S)28*B?C+C00  1  1" )ww{{m+1-m<< %c2.72/I 5m5FGHC'++#C( ( )s AA8C)rrr^r rDrnormpathabspathrr*rschemer#searchrKris_wheelrrQr|versionrGr0r9r ro)r|r marker_sepmarkers_as_stringrqrrrOextras_as_stringprKwheelr'rr1rs ` @r)parse_req_from_liner8s d|  T"&**Z";-335 G./G ::rst  FFF0N665*,8<9790)    8 $  % % '  " "c8C=&8 9 "B8C=BSXB //#c(/{/24$4$x}c3s8/K)L4$ncd8CC2   ># >2B >*<@"&*.37#(BF13678    T#Y' 4T#Y/0!d3c49n(=#=>?@34&S DW8cW8 W8BRW8x<@""&*.37!%BF" "s$6678" "  " T#Y' "4T#Y/0""#""d3c49n(=#=>?""N04!% ##+,## #  #  #P!%BF %!%%% % d3c49n(=#=>? %  %P ($"49K4  sOr+