
    Ng                     l    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dS ))PdfUnspHandler    N	pypdfium2c                   B    e Zd ZdZd Zd Zd	dZd Zed             Z	dS )
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 | _        d S N)handlers_configselfs    Z/var/www/html/ai-engine/env/lib/python3.11/site-packages/pypdfium2/_helpers/unsupported.py__init__zPdfUnspHandler.__init__   s        c                 T    | j                                         D ]} ||           d S r   )r   values)r   _typehandlers       r   __call__zPdfUnspHandler.__call__   s8    }++-- 	 	GGDMMMM	 	r   Tc                    t          j        d          | _        t          j        | j        d|            t          j        | j                   t          j        | j                   |rt          j
        | j        d<   dS dS )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!   s}      .q999dl,DdKKK.t|<<<
### 	?'5'>DM)$$$	? 	?r   c                 V    t          | j                   t          | j                   d S r   )idr   r	   r
   s    r   r!   zPdfUnspHandler._keep4   s(    
4=
4<r   c                 z    t                               dt          j                            |                       d S )NzUnsupported PDF feature: )
lib_loggerwarningr   UnsupportedInfoToStrget)r   s    r   r"   zPdfUnspHandler._default9   s7    `x7T7X7XY]7^7^``aaaaar   N)T)
__name__
__module____qualname____doc__r   r   r$   r!   staticmethodr"    r   r   r   r      s           
  
? ? ? ?&  
 b b \b b br   r   )__all__r   loggingpypdfium2.rawrawr   pypdfium2.internalinternalr   	getLoggerr(   r   r1   r   r   <module>r9      s                   % % % % % %W{++
-b -b -b -b -b -b -b -b -b -br   