
    l:ik                         d dl Z d dlmZmZmZ d dlmZ d dlmZ d dl	m
Z
mZmZmZ eZe e
d      d               Zd Z ed      r  e ed            e      Zed	        Zy)
    N)	dropwhileislice	takewhile)sudo_support)yum_available)for_appreplace_commandwhichcacheyumc                     d| j                   v S )NzNo such command: )output)commands    Z/var/www/html/bot/venv/lib/python3.12/site-packages/thefuck/rules/yum_invalid_operation.pymatchr      s     '..00    c                     t        j                  dt         j                        } | j                  j	                         }|D cg c]  }|j                  d       }}t        d |      }t        |dd       }t        t        d |            }|D cg c]$  }|j                         j                  d      d   & c}S c c}w c c}w )	Nr   )stdoutzutf-8c                 &    | j                  d       S )NzList of Commands:)
startswithlines    r   <lambda>z!_get_operations.<locals>.<lambda>   s    t7J'K#K r      c                 "    | j                         S )N)stripr   s    r   r   z!_get_operations.<locals>.<lambda>   s    

 r    r   )
subprocessPopenPIPEr   	readlinesdecoder   r   listr   r   split)proclinesr   s      r   _get_operationsr'      s    E*//:DKK!!#E.34dT[[!4E4KUSE5!T"E4e<=E3894DJJLs#A&99	 5 :s   B>)Cc                     | j                   d   }|dk(  r| j                  j                  dd      gS t        | |t	                     S )N   	uninstallremove)script_partsscriptreplacer	   r'   )r   invalid_operations     r   get_new_commandr0       sH    ,,Q/K'&&{H=>>7$57HIIr   )r   	itertoolsr   r   r   thefuck.specific.sudor   thefuck.specific.yumr   thefuck.utilsr   r	   r
   r   enabled_by_defaultr   r'   r0    r   r   <module>r7      sy     2 2 . . @ @"  1  1: 	<)eE%L)/:O J Jr   