
    Wwg$
                         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y)    N)contextmanager)logger)	LogConfigStdLogOutput)misc)LayoutError)SigningErrorc                       e Zd ZdefdZy)NoStackTraceFormatterreturnc                      y)N  )selfeis     J/var/www/horilla/myenv/lib/python3.12/site-packages/pyhanko/cli/runtime.pyformatExceptionz%NoStackTraceFormatter.formatException   s        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   | j                         D ]%  \  }}t        j                  |      }|j                  |j                         t        |j                  t              r{t        t        j                  k(  r$t        j                  t        j                        }nt        j                         }|rt        j                  t              }nHt        t              }n8t        j                  |j                        }t        j                  t              }|j!                  |       |j#                  |       ( y )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 '
&&v.
J,,-j''6|222!//

;!//1 #--.?@	12CD	))**;*;<G))*;<IY'g&''r   c               #   h  K   d x} }	 d  |,t        j                  | |       t        j                  |       y # t         j                  $ r  t        j                  $ r}|}d|j                   } Y d }~kd }~wt        j
                  $ r}|}d|j                   } Y d }~d }~wt        j                  $ r}|}d|j                   } Y d }~d }~wt        $ r}|}d|j                   } Y d }~d }~wt        $ r}|}d|j                   } Y d }~d }~wt        $ r}|}d} Y d }~d }~ww xY ww)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)*4 S9-""3'' 3  "" 
	eeW& 	
  2	)!%%1 3	*155'2 C	:155'B H	?wG *	)*s   D2; /D2&D/!A72D27D/B#D2#D/9C
D2D/C1,D21D/=DD2D/ D*$D2*D//D2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      sd     
 %  $ : " 0 -G-- 
 K ' '0 ( (D $ r   