Skip to content

Commit

Permalink
Add -x to delete sane messages from the insane folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Mortal committed May 2, 2015
1 parent 9218118 commit 6048cfa
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions insane.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import email
import argparse

from io import BytesIO, StringIO
from email.generator import Generator
Expand All @@ -8,6 +9,10 @@


def main():
parser = argparse.ArgumentParser()
parser.add_argument('-x', '--delete', action='store_true')
args = parser.parse_args()

for filename in sorted(os.listdir('insane')):
if filename.endswith('.in'):
with open('insane/%s' % filename, 'rb') as fp:
Expand Down Expand Up @@ -45,6 +50,10 @@ def main():
else:
print("%s: Not OK" % (filename,))

if args.delete and (a == b or a_s == b_s):
os.remove('insane/%s' % filename)
os.remove('insane/%s' % filename.replace('.in', '.out'))


if __name__ == "__main__":
main()

0 comments on commit 6048cfa

Please sign in to comment.