
    z	i                     R    S SK r SSKJr  \ R                  " \5      r " S S\5      rg)    N   )ExtensionManagerc            	          ^  \ rS rSrSrSS0 SSSSSS4	S jr\    SS j5       r   SU 4S	 jjrU 4S
 jr	U 4S jr
SrU =r$ )NamedExtensionManager   a  Loads only the named extensions.

This is useful for explicitly enabling extensions in a
configuration file, for example.

:param namespace: The namespace for the entry points.
:type namespace: str
:param names: The names of the extensions to load.
:type names: list(str)
:param invoke_on_load: Boolean controlling whether to invoke the
    object returned by the entry point after the driver is loaded.
:type invoke_on_load: bool
:param invoke_args: Positional arguments to pass when invoking
    the object returned by the entry point. Only used if invoke_on_load
    is True.
:type invoke_args: tuple
:param invoke_kwds: Named arguments to pass when invoking
    the object returned by the entry point. Only used if invoke_on_load
    is True.
:type invoke_kwds: dict
:param name_order: If true, sort the loaded extensions to match the
    order used in ``names``.
:type name_order: bool
:param propagate_map_exceptions: Boolean controlling whether exceptions
    are propagated up through the map call or whether they are logged and
    then ignored
:type propagate_map_exceptions: bool
:param on_load_failure_callback: Callback function that will be called when
    an entrypoint can not be loaded. The arguments that will be provided
    when this is called (when an entrypoint fails to load) are
    (manager, entrypoint, exception)
:type on_load_failure_callback: function
:param on_missing_entrypoints_callback: Callback function that will be
    called when one or more names cannot be found. The provided argument
    will be a subset of the 'names' parameter.
:type on_missing_entrypoints_callback: function
:param verify_requirements: Use setuptools to enforce the
    dependencies of the plugin(s) being loaded. Defaults to False.
:type verify_requirements: bool
:param warn_on_missing_entrypoint: Flag to control whether failing
    to load a plugin is reported via a log mess. Only applies if
    on_missing_entrypoints_callback is None.
:type warn_on_missing_entrypoint: bool

F NTc                    U R                  XUUUS9  U R                  UUUU
5      n[        U5      U Vs1 s H  oR                  iM     sn-
  U l        U R                  (       aR  U	(       a  U	" U R                  5        O8U(       a1  [
        R                  SSR                  U R                  5      -  5        U R                  U5        g s  snf )N)
name_orderpropagate_map_exceptionson_load_failure_callbackzCould not load %sz, )	_init_attributes_load_pluginssetname_missing_namesLOGwarningjoin_init_plugins)self	namespacenamesinvoke_on_loadinvoke_argsinvoke_kwdsr
   r   r   on_missing_entrypoints_callbackverify_requirementswarn_on_missing_entrypoint
extensionses                 I/home/james-whalen/.local/lib/python3.13/site-packages/stevedore/named.py__init__NamedExtensionManager.__init__C   s     	%=%= 	 	? ''(3(3(;=
 "%jJ+GJqFFJ+GG./0C0CD+/ IId&9&9:; <:& ,Hs   C	c                     U R                  U 5      nU Vs/ s H  owR                  PM     nnUR                  X(UUS9  UR                  U5        U$ s  snf )aQ  Construct a test NamedExtensionManager

Test instances are passed a list of extensions to use rather than
loading them from entry points.

:param extensions: Pre-configured Extension instances
:type extensions: list of :class:`~stevedore.extension.Extension`
:param namespace: The namespace for the manager; used only for
    identification since the extensions are passed in.
:type namespace: str
:param propagate_map_exceptions: Boolean controlling whether exceptions
    are propagated up through the map call or whether they are logged
    and then ignored
:type propagate_map_exceptions: bool
:param on_load_failure_callback: Callback function that will
    be called when an entrypoint can not be loaded. The
    arguments that will be provided when this is called (when
    an entrypoint fails to load) are (manager, entrypoint,
    exception)
:type on_load_failure_callback: function
:param verify_requirements: Use setuptools to enforce the
    dependencies of the plugin(s) being loaded. Defaults to False.
:type verify_requirements: bool
:return: The manager instance, initialized for testing

r   r   )__new__r   r   r   )	clsr   r   r   r   r   or    r   s	            r!   make_test_instance(NamedExtensionManager.make_test_instance[   s]    @ KK!+,A,	94L4L 	 	N 	

# -s   Ac                 X   > [         TU ]  XUS9  X l        [        5       U l        X0l        g )Nr%   )superr   _namesr   r   _name_order)r   r   r   r
   r   r   	__class__s         r!   r   &NamedExtensionManager._init_attributes   s4     	 %= 	! 	? !e%    c                    > [         TU ]  U5        U R                  (       a6  U R                   Vs/ s H  nX R                  ;  d  M  X   PM     snU l        g g s  snf N)r,   r   r.   r-   r   r   )r   r   nr/   s      r!   r   #NamedExtensionManager._init_plugins   sW    j)04 @1"#+>+>">  'tw @DO @s   AAc                 \   > UR                   U R                  ;  a  g [        TU ]  XX4U5      $ r3   )r   r-   r,   _load_one_plugin)r   epr   r   r   r   r/   s         r!   r7   &NamedExtensionManager._load_one_plugin   s2    
 77$++%w'
 	
r1   )r   r.   r-   r   )TESTINGFNF)FFN)__name__
__module____qualname____firstlineno____doc__r"   classmethodr)   r   r   r7   __static_attributes____classcell__)r/   s   @r!   r   r      sj    ,^ !&22!E*.15%*,0'0 6?4948/4% %N =B2726	&@

 

r1   r   )logging	extensionr   	getLoggerr;   r   r   r   r1   r!   <module>rF      s,     '!K
, K
r1   