
    g	                        S SK Jr  S SKrS SKJr  S SKJr  S SKJr  S SKJr  S SK	J
r
  S SK	Jr  S S	K	Jr  S S
K	Jr  SSKJr  SSKJr   S     SS jjrSS jr      SS jrSS jrg)    )annotationsN)exists)join)splitext)
check_call)Dict)List)Mapping)Optional   is_posix)CommandErrorc                    Uc  [         R                  OUn [        U5      n[        X0/5        g! [         a  n[        SU< S35      UeSnAff = f)a  
Opens the given file in a text editor. If the environment variable
``EDITOR`` is set, this is taken as preference.

Otherwise, a list of commonly installed editors is tried.

If no editor matches, an :py:exc:`OSError` is raised.

:param filename: The filename to open. Will be passed  verbatim to the
    editor command.
:param environ: An optional drop-in replacement for ``os.environ``. Used
    mainly for testing.
NzError executing editor ())osenviron_find_editorr   	Exceptionr   )filenamer   enveditorexcs        [/Users/Alptekin/Desktop/izin_takip/venv/lib/python3.13/site-packages/alembic/util/editor.pyopen_in_editorr      sP       "**WCLc"F%& LCABKLs   / 
AA

Ac                   [        5       n[        S5       HK  u  p#X0;   d  M  X   n[        U5      (       a  Us  $ [        R                  U;  d  M:  UR                  X$5        MM     U H  n[        XP5      nUc  M  Us  $    [        S5      e)N)EDITORVISUALzSNo suitable editor found. Please set the "EDITOR" or "VISUAL" environment variables)_default_editors	enumerater   r   sepinsert_find_executableOSError)r   
candidatesivaruser_choice	candidatepaths          r   r   r   )   s    !#J01>!,Kk""""vv[(!!!1 2  		3K   	5     c                    [         (       d  [        U 5      S   S:w  a  U S-  n UR                  SS5      R                  [        R
                  5       H"  n[        X 5      n[        U5      (       d  M   Us  $    g )Nr   z.exePATH )r   r   getsplitr   pathsepr   r   )r)   r   r*   values       r   r#   r#   =   se    
 8+A.&8V	FB'--bjj9T%%==L : r+   c                 (    [         (       a  / SQ$ / SQ$ )N)zsensible-editorr   nanovimcode)zcode.exeznotepad++.exeznotepad.exer    r+   r   r   r   K   s     xCC;;r+   )N)r   strr   zOptional[Dict[str, str]]returnNone)r   Mapping[str, str]r9   r8   )r)   r8   r   r;   r9   zOptional[str])r9   z	List[str])
__future__r   r   os.pathr   r   r   
subprocessr   typingr   r	   r
   r   compatr   r   r   r   r   r#   r   r7   r+   r   <module>rA      sv    " 	    !       8<LL4L	L0(.<r+   