本文整理匯總了Python中rule.Rule.load_rules方法的典型用法代碼示例。如果您正苦於以下問題:Python Rule.load_rules方法的具體用法?Python Rule.load_rules怎麽用?Python Rule.load_rules使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rule.Rule
的用法示例。
在下文中一共展示了Rule.load_rules方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: rules
# 需要導入模塊: from rule import Rule [as 別名]
# 或者: from rule.Rule import load_rules [as 別名]
def rules(rule_id=None):
""" Returns all available rules """
record = _testrecord_from_request(bottle.request)
return json.dumps(Rule.load_rules(record), cls=JSONRuleEncoder)
示例2: forever_alone
# 需要導入模塊: from rule import Rule [as 別名]
# 或者: from rule.Rule import load_rules [as 別名]
def forever_alone():
with open('forever.txt') as handle:
return handle.read()
# if run as a script, we kick in here
if __name__ == "__main__":
UMLS.import_snomed_if_necessary()
if _BG:
print "-> Running as a background app"
# load all rules
rules = Rule.load_rules()
if len(rules) < 1:
print "There are no rules, no point in continuing"
print forever_alone()
sys.exit(1)
print "-> Did load %d %s" % (len(rules), 'rule' if 1 == len(rules) else 'rules')
# multiple endpoints? Ask which one to use
ep = None
if len(ENDPOINTS) > 1:
print "-> These are the available SMART containers:"
i = 0
for dictionary in ENDPOINTS:
i += 1
print ' [%d] %s (%s)' % (i, dictionary.get('name'), dictionary.get('url'))