~sircmpwn/lists.sr.ht

b0a92975f11afb7487f6af43b364ce44647ed7d1 — Drew DeVault 9 months ago b4607e4
Add contrib/reclassify-patches
1 files changed, 15 insertions(+), 0 deletions(-)

A contrib/reclassify-patches
A contrib/reclassify-patches => contrib/reclassify-patches +15 -0
@@ 0,0 1,15 @@
#!/usr/bin/env python3
# This script reads through all archived emails and attempts to parse them as a
# patch, adding or removing their patch classification accordingly.
import sys
from listssrht.app import db
from listssrht.types import Email

nemails = Email.query.count()
for i, email in enumerate(Email.query.all()):
    sys.stdout.write(f"\r{i+1}/{nemails}")
    email.patch()

print("\nCommitting...")
db.session.commit()
print("Done.")