本文整理汇总了Python中askbot.REQUIREMENTS类的典型用法代码示例。如果您正苦于以下问题:Python REQUIREMENTS类的具体用法?Python REQUIREMENTS怎么用?Python REQUIREMENTS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了REQUIREMENTS类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_modules
def test_modules():
"""tests presence of required modules"""
from askbot import REQUIREMENTS
#flatten requirements into file-like string
req_text = '\n'.join(REQUIREMENTS.values())
import requirements
parsed_requirements = requirements.parse(req_text)
for req in parsed_requirements:
pip_path = unparse_requirement(req)
mod_name = find_mod_name(req.name)
try_import(mod_name, pip_path)
test_specs(req)
示例2: test_modules
def test_modules():
"""tests presence of required modules"""
from askbot import REQUIREMENTS
for module_name, pip_path in REQUIREMENTS.items():
try_import(module_name, pip_path)
示例3: find_mod_name
def find_mod_name(req_name):
from askbot import REQUIREMENTS
req2mod = dict([(get_req_name_from_spec(v), k) for (k, v) in REQUIREMENTS.items()])
return req2mod[req_name]