+
      xi  c                  s    R t ^ RIHt ^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
Ht ^ RItRP                  4       t ! R R]P                  4      tR R	 ltR
 R lt ! R R4      tR# )z+Utility functions for command-line scripts.)annotationsN)a2b_hex)AnyTextIOz
%s (python-pskc) %s
Written by Arthur de Jong.

Copyright (C) 2014-2025 Arthur de Jong
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
c                  sF   a  ] tR t^+tRtRR V 3R llltRR R lltRtV ;t# )	VersionActionz!Define --version argparse action.c               s(    V ^8  d   QhRRRRRRRR/# )   option_stringsz	list[str]deststrhelpreturnNone Zformat   "6/usr/lib/python3.14/site-packages/pskc/scripts/util.py__annotate__VersionAction.__annotate__.   s2     
 
!
 
 	

 

    c                	sp   < \         \        V `  V\        P                  \        P                  ^ VR7       R# )i    )r   r   ZdefaultZnargsr	   N)Zsuperr   __init__argparseZSUPPRESS)selfr   r   r	   	__class__s   &&&&r   r   ZVersionAction.__init__.   s4     	mT+)""%% 	, 	
r   c          
     s,    V ^8  d   QhRRRRRRRRR	R
/# )r   parserzargparse.ArgumentParser	namespacezargparse.Namespacevaluesr   option_stringz
str | Noner
   r   r   r   r   r   r   r   <   s<     	 	'	 &	 		
 "	 
	r   c                s    \         P                  P                  \        VP                  \
        P                  3,          4       VP                  4        R# )z$Output version information and exit.N)sysstdoutZwriteversion_stringZprogpskcZ__version__Zexit)r   r   r   r   r   s   &&&&&r   __call__ZVersionAction.__call__<   s3     	

6;;8H8H*IIJr   r   )z#output version information and exitN)	__name__
__module____qualname____firstlineno____doc__r   r   __static_attributes__Z__classcell__)r   s   @r   r   r   +   s    +
 
	 	r   r   c                    V ^8  d   QhRRRR/# )r   argumentr   r
   Zbytesr   r   r   r   r   r   H   s     ! !c !e !r   c                s    \         P                  P                  V 4      '       d0   \        V R4      ;_uu_ 4       pVP	                  4       uuRRR4       # \        V 4      #   + '       g   i     R# ; i)z0Get the key from a file or a hex-encoded string.ZrbN)ospathisfileopenreadr   )r(   Zkeyfile   & r   get_keyr/   H   sN    	ww~~h(D!!W<<> "! x   "!!s   A  A1	c               s     V ^8  d   QhRRRR/# )r   r(   r   r
   r   r   r   r   r   r   Q   s      3 3 r   c                s    \         P                  P                  V 4      '       d@   \        V R4      ;_uu_ 4       pVP	                  4       P                  RR4      uuRRR4       # V #   + '       g   i     R# ; i)z,Get the password from a file or as a string.ZrZ
Z N)r)   r*   r+   r,   r-   Zreplace)r(   Zpassfiler.   r   get_passwordr0   Q   sU    	ww~~h(C  H==?**44 !   !  s    A''A8	c                  s>    ] tR t^ZtRtR R ltR R ltR R ltRtR	# )

OutputFilez7Wrapper around output file to also fall back to stdout.c               r'   )r   outputr   r
   r   r   r   r   r   r   OutputFile.__annotate__]   s      s t r   c                	s    Wn         R # r    )r2   )r   r2   s   &&r   r   ZOutputFile.__init__]   s    r   c               s    V ^8  d   QhRR/# )r   r
   r   r   r   r   r   r   r3   `   s      6 r   c                	s    V P                   '       d   \        V P                   R 4      M\        P                  V n        V P                  # )Zw)r2   r,   r   r   file)r   s   &r   	__enter__ZOutputFile.__enter__`   s,    .2kkkDc*szz	yyr   c               r'   )r   argsr   r
   r   r   r   r   r   r   r3   d   s      c d r   c                	s    V P                   '       d   V P                  P                  4        R # V P                  P                  4        R # r    )r2   r4   ZcloseZflush)r   r6   s   &*r   __exit__ZOutputFile.__exit__d   s'    ;;;IIOOIIOOr   )r4   r2   N)	r!   r"   r#   r$   r%   r   r5   r7   r&   r   r   r   r1   r1   Z   s    A r   r1   )r%   Z
__future__r    r   Zos.pathr)   r   Zbinasciir   Ztypingr   r   r   Zlstripr   ZActionr   r/   r0   r1   r   r   r   <module>r8      sV   ( 2 "   
    FH HOO :! r   