+
   ʡ                      ^ RI Ht ^ RIt^ RIt^ RIt^ RIHtHtHt ^ RI	H
t
Ht ] ! R R]4      4       tR R ltR	 R
 ltR# )    )annotationsN)StrEnumautounique)PathPurePathc                      ] tR t^
t]! 4       t]! 4       t]! 4       t]! 4       t]! 4       t	]
R R l4       t]
R R l4       t]
R R l4       tR R ltR	 R
 ltR R ltRtR# )Shellc                   V ^8  d   QhRR/#    returnShell | None )formats   "7/usr/lib/python3.14/site-packages/vapoursynth/_shell.py__annotate__Shell.__annotate__   s     - - -    c                   \         P                  ! R4      '       d   V P                  # \         P                  ! R4      '       d   V P                  # \         P                  ! R4      '       d   V P                  # \         P                  ! R4      '       d   V P
                  # \         P                  ! R4      ;p'       d   V P                  V4      # V P                  4       # )a  Determine the user's current shell from the environment.

First checks shell-specific environment variables which are set by the respective shells. This takes priority
over `SHELL` because on Unix, `SHELL` refers to the user's login shell, not the currently running shell.

Falls back to parsing the `SHELL` environment variable if no shell-specific variables are found.

Returns `None` if the shell cannot be determined.
FISH_VERSIONBASH_VERSIONZSH_VERSIONKSH_VERSIONSHELL)osgetenvFISHBASHZSHKSHfrom_shell_pathfrom_parent_process)cls	env_shells   & r   from_envShell.from_env   s     99^$$88OYY~&&88OYY}%%77NYY}%%77N))G,,Y,&&y11**,,r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   +   s      L r   c                   \         P                  R8X  d   \        P                  ! 4       p \	        RV R24      P                  4       pV P                  V4      ;p'       d   V#   \	        RV R24      P                  4       P                  4       pV P                  V4      ;p'       d   V#  R# R#   \         d     LYi ; i  \         d     R# i ; i)aU  Attempt to determine the shell from the parent process.

This is a fallback method for when environment variables don't provide enough information about the current
shell. It looks at the parent process to try to identify which shell is running.

This method currently only works on Unix-like systems. On other platforms, it returns `None`.
linuxz/proc/z/exez/commN)
sysplatformr   getppidr   readlinkr"   	Exception	read_textstrip)r$   ppidexe_pathshellcomms   &    r   r#   Shell.from_parent_process*   s     <<7"::<D&d 34==?//9959 L :
fTF%01;;=CCE//5555 L 6
     s$   7B1 &AC 1B?>B?CCc                    V ^8  d   QhRRRR/# )r   pathstrr   r   r   )r   s   "r   r   r   G   s      3 < r   c                   \        V4      P                  ;;R8X  d   M
;R8X  d   M M  V P                  # ;R8X  d    V P                  # ;R8X  d    V P                  # ;R8X  d    V P
                  # R8X  d   V P                  #  R# )z:Parse a shell from a path to the executable for the shell.bashshzshfishcshkshN)r   stemr   r    r   CSHr!   )r$   r8   s   &&r   r"   Shell.from_shell_pathF   sY     tn!!$xxwwxxwwwwr   c                   V ^8  d   QhRR/# )r   r   z
list[Path]r   )r   s   "r   r   r   W   s     0: 0:Z 0:r   c                D  a \         P                  ! 4       oT ;\        P                  8X  d+     \	        V3R lR 4       SR,          4      pVSR,          .# ;\        P
                  8X  d     SR,          SR,          .# ;\        P                  8X  d     \        P                  ! R4      pV'       d,   \        V4      R,          pVP                  4       '       d   V.# SR,          pVP                  4       '       d   V.# V'       d   \        V4      R,          .# SR,          .# ;\        P                  8X  d>     \        P                  ! R4      ;p'       d   \        V4      R	,          .# SR
,          .# \        P                  8X  d    SR,          SR,          .# R# )z7Return the configuration files that should be modified.c              3  t   <"   T F-  pSV,          P                  4       '       g   K"  SV,          x  K/  	  R # 5i)N)is_file).0rchomes   & r   	<genexpr>,Shell.configuration_files.<locals>.<genexpr>d   s-     o)U2Z^acZcYlYlYnYTBYY)Us   88.bash_profile.profilez.bashrcz.kshrcZDOTDIRz.zshenvXDG_CONFIG_HOMEzfish/config.fishz.config/fish/config.fishz.cshrcz.loginN)rM   z.bash_loginrN   )r   rJ   r
   r   nextr!   r    r   r   rG   r   rB   )selfloginzdotdirzshenvxdg_config_homerJ   s   &    @r   configuration_filesShell.configuration_filesW   sX   yy{ o)Uo?* ti/00iz)4(?;;y))I.!']Y6F~~'' &x	)>>##"8O MI566 9,-- ')ii0A&BB?B 14FFGG #==>>Vx99 r   c                    V ^8  d   QhRRRR/# )r   r8   r9   r   r   )r   s   "r   r   r      s     8 8 8 8r   c                   T ;;\         P                  8X  d   M.;\         P                  8X  d   M;\         P                  8X  d   M M  RV R2# ;\         P                  8X  d    RV R2# \         P
                  8X  d   RV R2# R# )zCReturn the command necessary to export VSSCRIPT_PATH in this shell.zexport VSSCRIPT_PATH=""zset -gx VSSCRIPT_PATH "zsetenv VSSCRIPT_PATH "N)r
   r   r    r!   r   rB   )rR   r8   s   &&r   export_pathShell.export_path   se    3ieii)%))3/vQ770a88/vQ77 r   c                   V ^8  d   QhRR/# )r   r   
re.Patternr   )r   s   "r   r   r      s     F Fz Fr   c                n   T ;;\         P                  8X  d   M.;\         P                  8X  d   M;\         P                  8X  d   M M  \        P
                  ! R4      # ;\         P                  8X  d    \        P
                  ! R4      # \         P                  8X  d   \        P
                  ! R4      # R# )z[Return the regular expression pattern to match existing command in the configuration files.z^export\s+VSSCRIPT_PATH\s*=z(^set\s+(?:-\S+\s+)*VSSCRIPT_PATH(?:\s|$)z^setenv\s+VSSCRIPT_PATH(?:\s|$)N)r
   r   r    r!   recompiler   rB   )rR   s   &r   match_patternShell.match_pattern   sh    3ieii)%))3zz"@AAzz"MNNzz"DEE r   r   N)__name__
__module____qualname____firstlineno__r   r   r   r    rB   r!   classmethodr&   r#   r"   rW   r\   rc   __static_attributes__r   r   r   r
   r
   
   sv    6D6D
&C
&C
&C- -.  6   0:d8F Fr   r
   c               (    V ^8  d   QhRRRRRRRR/# )r   contentsr9   commandpatternr_   r   z
str | Noner   )r   s   "r   r   r      s(     9 9s 9S 9: 9* 9r   c                   V P                  R R7      p. pRpV F  pVP                  4       pVP                  R4      '       d   VP                  V4       K=  W9   d    R# VP	                  V4      '       d'   V'       g   VP                  VR,           4       R pK  K  VP                  V4       K  	  V'       d   RP                  V4      # V  RV R2# )T)keependsF#N
 z
# VapourSynth
)
splitlinesr1   
startswithappendmatchjoin)rl   rm   rn   lines	new_linesreplacedlinestrippeds   &&&     r   _update_contentsr~      s    .EIH::<s##T"==""  40  T" " wwy!!,WIR88r   c                    V ^8  d   QhRRRR/# )r   r8   r9   r   Noner   )r   s   "r   r   r      s     *O *Os *Ot *Or   c                   \         P                  4       pV'       g   \        P                  ! R 4       VP	                  4       pVP                  V 4      pVP                  4       pRpV F  pVP                  4       '       dL    VP                  4       p\        XW44      pV'       g   K@   VP                  V4       \        RV 24       RpKd  VP                  P                  RRR7        VP                  RV R24       \        R	V 24       RpK  	  V'       d   \        R
4       R# \        RVP                   R24       R#   \         d    \        P                  ! RT 24        Li ; i  \         d    \        P                  ! RT 24        Li ; i  \         d    \        P                  ! RT 24        Li ; i)z)The current shell could not be determinedFz#Failed to read configuration file: z$Failed to write configuration file: zUpdated configuration file: T)parentsexist_okz# VapourSynth
rr   zCreated configuration file: z#Restart your shell to apply changeszThe z+ configuration files are already up-to-dateN)r
   r&   r+   exitrW   r\   rc   rG   r0   r/   r~   
write_textprintparentmkdirvalue)	r8   r4   filesrm   rn   updatedfilerl   new_contentss	   &        r   update_shellr      s   NNE<=%%'E%G!!#GG<<>>G>>+ ,HgGLH- 078GKKdT:H/'" => 078G7 : 34U[[M!LMN9  G>tfEFG  H?vFGH  H?vFGHs6   E)E-*F$E*)E*-$FF$F>=F>)
__future__r   r   ra   r+   enumr   r   r   pathlibr   r   r
   r~   r   r   r   r   <module>r      sG    " 	 	 
 & & " PFG PF PFf98*Or   