Repository URL to install this package:
| 
      
        
        
        Version: 
        
         
          
          3.4.52  ▾
        
         | 
ó
¹EYc           @   s@   d  d l  m Z m Z d  d l m Z d e f d     YZ d S(   i   (   t	   NoMatchest   MultipleMatches(   t   NamedExtensionManagert
   DriverManagerc           B   st   e  Z d  Z e d i  d	 e e d  Z e d    Z e	 d e d	 e d   Z
 d   Z d   Z e
 d    Z RS(
   s   Load a single plugin with a given name from the namespace.
    :param namespace: The namespace for the entry points.
    :type namespace: str
    :param name: The name of the driver to load.
    :type name: 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 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
    :type warn_on_missing_entrypoint: bool
    c	   	      C   sY   | p |  j  } t t |   j d | d | g d | d | d | d | d | d |  d  S(	   Nt	   namespacet   namest   invoke_on_loadt   invoke_argst   invoke_kwdst   on_load_failure_callbackt   verify_requirementst   warn_on_missing_entrypoint(   t   _default_on_load_failuret   superR   t   __init__(	   t   selfR   t   nameR   R   R   R	   R
   R   (    (    sE   /home/tvault/.virtenv/lib/python2.7/site-packages/stevedore/driver.pyR   .   s    		c         C   s     d  S(   N(    (   t
   drivermanagert   ept   err(    (    sE   /home/tvault/.virtenv/lib/python2.7/site-packages/stevedore/driver.pyR   @   s    t   TESTINGc      
   C   s7   t  t |   j | g d | d | d | d | } | S(   só  Construct a test DriverManager
        Test instances are passed a list of extensions to work from rather
        than loading them from entry points.
        :param extension: Pre-configured Extension instance
        :type extension: :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   t   propagate_map_exceptionsR	   R
   (   R
   R   t   make_test_instance(   t   clst	   extensionR   R   R	   R
   t   o(    (    sE   /home/tvault/.virtenv/lib/python2.7/site-packages/stevedore/driver.pyR   D   s     	c         C   s   t  t |   j |  |  j sH |  j d } t d |  j | f   n  t |  j  d k r d j d   |  j D  } t	 d |  j | f   n  d  S(   Ni    s"   No %r driver found, looking for %ri   t   ,c         s   s   |  ] } | j  Vq d  S(   N(   t   entry_point_target(   t   .0t   e(    (    sE   /home/tvault/.virtenv/lib/python2.7/site-packages/stevedore/driver.pys	   <genexpr>s   s   s   Multiple %r drivers found: %s(
   R
   R   t
   _init_pluginst
   extensionst   _namesR    R   t   lent   joinR   (   R   R   R   t   discovered_drivers(    (    sE   /home/tvault/.virtenv/lib/python2.7/site-packages/stevedore/driver.pyR   k   s    	
c         O   s'   |  j  | | |  } | r# | d Sd S(   sA  Invokes func() for the single loaded extension.
        The signature for func() should be::
            def func(ext, *args, **kwds):
                pass
        The first argument to func(), 'ext', is the
        :class:`~stevedore.extension.Extension` instance.
        Exceptions raised from within func() are logged and ignored.
        :param func: Callable to invoke for each extension.
        :param args: Variable arguments to pass to func()
        :param kwds: Keyword arguments to pass to func()
        :returns: List of values returned from func()
        i    N(   t   map(   R   t   funct   argst   kwdst   results(    (    sE   /home/tvault/.virtenv/lib/python2.7/site-packages/stevedore/driver.pyt   __call__y   s    c         C   s$   |  j  d } | j r | j S| j S(   s7   Returns the driver being used by this manager.
        i    (   R   t   objt   plugin(   R   t   ext(    (    sE   /home/tvault/.virtenv/lib/python2.7/site-packages/stevedore/driver.pyt   driver   s    
(    N(   t   __name__t
   __module__t   __doc__t   Falset   Nonet   TrueR   t   staticmethodR   t   classmethodR   R   R)   t   propertyR-   (    (    (    sE   /home/tvault/.virtenv/lib/python2.7/site-packages/stevedore/driver.pyR      s   	#		N(   t	   exceptionR    R   t   namedR   R   (    (    (    sE   /home/tvault/.virtenv/lib/python2.7/site-packages/stevedore/driver.pyt   <module>
   s