
     h$
                         d dl Z d dlZd dlmZ d dlZd dlmZ d dlmZm	Z	 d dl
mZ d dlmZ d dlmZ  G d d	e j                  Zd
ZdefdZed             ZdZdS )    N)contextmanager)logger)	LogConfigStdLogOutput)misc)LayoutError)SigningErrorc                       e Zd ZdefdZdS )NoStackTraceFormatterreturnc                     dS )N  )selfeis     O/var/www/html/Sam_Eipo/venv/lib/python3.11/site-packages/pyhanko/cli/runtime.pyformatExceptionz%NoStackTraceFormatter.formatException   s    r    N)__name__
__module____qualname__strr   r   r   r   r   r      s/        S      r   r   z4%(asctime)s - %(name)s - %(levelname)s - %(message)sverbosec                 v   |                                  D ]"\  }}t          j        |          }|                    |j                   t          |j        t                    rxt          t          j        k    rt          j	        t          j                  }nt          j	                    }|rt          j        t                    }nGt          t                    }n2t          j        |j                  }t          j        t                    }|                    |           |                    |           $d S )N)itemslogging	getLoggersetLevellevel
isinstanceoutputr   STDOUTStreamHandlersysstdout	FormatterLOG_FORMAT_STRINGr   FileHandlersetFormatter
addHandler)log_configsr   module
log_config
cur_loggerhandler	formatters          r   logging_setupr1      s   )//11 ' '
&v..
J,---j'66 	=|222!/
;;!/11  E#-.?@@		12CDD		)**;<<G)*;<<IY'''g&&&&'' 'r   c               #     K   d x} }	 d V  n# t           j        $ r  t          j        $ r}|}d|j         } Y d }~nd }~wt          j        $ r}|}d|j         } Y d }~n}d }~wt          j        $ r}|}d|j         } Y d }~nZd }~wt          $ r}|}d|j         } Y d }~n<d }~wt          $ r}|}d|j         } Y d }~nd }~wt          $ r}|}d} Y d }~nd }~ww xY w|*t          j        | |           t          j        |           d S )NzcFailed to read PDF file in strict mode; rerun with --no-strict-syntax to try again.
Error message: zFailed to read PDF file: zFailed to write PDF file: z*Error raised while producing signed file: z/Error raised while producing signature layout: zGeneric processing error.)exc_info)clickClickExceptionr   PdfStrictReadErrormsgPdfReadErrorPdfWriteErrorr	   r   	Exceptionr   error)r7   	exceptiones      r   pyhanko_exception_managerr>   .   s     C)*   " 
 
 
	&e& & 	
  2 2 2	1!%11 3 3 3	21522 C C C	B15BB H H H	GGG * * *	)* S9----"3''' sN    C<CAC1BCB  C-B>>CCCzpyhanko.yml)r   r$   
contextlibr   r4   pyhanko.cli.utilsr   pyhanko.config.loggingr   r   pyhanko.pdf_utilsr   pyhanko.pdf_utils.layoutr   pyhanko.sign.generalr	   r&   r   r'   boolr1   r>   DEFAULT_CONFIG_FILEr   r   r   <module>rG      s    



 % % % % % %  $ $ $ $ $ $ : : : : : : : : " " " " " " 0 0 0 0 0 0 - - - - - -    G-   
 K ' ' ' ' '0 ( ( (D $   r   