
    iJ                     ^   U d Z g dZddlZddlmZ ddlmZ ddlmZm	Z	 ddl
mZ dd	lmZmZ dd
lmZmZ ddlmZmZ ddlmZmZ  ej0                  d      Zeez  ez  ez  Zej4                  ed<   e	Zej4                  ed<   eez  Zej4                  ed<    G d deeef         Z  e        Z!y)z2Implement request processors used by engine-types.)	OfflineParamTypesOnlineCurrenciesParamsOnlineDictParamsOnlineParamTypesOnlineParamsOnlineUrlSearchParams
PROCESSORS
ParamTypesRequestParams    N)logger)engines   )EngineProcessorr
   )OfflineProcessor)OnlineProcessorr   )OnlineDictionaryProcessorr   )OnlineCurrencyProcessorr   )OnlineUrlSearchProcessorr   zsearch.processorsr   r   r	   c            
           e Zd ZU dZej
                  eej
                  eej
                  eej
                  ee	j
                  e	iZ
eeee   f   ed<   deeeej$                  f      fdZdededefdZy	)
ProcessorMapzoClass to manage :py:obj:`EngineProcessor` instances in a key/value map
    (instances stored by *engine-name*).processor_typesengine_listc                 ~   |D ]  }|d   }|j                  dd      du rt        j                  j                  |      }|t        j                  d|       Ut	        |dd      }| j
                  j                  |      }|t        j                  d	|        ||      }|j                  | j                          y)
zAInitialize all engines and registers a processor for each engine.nameinactiveFTNz$Engine of name '%s' does not exists.engine_typeonlinez)Engine '%s' is of unknown engine_type: %s)	getr   r   warninggetattrr   error
initializeregister_processor)selfr   eng_settingseng_nameeng_objeng_typeproc_clseng_procs           1/root/searxng/searx/search/processors/__init__.pyinitzProcessorMap.init/   s     ( 	9L(0H
E2d:oo))(3GExPwx@H++//9HH(S  (H 7 78'	9    r*   eng_proc_okreturnc                     |r|| |j                   j                  <   |S t        j                  d|j                   j                         |S )a  Register the :py:obj:`EngineProcessor`.

        This method is usually passed as a callback to the initialization of the
        :py:obj:`EngineProcessor`.

        The value (true/false) passed in ``eng_proc_ok`` indicates whether the
        initialization of the :py:obj:`EngineProcessor` was successful; if this
        is not the case, the processor is not registered.
        z1can't register engine processor: %s (init failed))enginer   r   r!   )r$   r*   r.   s      r+   r#   zProcessorMap.register_processorG   sD     )1D%%&
  LLLhooNbNbcr-   N)__name__
__module____qualname____doc__r   r   r   r   r   r   r   dictstrtyper   __annotations__listtAnyr,   boolr#    r-   r+   r   r   #   s    , 	##_$$&6!--/H++-D ,,.F9OT#tO445 9T#quu*%5 6 90?  RV r-   r   )"r5   __all__typingr;   searxr   r   abstractr   r
   offliner   r   r   r   online_dictionaryr   r   online_currencyr   r   online_url_searchr   r   getChildr   	TypeAliasr9   r   r	   r6   r7   r   r   r>   r-   r+   <module>rI      s    8
    4 % 1 J L N	,	- ,/? ?BX X[p p !++ p!. 1;; .+.>>
AKK >54_,- 5p ^
r-   