
    w;3h                     h    d Z ddlZddlZddlmZ ddlmZ  ej                  d      Z
 G d d      Zy))PdfUnspHandler    N	pypdfium2c                   :    e Zd ZdZd Zd ZddZd Zed        Z	y)	r   a  
    Unsupported feature handler helper class.
    
    Attributes:
        handlers (dict[str, typing.Callable]):
            A dictionary of named handler functions to be called with an unsupported code (:attr:`FPDF_UNSP_*`) when PDFium detects an unsupported feature.
    c                      i | _         d | _        y N)handlers_configselfs    ^/var/www/html/audio-gradio/venv/lib/python3.12/site-packages/pypdfium2/_helpers/unsupported.py__init__zPdfUnspHandler.__init__   s        c                 R    | j                   j                         D ]
  } ||        y r   )r   values)r   _typehandlers       r   __call__zPdfUnspHandler.__call__   s%    }}++- 	GDM	r   c                 8   t        j                  d      | _        t        j                  | j                  d|        t        j
                  | j                         t        j                  | j                         |rt        j                  | j                  d<   yy)a  
        Attach the handler to PDFium, and register an exit function to keep the object alive for the rest of the session.
        
        Parameters:
            add_default (bool):
                If True, add a default callback that will log unsupported features as warning.
           )versionFSDK_UnSupport_HandlerdefaultN)pdfium_cUNSUPPORT_INFOr	   pdfium_iset_callbackFSDK_SetUnSpObjProcessHandleratexitregister_keepr   _defaultr   )r   add_defaults     r   setupzPdfUnspHandler.setup!   sk      ..q9dll,DdK..t||<

#'5'>'>DMM)$ r   c                 X    t        | j                         t        | j                         y r   )idr   r	   r
   s    r   r!   zPdfUnspHandler._keep4   s    
4==
4<<r   c                 n    t         j                  dt        j                  j	                  |               y )NzUnsupported PDF feature: )
lib_loggerwarningr   UnsupportedInfoToStrget)r   s    r   r"   zPdfUnspHandler._default9   s+    6x7T7T7X7XY]7^6_`ar   N)T)
__name__
__module____qualname____doc__r   r   r$   r!   staticmethodr"    r   r   r   r      s1    

?&
 b br   r   )__all__r   loggingpypdfium2.rawrawr   pypdfium2.internalinternalr   	getLoggerr(   r   r1   r   r   <module>r9      s6         %W{+
-b -br   