當前位置: 首頁>>代碼示例>>Python>>正文


Python pkg_resources.UnknownExtra方法代碼示例

本文整理匯總了Python中pkg_resources.UnknownExtra方法的典型用法代碼示例。如果您正苦於以下問題:Python pkg_resources.UnknownExtra方法的具體用法?Python pkg_resources.UnknownExtra怎麽用?Python pkg_resources.UnknownExtra使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pkg_resources的用法示例。


在下文中一共展示了pkg_resources.UnknownExtra方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testDistroDependsOptions

# 需要導入模塊: import pkg_resources [as 別名]
# 或者: from pkg_resources import UnknownExtra [as 別名]
def testDistroDependsOptions(self):
        d = self.distRequires("""
            Twisted>=1.5
            [docgen]
            ZConfig>=2.0
            docutils>=0.3
            [fastcgi]
            fcgiapp>=0.1""")
        self.checkRequires(d,"Twisted>=1.5")
        self.checkRequires(
            d,"Twisted>=1.5 ZConfig>=2.0 docutils>=0.3".split(), ["docgen"]
        )
        self.checkRequires(
            d,"Twisted>=1.5 fcgiapp>=0.1".split(), ["fastcgi"]
        )
        self.checkRequires(
            d,"Twisted>=1.5 ZConfig>=2.0 docutils>=0.3 fcgiapp>=0.1".split(),
            ["docgen","fastcgi"]
        )
        self.checkRequires(
            d,"Twisted>=1.5 fcgiapp>=0.1 ZConfig>=2.0 docutils>=0.3".split(),
            ["fastcgi", "docgen"]
        )
        self.assertRaises(pkg_resources.UnknownExtra, d.requires, ["foo"]) 
開發者ID:MayOneUS,項目名稱:pledgeservice,代碼行數:26,代碼來源:test_resources.py

示例2: testDistroDependsOptions

# 需要導入模塊: import pkg_resources [as 別名]
# 或者: from pkg_resources import UnknownExtra [as 別名]
def testDistroDependsOptions(self):
        d = self.distRequires("""
            Twisted>=1.5
            [docgen]
            ZConfig>=2.0
            docutils>=0.3
            [fastcgi]
            fcgiapp>=0.1""")
        self.checkRequires(d, "Twisted>=1.5")
        self.checkRequires(
            d, "Twisted>=1.5 ZConfig>=2.0 docutils>=0.3".split(), ["docgen"]
        )
        self.checkRequires(
            d, "Twisted>=1.5 fcgiapp>=0.1".split(), ["fastcgi"]
        )
        self.checkRequires(
            d, "Twisted>=1.5 ZConfig>=2.0 docutils>=0.3 fcgiapp>=0.1".split(),
            ["docgen", "fastcgi"]
        )
        self.checkRequires(
            d, "Twisted>=1.5 fcgiapp>=0.1 ZConfig>=2.0 docutils>=0.3".split(),
            ["fastcgi", "docgen"]
        )
        with pytest.raises(pkg_resources.UnknownExtra):
            d.requires(["foo"]) 
開發者ID:pypa,項目名稱:pkg_resources,代碼行數:27,代碼來源:test_resources.py

示例3: testDistroDependsOptions

# 需要導入模塊: import pkg_resources [as 別名]
# 或者: from pkg_resources import UnknownExtra [as 別名]
def testDistroDependsOptions(self):
        d = self.distRequires("""
            Twisted>=1.5
            [docgen]
            ZConfig>=2.0
            docutils>=0.3
            [fastcgi]
            fcgiapp>=0.1""")
        self.checkRequires(d,"Twisted>=1.5")
        self.checkRequires(
            d,"Twisted>=1.5 ZConfig>=2.0 docutils>=0.3".split(), ["docgen"]
        )
        self.checkRequires(
            d,"Twisted>=1.5 fcgiapp>=0.1".split(), ["fastcgi"]
        )
        self.checkRequires(
            d,"Twisted>=1.5 ZConfig>=2.0 docutils>=0.3 fcgiapp>=0.1".split(),
            ["docgen","fastcgi"]
        )
        self.checkRequires(
            d,"Twisted>=1.5 fcgiapp>=0.1 ZConfig>=2.0 docutils>=0.3".split(),
            ["fastcgi", "docgen"]
        )
        with pytest.raises(pkg_resources.UnknownExtra):
            d.requires(["foo"]) 
開發者ID:francelabs,項目名稱:datafari,代碼行數:27,代碼來源:test_resources.py

示例4: _resolve_requirements

# 需要導入模塊: import pkg_resources [as 別名]
# 或者: from pkg_resources import UnknownExtra [as 別名]
def _resolve_requirements(provider, distribution):
    try:
        requirements = distribution.requires([provider])
    except pkg_resources.UnknownExtra:
        # No extra for this provider
        return True
    else:
        # Extra is defined
        try:
            for requirement in requirements:
                if hasattr(requirement, 'name'):
                    pkg_resources.get_distribution(requirement.name)
                else:
                    pkg_resources.get_distribution(requirement)
        except (pkg_resources.DistributionNotFound, pkg_resources.VersionConflict):
            # At least one extra requirement is not fulfilled
            return False

    return True 
開發者ID:AnalogJ,項目名稱:lexicon,代碼行數:21,代碼來源:discovery.py

示例5: _load_entry_point

# 需要導入模塊: import pkg_resources [as 別名]
# 或者: from pkg_resources import UnknownExtra [as 別名]
def _load_entry_point(ep_name, name=None):
    """Try to load the entry point ep_name that matches name."""
    for ep in pkg_resources.iter_entry_points(ep_name, name=name):
        try:
            return ep.load()
        except (ImportError, pkg_resources.UnknownExtra, AttributeError):
            continue 
開發者ID:nttcom,項目名稱:eclcli,代碼行數:9,代碼來源:utils.py

示例6: discover_auth_systems

# 需要導入模塊: import pkg_resources [as 別名]
# 或者: from pkg_resources import UnknownExtra [as 別名]
def discover_auth_systems():
    """Discover the available auth-systems.

    This won't take into account the old style auth-systems.
    """
    ep_name = 'openstack.client.auth_plugin'
    for ep in pkg_resources.iter_entry_points(ep_name):
        try:
            auth_plugin = ep.load()
        except (ImportError, pkg_resources.UnknownExtra, AttributeError) as e:
            logger.debug("ERROR: Cannot load auth plugin %s" % ep.name)
            logger.debug(e, exc_info=1)
        else:
            _discovered_plugins[ep.name] = auth_plugin 
開發者ID:nttcom,項目名稱:eclcli,代碼行數:16,代碼來源:auth_plugin.py

示例7: _load_plugin

# 需要導入模塊: import pkg_resources [as 別名]
# 或者: from pkg_resources import UnknownExtra [as 別名]
def _load_plugin(self, ep: pkg_resources.EntryPoint):
        try:
            self.logger.debug(" Loading plugin %s" % ep)
            plugin = ep.load(require=True)
            self.logger.debug(" Initializing plugin %s" % ep)
            plugin_context = copy.copy(self.app_context)
            plugin_context.logger = self.logger.getChild(ep.name)
            obj = plugin(plugin_context)
            return Plugin(ep.name, ep, obj)
        except ImportError as ie:
            self.logger.warning("Plugin %r import failed: %s" % (ep, ie))
        except pkg_resources.UnknownExtra as ue:
            self.logger.warning("Plugin %r dependencies resolution failed: %s" % (ep, ue)) 
開發者ID:beerfactory,項目名稱:hbmqtt,代碼行數:15,代碼來源:manager.py


注:本文中的pkg_resources.UnknownExtra方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。