[PATCH] D67534: [LNT] Python 3 support: Minor automatic 2to3 fixups

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 12 21:16:22 PDT 2019


hubert.reinterpretcast created this revision.
hubert.reinterpretcast added reviewers: cmatthews, thopre, kristof.beyls.

Automatic fixups done using `2to3`:

- `2to3 -f numliterals`
- `2to3 -f dict`
- `2to3 -f map`
- `2to3 -f exec`

The changes cover the files found to be affected when running tests (without result submission).


https://reviews.llvm.org/D67534

Files:
  lnt/formats/__init__.py
  lnt/lnttool/create.py
  lnt/server/instance.py
  lnt/testing/__init__.py


Index: lnt/testing/__init__.py
===================================================================
--- lnt/testing/__init__.py
+++ lnt/testing/__init__.py
@@ -182,7 +182,7 @@
         self.name = str(name)
         self.info = dict((str(key), str(value))
                          for key, value in info.items())
-        self.data = map(conv_f, data)
+        self.data = list(map(conv_f, data))
 
     def render(self):
         """Return info from this instance in a dictionary that respects
Index: lnt/server/instance.py
===================================================================
--- lnt/server/instance.py
+++ lnt/server/instance.py
@@ -54,7 +54,7 @@
             raise Exception("Invalid config: %r" % config_path)
 
         config_data = {}
-        exec open(config_path) in config_data
+        exec(open(config_path), config_data)
         config = lnt.server.config.Config.from_data(config_path, config_data)
 
         return Instance(config_path, config, tmpdir)
Index: lnt/lnttool/create.py
===================================================================
--- lnt/lnttool/create.py
+++ lnt/lnttool/create.py
@@ -159,7 +159,7 @@
     wsgi_file = open(wsgi_path, 'w')
     wsgi_file.write(kWSGITemplate % locals())
     wsgi_file.close()
-    os.chmod(wsgi_path, 0755)
+    os.chmod(wsgi_path, 0o755)
 
     # Execute an upgrade on the database to initialize the schema.
     lnt.server.db.migrate.update_path(db_path)
Index: lnt/formats/__init__.py
===================================================================
--- lnt/formats/__init__.py
+++ lnt/formats/__init__.py
@@ -12,7 +12,7 @@
 
 formats = [plist, json]
 formats_by_name = dict((f['name'], f) for f in formats)
-format_names = formats_by_name.keys()
+format_names = list(formats_by_name.keys())
 
 
 def get_format(name):


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67534.220040.patch
Type: text/x-patch
Size: 1812 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190913/87e64d5f/attachment.bin>


More information about the llvm-commits mailing list