Simplifying Failures
Posted catgatp
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Simplifying Failures相关的知识,希望对你有一定的参考价值。
# # Finish the delta debug function ddmin # import re def test(s): print s, len(s),repr(s) if re.search("<SELECT[^>]*>", s) >= 0: print (s, len(s),"FAIL") return "FAIL" else: return "PASS" def ddmin(s): assert test(s) == "FAIL" n = 2 # Initial granularity while len(s) >= 2: start = 0 subset_length = len(s) / n some_complement_is_failing = False while start < len(s): complement = s[:start] + s[start + subset_length:] if test(complement) == "FAIL": s = complement n = max(n - 1, 2) some_complement_is_failing = True break start += subset_length if not some_complement_is_failing: # YOUR CODE HERE if len(s) == n: break n = min(n * 2, len(s)) return s # UNCOMMENT TO TEST html_input = ‘<SELECT>foo</SELECT>‘ print ddmin(html_input)
以上是关于Simplifying Failures的主要内容,如果未能解决你的问题,请参考以下文章
python 来自:http://programming.oreilly.com/2014/04/simplifying-django.html
P3037 [USACO11DEC]Simplifying the Farm G[最小生成树]
Understanding One-Shot NAS2018-ICML-Understanding and Simplifying One-Shot Architecture Search-论文阅