
    iW
                     ^    S r SSKJrJrJrJr  SSKJrJr  SSK	J
r
   " S S5      r\" 5       rg)	z
Recipe registry for managing backend recipe providers.

This module provides the registry system for backend recipe providers and
the abstract interface that all backends must implement.
    )AnyDictOptionalSequence   )ExportRecipe
RecipeType)BackendRecipeProviderc            	          ^  \ rS rSrSrSrSrU 4S jrSS jrS\	SS4S	 jr
S
\S\S\S\\   4S jrS\S\\   4S jrS\\   4S jrSrU =r$ )RecipeRegistry   z0Global registry for all backend recipe providersNFc                 ^   > U R                   c  [        TU ]	  U 5      U l         U R                   $ )N)	_instancesuper__new__)cls	__class__s    `/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/executorch/export/recipe_registry.pyr   RecipeRegistry.__new__   s'    == !GOC0CM}}    returnc                 T    [         R                  (       d  0 U l        S[         l        g g )NT)r   _initialized
_providersselfs    r   __init__RecipeRegistry.__init__   s    **@BDO*.N' +r   providerc                 4    XR                   UR                  '   g)z$
Register a backend recipe provider
N)r   backend_name)r   r   s     r    register_backend_recipe_provider/RecipeRegistry.register_backend_recipe_provider%   s     2:--.r   recipe_typebackendkwargsc           	          X R                   ;  a2  [        SU S[        U R                   R                  5       5       35      eU R                   U   R                  " U40 UD6$ )z
Create a recipe for a specific backend.

Args:
    recipe_type: The type of recipe to create
    backend: Backend name
    **kwargs: Recipe-specific parameters

Returns:
    ExportRecipe if supported, None if not supported
	Backend 'z' not available. Available: )r   
ValueErrorlistkeyscreate_recipe)r   r$   r%   r&   s       r   r,   RecipeRegistry.create_recipe+   s`     //)G9$@dooFZFZF\A]@^_  w'55kLVLLr   c                 x    XR                   ;  a  [        SU S35      eU R                   U   R                  5       $ )z{
Get list of recipes supported by a backend.

Args:
    backend: Backend name

Returns:
    List of supported recipe types
r(   z' not available)r   r)   get_supported_recipes)r   r%   s     r   r/   $RecipeRegistry.get_supported_recipes@   s:     //)y	ABBw'==??r   c                 H    [        U R                  R                  5       5      $ )z%
Get list of all registered backends
)r*   r   r+   r   s    r   list_backendsRecipeRegistry.list_backendsN   s     DOO((*++r   )r   )r   N)__name__
__module____qualname____firstlineno____doc__r   r   r   r   r
   r"   r	   strr   r   r   r,   r   r/   r2   __static_attributes____classcell__)r   s   @r   r   r      s    :IL
/:9N :SW :M%M03M?BM	,	M*@S @Xj5I @,x} , ,r   r   N)r8   typingr   r   r   r   reciper   r	   recipe_providerr
   r   recipe_registry r   r   <module>rA      s-    1 0 , 2>, >,D !"r   