本文整理汇总了Python中Kernel.Utils.generate_true_statement方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.generate_true_statement方法的具体用法?Python Utils.generate_true_statement怎么用?Python Utils.generate_true_statement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kernel.Utils
的用法示例。
在下文中一共展示了Utils.generate_true_statement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_true_guard_statements
# 需要导入模块: from Kernel import Utils [as 别名]
# 或者: from Kernel.Utils import generate_true_statement [as 别名]
def add_true_guard_statements(obj,n_true_guard_statements_min_left=1,n_true_guard_statements_max_left=2,
n_true_guard_statements_min_right=1,n_true_guard_statements_max_right=2):
for i in xrange(len(obj)):
n_guard_statements_left = randint(min(n_true_guard_statements_min_left,n_true_guard_statements_max_left),
max(n_true_guard_statements_min_left,n_true_guard_statements_max_left))
n_guard_statements_right = randint(min(n_true_guard_statements_min_right,n_true_guard_statements_max_right),
max(n_true_guard_statements_min_right,n_true_guard_statements_max_right))
is_if = ex.is_if(obj[i])
is_else_if = ex.is_else_if(obj[i])
is_while = ex.is_while(obj[i])
is_until = ex.is_until(obj[i])
if is_if or is_else_if or is_while or is_until:
true_guard_statements_left = [Utils.generate_true_statement(n_min_value=100,n_max_value=300) for j in xrange(n_guard_statements_left)]
true_guard_statements_right = [Utils.generate_true_statement(n_min_value=100,n_max_value=300) for j in xrange(n_guard_statements_right)]
if is_if or is_else_if: obj[i] = add_true_guard_statements_if(obj[i],n_guard_statements_left,
true_guard_statements_left,
n_guard_statements_right,
true_guard_statements_right)
if is_while or is_until: obj[i] = add_true_guard_statements_while(obj[i],n_guard_statements_left,
true_guard_statements_left,
n_guard_statements_right,
true_guard_statements_right)
return obj