[tor-commits] [torspec/master] reindex.py: convert to python3

nickm at torproject.org nickm at torproject.org
Mon Nov 25 17:01:02 UTC 2019


commit f370c4abc0e87b0787ec0f70d47f44bb8881f661
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Nov 25 11:59:23 2019 -0500

    reindex.py: convert to python3
---
 proposals/reindex.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/proposals/reindex.py b/proposals/reindex.py
index 990016f..2023271 100755
--- a/proposals/reindex.py
+++ b/proposals/reindex.py
@@ -23,6 +23,7 @@ def indexed(seq):
 
 def readProposal(fn):
     fields = { }
+    print(fn)
     f = open(fn, 'r')
     lastField = None
     try:
@@ -69,10 +70,9 @@ def checkProposal(fn, fields):
             need_fields.remove("Ticket")
 
     for f in need_fields:
-        if not fields.has_key(f):
+        if f not in fields:
             raise Error("%s has no %s field"%(fn, f))
     if fn != fields['Filename']:
-        print `fn`, `fields['Filename']`
         raise Error("Mismatched Filename field in %s"%fn)
     if fields['Title'][-1] == '.':
         fields['Title'] = fields['Title'][:-1]
@@ -82,7 +82,7 @@ def checkProposal(fn, fields):
         raise Error("I've never heard of status %s in %s"%(status,fn))
     if status in [ "SUPERSEDED", "DEAD" ]:
         for f in [ 'Implemented-In', 'Target' ]:
-            if fields.has_key(f): del fields[f]
+            if f in fields: del fields[f]
 
 def readProposals():
     res = []
@@ -121,9 +121,9 @@ def writeIndexFile(proposals):
         for prop in proposals:
             if s == prop['Status']:
                 out.write("   %(num)s  %(Title)s"%prop)
-                if prop.has_key('Target'):
+                if "Target" in prop:
                     out.write(" [for %(Target)s]"%prop)
-                if prop.has_key('Implemented-In'):
+                if "Implemented-In" in prop:
                     out.write(" [in %(Implemented-In)s]"%prop)
                 out.write("\n")
     out.close()





More information about the tor-commits mailing list