+
     h1  c                   s    R t ^ RIt^ RIHt RRRRRRR	R
RRRRRRRRRRRRRR/tR!R ltR tR tR tR t	 ! R R4      t
R t]R 8X  d
   ]! 4        R# R# )"a  

enchant.checker.CmdLineChecker:  Command-Line spell checker

This module provides the class CmdLineChecker, which interactively
spellchecks a piece of text by interacting with the user on the
command line.  It can also be run as a script to spellcheck a file.

N)SpellCheckernormalz[0mZblackz[30mredz[31mgreenz[32myellowz[33mbluez[34mZpurplez[35mcyanz[36mZgreyz[90mZgrayboldz[1mc                s    \         P                  P                  4       '       d.   \        V,          V,           V ,           \        R,          ,           # W ,           # )a&  
Change text color for the Linux terminal.

Args:
    string (str): String to colorify
    color (str): Color to colorify the string in the following list:
        black, red, green, yellow, blue, purple, cyan, gr[ae]y
    prefix (str): Prefix to add to string (ex: Beginning of line graphics)
r   )sysstdoutZisattycolors)stringcolorZprefixs   &&&C/usr/lib/python3.14/site-packages/enchant/checker/CmdLineChecker.pyr   r   =   s=     zze}v%.1AAA    c                 F    R \        RRR7      ,           R,           V ,           # )[Z+r   r   ] r   r      &r   successr   M   s    s'**T1F::r   c                 r   )r   Z!r   r   r   r   r   r   r   errorr   Q   s    s%((4/&88r   c                 r   )r   Z*r   r   r   r   r   r   r   warningr   U   s    s(++d2V;;r   c                 r   )r   Z.r   r   r   r   r   r   r   infor   Y   s    s&))D0699r   c                   s   a  ] tR t^]t o RtRR.tR tR tR tR t	R t
]R	 4       tR
 tR tR tRR lt. RO]n        RtV tR# )CmdLineCheckerzA simple command-line spell checker.

This class implements a simple command-line spell checker.  It must
be given a SpellChecker instance to operate on, and interacts with
the user by printing instructions on stdout and reading commands from
stdin.
r	   Zstdinc                s"    R V n         RV n        R# )FN)_stop_checkerselfr   r   __init__ZCmdLineChecker.__init__h   s    
r   c                s    Wn         R # Nr   r   chkr   &&r   set_checkerZCmdLineChecker.set_checkerl   s    r   c                s    V P                   # r   r    r!   r#   r   get_checkerZCmdLineChecker.get_checkero   s    }}r   c                s(   RV n         V P                   Fz  pWn        V P                  4        V P	                  4        V P                  4       pV'       g%   V P                   '       g   V P                  4       pK,  V P                   '       g   Ky   R# 	  R# )zRun the spellchecking loop.FN)r   r   r   print_errorprint_suggestionsread_command)r   ZerrZstatuss   &  r   runZCmdLineChecker.runr   sg    
==CJ""$&&(FTZZZ**,zzz !r   c           
     s   V P                  V P                  P                  4       V P                  P                  V P                  P                  4      p\        \        R\        V P                  P                  RR7      ,          4      .4       \        \        R4      .4       \        \        V4      .4       \        \        R4      .4       R# )a
  print the spelling error to the console.

Prints the misspelled word along with 100 characters of
context on either side.  This number was arbitrarily chosen
and could be modified to be tunable or changed entirely.
It seems to be enough context to be helpful though
z	ERROR: %sr   r    N)_build_contextr   get_textwordZwordposprintr   r   )r   Zerror_strings   & r   r&   ZCmdLineChecker.print_error   s     **JJ!4::??DJJ4F4F
 	u[5#FFGHItBxjtL!"#tBxjr   c                s    V P                  R^ V4      pV P                  RV4      pW^,           V P                  V\        VRR7      4      # )zcreates the context line.

This function will search forward and backward
from the error word to find the nearest newlines.
it will return this line with the error word
colored red.Z
r   r   )ZrfindZfindreplacer   )ZtextZ
error_wordZerror_startZstart_newlineZend_newlines   &&&  r   r+   ZCmdLineChecker._build_context   sO     

4K8iik2A%4<<j6
 	
r   c                s   RpV P                   P                  4       p\        V4       F  w  r4V^ 8X  d9   V\        \	        V4      RR7      ,           R,           \        VRR7      ,           pKD  VR,           \        \	        V4      RR7      ,           R,           \        VRR7      ,           pK  	  \        \        R4      V.4       R# )	a  Prints out the suggestions for a given error.

This function will add vertical pipes to separate choices
as well as the index of the replacement as expected by the replace function.
I don't believe zero indexing is a problem as long as the user can see the numbers :)
r*   r   r   z: r   z | z
HOW ABOUT:N)r   suggestZ	enumerater   Zstrr.   r   )r   ZresultZsuggestionsZindexZsuggs   &    r   r'   Z CmdLineChecker.print_suggestions   s     jj((*$[1KEzCJh78 D/0  CJh78  D/	0  2  	tL!6*+r   c           
     s   \        \        \        R RR7      R,           \        RRR7      ,           R,           \        RRR7      ,           R,           4      .4       \        \        \        R	R
R7      \        R RR7      ,           R,           \        R	R
R7      ,           \        RRR7      ,           R,           \        RRR7      ,           R,           4      .4       \        \        \        RR
R7      R,           \        RRR7      ,           R,           4      .4       \        \        \        RR
R7      R,           \        RRR7      ,           R,           4      .4       \        \        \        RR
R7      R,           \        RRR7      ,           R,           4      .4       \        \        \        RR
R7      R,           \        RRR7      ,           R,           4      .4       \        \        \        RR
R7      R,           \        RRR7      ,           R,           4      .4       \        \        \        RR
R7      R,           \        RRR7      ,           R,           4      .4       \        \        R4      .4       V P                  4        R # )!Z0r   r   z..ZNz:	r/   r   z with the numbered suggestionRr   zalways replaceiz:		Zignorez
 this wordIzalways ignoreaaddz word to personal dictionaryeZeditz	 the wordqZquitz	 checkingZhz:		print this helpz messagez4----------------------------------------------------N)r.   r   r   r'   r   r   r   
print_helpZCmdLineChecker.print_help   s   #X.Cx01  IV4	5
 66		
 	#V,Cx01 Cv./ Cx0	1
  ,F;< 66		
 	#V,HF34 ##		
 	#V,O6:; ##		
 	#V,E01 55		
 	#V,F&12 ""		
 	#V,F&12 ""		
 	#V,()F&12 !!		
 	tJKLM r   c                s8   \        R 4      pVP                  4       pVP                  4       '       d   \        V4      pV P                  P                  4       pV\        V4      8  d   \        \        R4      V.4       R# \        \        R\        V P                  P                  RR7      : R\        W2,          RR7      : R24      .4       V P                  P                  W2,          4       R	# V^ ,          R
8X  d   VR,          P                  4       '       g   \        \        R4      .4       R# \        VR,          4      pV P                  P                  4       pV\        V4      8  d   \        \        R4      V.4       R# V P                  P                  W2,          4       R	# VR8X  d   R	# VR8X  d   V P                  P                  4        R	# VR8X  d   V P                  P                  4        R	# VR8X  d@   \        \!        R4      4      pV P                  P                  VP                  4       4       R	# VR8X  d
   R	V n        R	# RP%                  VP'                  4       4      '       d   V P)                  4        R# \        \        R4      .4       R# )z>> zNo suggestion numberFzReplacing 'r   r   z' with 'r   Z'Tr1   :i   NNz$Badly formatted command (try 'help')r2   r3   r4   r6   z
New Word: r7   r8   )ZinputZstripZisdigitZintr   r0   lenr.   r   r   r   r-   r/   Zreplace_alwaysZignore_alwaysr5   r   r   Z
startswithZlowerr9   )r   ZcmdZreplZsuggss   &   r   r(   ZCmdLineChecker.read_command  s   Eliik;;==s8DJJ&&(Es5z!w56=> "$**//?!%+W=
 JJu{+q6S=r7??$$wEFGHs2w<DJJ&&(Es5z!w56=>JJ%%ek2#:#:JJ$$&#:JJNN#:l+,DJJtzz|,#:DJSYY[))OOw=>?@r   Nc                s   RP                  \        V4      P                  4       4      pVe   VP                  V4      pV P                  P                  V4       RV,          p\        \        V4      .4       \        \        R\        V4      ,          4      .4       V P                  4        \        \        RV,          4      .4       V P                  P                  4       pVe   VP                  V4      pVf   \        VR4      pM$VR8X  d   \        P                  pM\        VR4      pVP                  V4       VP!                  4        R# )a  Run spellchecking on the named file.
This method can be used to run the spellchecker over the named file.
If <outfile> is not given, the corrected contents replace the contents
of <infile>.  If <outfile> is given, the corrected contents will be
written to that file.  Use "-" to have the contents written to stdout.
If <enc> is given, it specifies the encoding used to read the
file's contents into a unicode string.  The output will be written
in the same encoding.
r*   NzBeginning spell check of %sZ-zCompleted spell check of %sZw)ZjoinZopenZ	readlinesZdecoder   Zset_textr.   r   r:   r)   r   r,   Zencoder   r	   ZwriteZclose)r   infileoutfileencZinStrZ	begin_msgZoutStrZoutFs   &&&&    r   run_on_fileZCmdLineChecker.run_on_fileQ  s     V..01?LL%Eu%1F:	tI tC#i.()*+
w4v=>?@'')?]]3'F?$D^::D%D

6

r   )r   r   r   )NN)r<   r;   r<   r	   )__name__Z
__module__Z__qualname__Z__firstlineno____doc__Z_DOC_ERRORSr   r$   r%   r)   r&   Zstaticmethodr+   r'   r9   r(   r>   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r   r   ]   sh      W%K  
 
,6X!t=~> IKr   r   c            	     s   ^ RI Hp  V ! 4       pVP                  RRRRRR7       VP                  RR	R
RRRR7       VP                  RRRRRR7       VP                  4       w  r#\	        V4      ^8  d   \        R4      h\	        V4      ^8  d   \        R4      h\        VP                  4      p\        4       pVP                  V4       VP                  V^ ,          VP                  VP                  4       R# )zRun the command-line spellchecker as a script.
This function allows the spellchecker to be invoked from the command-line
to check spelling in a file.
)OptionParserz-oz--outputr<   ZFILEzwrite changes into FILE)destmetavarr8   z-lz--langlangZTAGZen_USzuse language idenfified by TAG)rB   rC   Zdefaultr8   z-ez
--encodingr=   ZENCz!file is unicode with encoding ENCzMust name a file to checkzCan only check a single fileN)ZoptparserA   Z
add_optionZ
parse_argsr:   Z
ValueErrorr    rD   r   r$   r>   r<   r=   )rA   ZopZoptsZargsr"   Zcmdlns         r   _run_as_scriptrE   s  s     &	BMMjy&?X   MM-   MM0   ==?LT
4y1}455
4y1}788		"DE	d	d1gt||TXX6r   Z__main__)r   r*   )r@   r   Zenchant.checkerr    r
   r   r   r   r   r   r   rE   r?   ) r   r   <module>rF      s   <  (
 iZ	:Zj
Jj
J
J
J
I
 ;9<:SI SIl%7P z r   