
    l:i	                     Z    d dl Z ddlmZ ddlmZ ddlmZ ddlmZ d Z	d Z
d	 Zd
 Zd Zy)    N   )settings)Rule)Path)logsc              #      K   | D ];  }|j                   dk7  st        j                  |      }|s+|j                  s8| = yw)z[Yields all available rules.

    :type rules_paths: [Path]
    :rtype: Iterable[Rule]

    z__init__.pyN)namer   	from_path
is_enabled)rules_pathspathrules      H/var/www/html/bot/venv/lib/python3.12/site-packages/thefuck/corrector.pyget_loaded_rulesr      s?       99%>>$'D
	s   AAAAc               #   V  K   t        t              j                  j                  d       t        j
                  j                  d       t        j                  D ]G  } t        |       j                  d      D ](  }|j                  d      }|j                         s%| * I yw)z@Yields all rules import paths.

    :rtype: Iterable[Path]

    ruleszthefuck_contrib_*N)
r   __file__parentjoinpathr   user_dirsysr   globis_dir)r   contrib_modulecontrib_ruless      r   get_rules_import_pathsr      s      x.


(
(
11



$
$W
-- $"4joo.AB 	$N*33G<M##%##	$$s   BB) 	B)c            	          t               D  cg c]#  } t        | j                  d            D ]  }| % }} }t        t        |      d       S c c}} w )z4Returns all enabled rules.

    :rtype: [Rule]

    z*.pyc                     | j                   S Npriority)r   s    r   <lambda>zget_rules.<locals>.<lambda>1   s
    4==     key)r   sortedr   r   )r   	rule_pathpathss      r   	get_rulesr)   (   s`     $:#; 94$TYYv%679  9Y 9E 9"5)02 29s   (Ac           	   #   B  K   	 t        |       }| t        | d       D ch c]	  }||k7  r| }}t        |d       }t        j                  dj                  dj                  d |g|z   D                           |D ]  }|  y# t        $ r Y yw xY wc c}w w)zYields sorted commands without duplicates.

    :type corrected_commands: Iterable[thefuck.types.CorrectedCommand]
    :rtype: Iterable[thefuck.types.CorrectedCommand]

    Nc                     | j                   S r   r    )commands    r   r"   z#organize_commands.<locals>.<lambda>C   s    G4D4D r#   r$   c                     | j                   S r   r    )corrected_commands    r   r"   z#organize_commands.<locals>.<lambda>H   s    &7&@&@ r#   zCorrected commands: {}z, c              3   >   K   | ]  }d j                  |        yw)z{}N)format).0cmds     r   	<genexpr>z$organize_commands.<locals>.<genexpr>K   s     Q%,,s#Qs   )nextStopIterationr&   r   debugr0   join)corrected_commandsfirst_commandr,   without_duplicatessorted_commandss        r   organize_commandsr<   4   s     /0
  &$D F%m# 	% %
 @BO 	JJ(//		Q/PQQS T #   %s2   BB BBAB	BBBBc                 @      fdt               D        }t        |      S )zReturns generator with sorted and unique corrected commands.

    :type command: thefuck.types.Command
    :rtype: Iterable[thefuck.types.CorrectedCommand]

    c              3   p   K   | ]-  }|j                        r|j                        D ]  }|  / y wr   )is_matchget_corrected_commands)r1   r   	correctedr,   s      r   r3   z)get_corrected_commands.<locals>.<genexpr>X   sE      ?==!44W=?  	??s   36)r)   r<   )r,   r8   s   ` r   r@   r@   Q   s#    ?'k? /00r#   )r   confr   typesr   systemr    r   r   r   r)   r<   r@    r#   r   <module>rG      s-    
    $$	2:1r#   