File manager - Edit - /opt/imh-python/lib/python2.7/site-packages/stevedore/named.pyc
Back
� ��Wc @ sE d d l Z d d l m Z e j e � Z d e f d � � YZ d S( i����Ni ( t ExtensionManagert NamedExtensionManagerc B sq e Z d Z e d i e e d d e e d � Z e d e d e d � � Z e e d d � Z d � Z d � Z RS( sm 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 a 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 c C s� | j | | d | d | d | �| j | | | | � } t | � t g | D] } | j ^ qM � | _ | j r� | r� | | j � q� | r� t j d d j | j � � q� n | j | � d S( Nt name_ordert propagate_map_exceptionst on_load_failure_callbacks Could not load %ss , ( t _init_attributest _load_pluginst sett namet _missing_namest LOGt warningt joint _init_plugins( t selft namespacet namest invoke_on_loadt invoke_argst invoke_kwdsR R R t on_missing_entrypoints_callbackt verify_requirementst warn_on_missing_entrypointt extensionst e( ( s2 /tmp/pip-build-T5Mfvc/stevedore/stevedore/named.pyt __init__7 s / t TESTINGc C sX | j | � } g | D] } | j ^ q } | j | | d | d | �| j | � | S( s 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 a 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 ( t __new__R R R ( t clsR R R R R t oR R ( ( s2 /tmp/pip-build-T5Mfvc/stevedore/stevedore/named.pyt make_test_instanceO s c C sD t t | � j | d | d | �| | _ t � | _ | | _ d S( NR R ( t superR R t _namesR R t _name_order( R R R R R R ( ( s2 /tmp/pip-build-T5Mfvc/stevedore/stevedore/named.pyR w s c C sX t t | � j | � | j rT g | j D] } | | j k r) | | ^ q) | _ n d S( N( R R R R! R R R ( R R t n( ( s2 /tmp/pip-build-T5Mfvc/stevedore/stevedore/named.pyR � s c C s8 | j | j k r d St t | � j | | | | | � S( N( R R t NoneR R t _load_one_plugin( R t epR R R R ( ( s2 /tmp/pip-build-T5Mfvc/stevedore/stevedore/named.pyR$ � s ( N( t __name__t __module__t __doc__t FalseR# t TrueR t classmethodR R R R$ ( ( ( s2 /tmp/pip-build-T5Mfvc/stevedore/stevedore/named.pyR s"