文件操作 - named.cpython-311.pyc
返回文件管理
返回主菜单
删除本文件
文件: /usr/lib/python3/dist-packages/stevedore/__pycache__/named.cpython-311.pyc
编辑文件内容
� ��OcB � �V � d dl Z ddlmZ e j e� � Z G d� de� � ZdS )� N� )�ExtensionManagerc �x � � e Zd ZdZddi ddddddf d�Ze dd�� � Z d � fd � Z� fd �Z� fd�Z � xZ S )�NamedExtensionManageran 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 � � | � |||||�� � | � |||| � � }t |� � t d� |D � � � � z | _ | j rJ| r | | j � � n7|r5t � dd� | j � � z � � | � |� � d S )N)� name_order�propagate_map_exceptions�on_load_failure_callbackc � � g | ] }|j �� S r ��name��.0�es �1/usr/lib/python3/dist-packages/stevedore/named.py� <listcomp>z2NamedExtensionManager.__init__.<locals>.<listcomp>R s � �/K�/K�/K�1���/K�/K�/K� zCould not load %sz, )�_init_attributes� _load_plugins�set�_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� extensionss r �__init__zNamedExtensionManager.__init__C s� � � ����u��%=�%=� � ?� ?� ?� �'�'��(3�(3�(;�=� =� � "�%�j�j�3�/K�/K� �/K�/K�/K�+L�+L�L����� <�.� <�/�/��0C�D�D�D�D�+� <����/� �I�I�d�&9�:�:�;� <� <� <����:�&�&�&�&�&r �TESTINGc � � | � | � � }d� |D � � }|� ||||�� � |� |� � |S )a 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 c � � g | ] }|j �� S r r r s r r z<NamedExtensionManager.make_test_instance.<locals>.<listcomp>| s � �,�,�,�A���,�,�,r �r r )�__new__r r )�clsr&