shell bypass 403

Cubjrnet7 Shell


name : module.cpython-39.opt-1.pyc
a

�!c�A�@s�ddlmZddlmZmZddlmZddlmZddl	m
Z
ddl	ZddlZddl
Z
ddlZddlZddlZddlZGdd�dej�ZdS)	�)�print_function)�commands�CliError)�_)�NoModuleException)�loggerNcs*eZdZGdd�dej�ZGdd�de�ZGdd�de�ZGdd�de�ZGd	d
�d
e�Z	Gdd�de�Z
Gd
d�de�ZGdd�de�ZGdd�de�Z
Gdd�de�ZGdd�de�ZGdd�de�Zeeee	e
eee
eeehZehZdZed�Z�fdd�Zdd�Zdd �Zd!d"�Zd#d$�Z�ZS)%�
ModuleCommandcs,eZdZ�fdd�Zdd�Zdd�Z�ZS)zModuleCommand.SubCommandcs(ttj|��|�tjj�|j�|_dS�N)	�superr�
SubCommand�__init__�dnf�module�module_baseZ
ModuleBase�base)�self�cli��	__class__��;/usr/lib/python3.9/site-packages/dnf/cli/commands/module.pyr(sz!ModuleCommand.SubCommand.__init__c	Cs�t�}|jjD]�}|j�|�\}}|dur,q|jr8|jnd}|jrH|jnd}|jr\|jdksb|jrvt	�
td��|��|j
r�|j
nd}|jj�||dd|�}|�|�q|S)N����zjOnly module name, stream, architecture or profile is used. Ignoring unneeded information in argument: '{}')�set�opts�module_specr�_get_modules�name�stream�version�contextr�infor�format�archr�_moduleContainer�query�update)	r�modules_from_specsr�__Znsvcaprrr#�modulesrrr�#_get_modules_from_name_stream_specs,s�z<ModuleCommand.SubCommand._get_modules_from_name_stream_specsc	Cs~t�}t�}|D](}||vr|jj�|�r|�|���q|D]6}t�|�}|jtj	gd�D]}|j
r\|�|j
�q\q>||fS)N)Zforms)rrr$ZisModuleActiver&ZgetArtifacts�hawkeyZSubjectZget_nevra_possibilitiesZ
FORM_NEVRAr�add)	rZuse_modulesZskip_modulesZ	artifactsZ	pkg_namesrZartifactZsubjZ	nevra_objrrr�_get_module_artifact_names>s
�
z3ModuleCommand.SubCommand._get_module_artifact_names)�__name__�
__module__�__qualname__rr*r-�
__classcell__rrrrr&src@s(eZdZdZed�Zdd�Zdd�ZdS)zModuleCommand.ListSubCommand)�listz,list all module streams, profiles and statescCs|jj}d|_d|_dS�NT�r�demands�available_repos�sack_activation�rr5rrr�	configureRsz&ModuleCommand.ListSubCommand.configurecCs�|j}|jjr&|�|jjtjjj�}nV|jj	rF|�|jjtjjj
�}n6|jjrf|�|jjtjjj�}n|�|jjtjjj
�}|r�t|�dS|jjr�td�}tj�|��dS�NzNo matching Modules to list)rr�enabledZ_get_brief_descriptionr�libdnfr�ModulePackageContainerZModuleState_ENABLED�disabledZModuleState_DISABLED�	installedZModuleState_INSTALLEDZModuleState_UNKNOWN�printrr
�
exceptions�Error)rZmods�output�msgrrr�
run_on_moduleWs0����z*ModuleCommand.ListSubCommand.run_on_moduleN�r.r/r0�aliasesr�summaryr9rErrrr�ListSubCommandMsrIc@s(eZdZdZed�Zdd�Zdd�ZdS)zModuleCommand.InfoSubCommand)r!z)print detailed information about a modulecCs|jj}d|_d|_dSr3r4r8rrrr9tsz&ModuleCommand.InfoSubCommand.configurecCsf|jjr|j�|jj�}n*|jjr4|j�|jj�}n|j�|jj�}|rRt|�nt	j
�td���dSr:)
r�verboserZ_get_full_infor�profileZ_get_info_profilesZ	_get_infor@r
rArBr�rrCrrrrEys
z*ModuleCommand.InfoSubCommand.run_on_moduleNrFrrrr�InfoSubCommandosrMc@s(eZdZdZed�Zdd�Zdd�ZdS)zModuleCommand.EnableSubCommand)�enablezenable a module streamcCs$|jj}d|_d|_d|_d|_dSr3�rr5r6r7�	resolving�	root_userr8rrrr9�s
z(ModuleCommand.EnableSubCommand.configurec
Cs�z|j�|jj�Wnntjjy�}zR|jjj	r`|j
s>|jrB|�|jr`|jdt
jjjkr`|�t�t|��WYd}~n
d}~00dS�N�)rrNrrr
rA�
MarkingErrorsr�conf�strict�no_match_group_specs�error_group_specs�module_depsolv_errorsr<rr=�!ModuleErrorType_ERROR_IN_DEFAULTSr�error�str�r�errrrE�s
�z,ModuleCommand.EnableSubCommand.run_on_moduleNrFrrrr�EnableSubCommand�sr_c@s(eZdZdZed�Zdd�Zdd�ZdS)zModuleCommand.DisableSubCommand)�disablez%disable a module with all its streamscCs$|jj}d|_d|_d|_d|_dSr3rOr8rrrr9�s
z)ModuleCommand.DisableSubCommand.configurec
Cs�z|j�|jj�Wnntjjy�}zR|jjj	r`|j
s>|jrB|�|jr`|jdt
jjjkr`|�t�t|��WYd}~n
d}~00dSrR)rr`rrr
rArTrrUrVrWrXrYr<rr=rZrr[r\r]rrrrE�s
�z-ModuleCommand.DisableSubCommand.run_on_moduleNrFrrrr�DisableSubCommand�srac@s(eZdZdZed�Zdd�Zdd�ZdS)zModuleCommand.ResetSubCommand)�resetzreset a modulecCs$|jj}d|_d|_d|_d|_dSr3rOr8rrrr9�s
z'ModuleCommand.ResetSubCommand.configurec
Csdz|j�|jj�WnJtjjy^}z.|jjj	r<|j
r<|�t�t
|��WYd}~n
d}~00dSr	)rrbrrr
rArTrrUrVrWrr[r\r]rrrrE�s
z+ModuleCommand.ResetSubCommand.run_on_moduleNrFrrrr�ResetSubCommand�srcc@s(eZdZdZed�Zdd�Zdd�ZdS)zModuleCommand.InstallSubCommand)�installz/install a module profile including its packagescCs$|jj}d|_d|_d|_d|_dSr3rOr8rrrr9�s
z)ModuleCommand.InstallSubCommand.configurec
Csrz|j�|jj|jjj�WnPtjj	yl}z4|jjjrJ|j
sF|jrJ|�t�
t|��WYd}~n
d}~00dSr	)rrdrrrrUrVr
rArTrWrXrr[r\r]rrrrE�s
z-ModuleCommand.InstallSubCommand.run_on_moduleNrFrrrr�InstallSubCommand�srec@s(eZdZdZed�Zdd�Zdd�ZdS)zModuleCommand.UpdateSubCommand)r&z0update packages associated with an active streamcCs$|jj}d|_d|_d|_d|_dSr3rOr8rrrr9�s
z(ModuleCommand.UpdateSubCommand.configurecCs&|j�|jj�}|r"td�|���dS)Nz, )rZupgraderrr�join)rZmodule_specsrrrrE�sz,ModuleCommand.UpdateSubCommand.run_on_moduleNrFrrrr�UpdateSubCommand�srgc@s(eZdZdZed�Zdd�Zdd�ZdS)zModuleCommand.RemoveSubCommand)�remove�erasez3remove installed module profiles and their packagescCs0|jj}d|_d|_d|_d|_d|_d|_dS)NTF)rr5Z
allow_erasingr6Zfresh_metadatarPrQr7r8rrrr9�sz(ModuleCommand.RemoveSubCommand.configurec
Cs�|j�|jj�}|jjr�|��}|�|t��\}}|�|jj	�
�|�\}}|jj���
�j|d�}|jj���
�j|d�}|D]>}||vr�td��|�}	t�|	�q~|jjj||jjjd�q~|s�dSt�tjj|d��dS)N�rz0Package {} belongs to multiple modules, skipping)Z
clean_deps)rW)rrhrr�allr*r-rrr$ZgetModulePackages�sackr%r?�filtermrr"rr!ZgoalrirUZclean_requirements_on_remover[r
rArT)
rZskipped_groupsr'Zremove_names_from_specr(Z
keep_namesZremove_queryZ
keep_query�pkgrDrrrrE�s.���
�z,ModuleCommand.RemoveSubCommand.run_on_moduleNrFrrrr�RemoveSubCommand�s	roc@s(eZdZdZed�Zdd�Zdd�ZdS)z ModuleCommand.SwitchToSubCommand)z	switch-toz7switch a module to a stream and distrosync rpm packagescCs.|jj}d|_d|_d|_d|_d|jj_dSr3)	rr5r6r7rPrQrrUZmodule_stream_switchr8rrrr9sz*ModuleCommand.SwitchToSubCommand.configurec
Cstz|jj|jj|jjjd�WnPtjj	yn}z4|jjjrL|j
sH|jrL|�t�
t|��WYd}~n
d}~00dS)N)rV)rZ	switch_torrrrUrVr
rArTrWrXrr[r\r]rrrrE"s
z.ModuleCommand.SwitchToSubCommand.run_on_moduleNrFrrrr�SwitchToSubCommandsrpc@s(eZdZdZed�Zdd�Zdd�ZdS)z ModuleCommand.ProvidesSubCommand)Zprovideszlist modular packagescCs|jj}d|_d|_dSr3r4r8rrrr90sz*ModuleCommand.ProvidesSubCommand.configurecCs |j�|jj�}|rt|�dSr	)rZ_what_providesrrr@rLrrrrE5sz.ModuleCommand.ProvidesSubCommand.run_on_moduleNrFrrrr�ProvidesSubCommand+srqc@s(eZdZdZed�Zdd�Zdd�ZdS)z!ModuleCommand.RepoquerySubCommand)Z	repoqueryz#list packages belonging to a modulecCs|jj}d|_d|_dSr3r4r8rrrr9?sz+ModuleCommand.RepoquerySubCommand.configurecCs�t�}|jjD]}|j�|�\}}|�|�q|�|t��\}}t�}|jjsV|jjs�|j	j
����j|d�}|D]}	|�
t|	��qr|jjr�|j	j
����j|d�}|D]}	|�
t|	��q�d�t|��}
t|
�dS)N)Znevra_strictrj�
)rrrrrr&r-�	availabler?rrlr%rmr,r\rf�sortedr@)rr'rr)r(Znames_from_specZspec_artifactsZpackage_stringsr%rnrCrrrrEDs$�z/ModuleCommand.RepoquerySubCommand.run_on_moduleNrFrrrr�RepoquerySubCommand:sru)rzInteract with Modules.cs>tt|�����fdd�|jD�}d|_dd�|D�|_dS)Nc3s|]}|��VqdSr	r)�.0�subcmd�rrr�	<genexpr>d�z)ModuleCommand.__init__.<locals>.<genexpr>cSsi|]}|jD]
}||�qqSr�rG�rvrw�aliasrrr�
<dictcomp>fsz*ModuleCommand.__init__.<locals>.<dictcomp>)r
rr�SUBCMDSrw�_subcmd_name2obj)rrZsubcmd_objsrrxrrbs�zModuleCommand.__init__cCs|��}|jdddtd�d�|jdddtd�d�|jd	d
dtd�d�|jdd
dtd�d�|jdddtd�d�|jdddtd�d�g}g}t|jdd�d�D]2}|�|jd�|�d�|jd|jp�d��q�|jdd|dd�	|�d�|jd d!d"td#�d$�dS)%Nz	--enabledr;�
store_truezshow only enabled modules)�dest�action�helpz
--disabledr>zshow only disabled modulesz--installedr?z'show only installed modules or packagesz	--profilerKzshow profile contentz--availablerszshow only available packagesz--allrkzremove all modular packagescSs
|jdS�Nrr{)�xrrr�<lambda>~rzz-ModuleCommand.set_argparser.<locals>.<lambda>)�keyrz{}: {}rrwrSz<modular command>rr)�nargs�choices�metavarr�rzmodule-spec�*zModule specification)r�r�r�)
�add_mutually_exclusive_group�add_argumentrrtr�appendrGr"rHrf)r�parserZnarrowsZsubcommand_choicesZsubcommand_helprwrrr�
set_argparserisH����
�� 
�
�zModuleCommand.set_argparserc	CsXz|j|jjd|_Wn&ttfy>|jj��t�Yn0|j|j_|j��dSr�)	r�rrwr�KeyErrorrZ	optparser�print_usager9�rrrrr9�s

zModuleCommand.configurecCs|��|j��dSr	)�check_required_argumentrwrEr�rrr�run�szModuleCommand.runcCsRdd�|jD�}|jjd|vrN|jjsNttd��tjj	|jj
|jjd���dS)NcSsg|]}|jD]}|�qqSrr{r|rrr�
<listcomp>�s
�z9ModuleCommand.check_required_argument.<locals>.<listcomp>rz{} {} {}: too few arguments)�SUBCMDS_NOT_REQUIRED_ARGrrwrrrr"r
�utilZ	MAIN_PROGZcommand)rZnot_required_argumentrrrr��s�
��z%ModuleCommand.check_required_argument)r.r/r0r�CommandrrIrMr_rarcrergrorprqrurr�rGrrHrr�r9r�r�r1rrrrr%s0'"%�	r)Z
__future__rZdnf.clirrZdnf.i18nrZdnf.module.exceptionsrZdnf.utilrr
�sys�osr+r<Zdnf.module.module_baseZdnf.exceptionsr�rrrrr�<module>s

© 2025 Cubjrnet7