#
# 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的更多相关文章

  1. Too many authentic authentication failures for root

    连接SSH服务器时报 Too many authentic authentication failures for root. 方法一:删除目标服务器 /root/.ssh/目录下的 known_ho ...

  2. SSH returns “too many authentication failures” error – HostGator

    I am an avid fan of using HostGator for small business WordPress website hosting. I love that they u ...

  3. Too many authentication failures for xxxx_username

    解释 这个报错通常是因为多个ssh key 验证,key太多了导致服务器拒绝接受认证请求. 可以通过 -v 参数,输出详细的过程.你会发现你提供的认证key,服务器拒绝链接,并提示异常:"T ...

  4. error——Fusion log——Debugging Assembly Loading Failures

    原文 So...you're seeing a FileNotFoundException, FileLoadException, BadImageFormatException or you sus ...

  5. SSH File Transfer遇到错误"too many authentication failures for root".A protocol error was detected......

    在SSH  Secure Shell 连接Linux centos的时候,遇到F-Secure SSH File Transfer错误"too many authentication fai ...

  6. maven编译时出现There are test failures

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-tes ...

  7. Error: 实例 "ddd" 执行所请求操作失败,实例处于错误状态。: 请稍后再试 [错误: Exceeded maximum number of retries. Exhausted all hosts available for retrying build failures for instance 6f60bc06-fcb6-4758-a46f-22120ca35a71.].

    Error: 实例 "ddd" 执行所请求操作失败,实例处于错误状态.: 请稍后再试 [错误: Exceeded maximum number of retries. Exhaus ...

  8. Maven进行install的时候报错,COMPILATION ERROR : Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.13:test (default-test) on project cmu: There are test failures.

    maven进行install的时候,test类里面报错: COMPILATION ERROR : [INFO] -------------------------------------------- ...

  9. (org.jbehave.core.failures.BeforeOrAfterFailed: webdriver selenium错误解决。

    (org.jbehave.core.failures.BeforeOrAfterFailed: Method initWebDriver (annotated with @BeforeStory in ...

随机推荐

  1. Qt 利用飞机图片画五边形

    最近练习Qt,需要一个飞机在屏幕上画五边形.虽然达到的效果不是非常的理想,但是勉强还是达到了效果,欢迎大家指正.用到的飞机图片如下. 第一步:初始化,在构造函数里面,把图片向左旋转18° );ui.l ...

  2. django后台标题替换

    在制作django后台的时候,默认的django admin界面标题为“django管理”,找了许多的资料都很麻烦,偶与好友一起探讨,找到了新的解决方法 在django的py文件中插入 from dj ...

  3. redis 异常 MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk

    MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. 解决方 ...

  4. 批量导入数据到InnoDB表速度优化

    1.使用Load data: 2. SET autocommit=0; ... SQL import statements ... COMMIT; 3. SET unique_checks=0; .. ...

  5. prometheus 告警规则

    GitHub网址1 https://github.com/samber/awesome-prometheus-alerts 网址2 https://awesome-prometheus-alerts. ...

  6. onvirt安装linux系统

    情况说明: (1)本文接前文kvm虚拟化学习笔记(十九)之convirt集中管理平台搭建,采用convirt虚拟化平台安装linux操作系统的过程,这个过程中需要对convirt进行一系列的配置才能真 ...

  7. WEB监控手段

    WEB监控手段: 1.端口       本地: ss . netstat .lsof         ss -ntlp|grep 80|wc -l    (大于等于1)          netsta ...

  8. 让Jupyter Notebook个性化

    Win下更改jupyter主题 Themes地址 本人环境  Win+Conda 开始使用pip 安装,发现无法使用pip,修改环境变量,将D:\Program Files\Conda\Scripts ...

  9. spark-submit python egg 解决三方件依赖问题

    假设spark里用到了purl这个三方件,https://github.com/ultrabluewolf/p.url,他还额外依赖futures这个三方件(six的话,anaconda2自带). p ...

  10. linux系统编程之进程(二)

    今天继续学习进程相关的东东,上节提到了,当fork()之后,子进程复制了父进程当中的大部分数据,其中对于打开的文件,如果父进程打开了,子进程则不需要打开了,是共享的,所以首先先来研究下共享文件这一块的 ...