本文整理汇总了Python中validator.chromemanifest.ChromeManifest.get_entries方法的典型用法代码示例。如果您正苦于以下问题:Python ChromeManifest.get_entries方法的具体用法?Python ChromeManifest.get_entries怎么用?Python ChromeManifest.get_entries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类validator.chromemanifest.ChromeManifest
的用法示例。
在下文中一共展示了ChromeManifest.get_entries方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_open
# 需要导入模块: from validator.chromemanifest import ChromeManifest [as 别名]
# 或者: from validator.chromemanifest.ChromeManifest import get_entries [as 别名]
def test_open():
"""Open a chrome file and ensure that data can be pulled from it."""
xpi = MockXPI({
'chrome.manifest': 'tests/resources/chromemanifest/chrome.manifest'})
manifest = ChromeManifest(xpi, 'chrome.manifest')
assert manifest is not None
g_obj = list(manifest.get_entries('subject', 'predicate'))
assert len(g_obj) == 1
assert g_obj[0]['args'][1] == 'object'
sub_locale = list(manifest.get_entries('locale'))
assert len(sub_locale) == 2
示例2: _list_locales
# 需要导入模块: from validator.chromemanifest import ChromeManifest [as 别名]
# 或者: from validator.chromemanifest.ChromeManifest import get_entries [as 别名]
def _list_locales(err, xpi_package=None):
'Returns a raw list of locales from chrome.manifest'
chrome = None
if xpi_package is not None:
# Handle a reference XPI
chrome = ChromeManifest(xpi_package, 'chrome.manifest', err)
else:
# Handle the current XPI
chrome = err.get_resource('chrome.manifest')
if not chrome:
return None
return list(chrome.get_entries('locale'))