[Lldb-commits] [lldb] r251129 - Python3 - Wrap more statements in calls to list()

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 23 10:53:51 PDT 2015


Author: zturner
Date: Fri Oct 23 12:53:51 2015
New Revision: 251129

URL: http://llvm.org/viewvc/llvm-project?rev=251129&view=rev
Log:
Python3 - Wrap more statements in calls to list()

Modified:
    lldb/trunk/test/attic/tester.py
    lldb/trunk/test/dosep.py
    lldb/trunk/test/dotest.py
    lldb/trunk/test/lldbinline.py
    lldb/trunk/test/lldbtest.py
    lldb/trunk/test/plugins/builder_base.py
    lldb/trunk/test/progress.py
    lldb/trunk/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py
    lldb/trunk/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
    lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py
    lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py

Modified: lldb/trunk/test/attic/tester.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/attic/tester.py?rev=251129&r1=251128&r2=251129&view=diff
==============================================================================
--- lldb/trunk/test/attic/tester.py (original)
+++ lldb/trunk/test/attic/tester.py Fri Oct 23 12:53:51 2015
@@ -55,7 +55,7 @@ class ExecutionTimes:
       self.m_times[component] = list()
     self.m_times[component].append(e - self.m_start)
   def dumpStats(self):
-    for key in self.m_times.keys():
+    for key in list(self.m_times.keys()):
       if len(self.m_times[key]):
         sampleMin = float('inf')
         sampleMax = float('-inf')

Modified: lldb/trunk/test/dosep.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=251129&r1=251128&r2=251129&view=diff
==============================================================================
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Fri Oct 23 12:53:51 2015
@@ -1355,7 +1355,7 @@ def main(print_details_on_success, num_t
         raise Exception(
             "specified testrunner name '{}' unknown. Valid choices: {}".format(
                 test_runner_name,
-                runner_strategies_by_name.keys()))
+                list(runner_strategies_by_name.keys())))
     test_runner_func = runner_strategies_by_name[test_runner_name]
 
     summary_results = walk_and_invoke(

Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=251129&r1=251128&r2=251129&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Fri Oct 23 12:53:51 2015
@@ -413,7 +413,7 @@ def validate_categories(categories):
         if (category not in validCategories) or category == None:
             print("fatal error: category '" + origCategory + "' is not a valid category")
             print("if you have added a new category, please edit dotest.py, adding your new category to validCategories")
-            print("else, please specify one or more of the following: " + str(validCategories.keys()))
+            print("else, please specify one or more of the following: " + str(list(validCategories.keys())))
             sys.exit(1)
         result.append(category)
     return result

Modified: lldb/trunk/test/lldbinline.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbinline.py?rev=251129&r1=251128&r2=251129&view=diff
==============================================================================
--- lldb/trunk/test/lldbinline.py (original)
+++ lldb/trunk/test/lldbinline.py Fri Oct 23 12:53:51 2015
@@ -89,7 +89,7 @@ class InlineTest(TestBase):
         for f in os.listdir(os.getcwd()):
             t = source_type(f)
             if t:
-                if t in categories.keys():
+                if t in list(categories.keys()):
                     categories[t].append(f)
                 else:
                     categories[t] = [f]
@@ -100,14 +100,14 @@ class InlineTest(TestBase):
 
         makefile.write("LEVEL = " + level + "\n")
 
-        for t in categories.keys():
+        for t in list(categories.keys()):
             line = t + " := " + " ".join(categories[t])
             makefile.write(line + "\n")
 
-        if ('OBJCXX_SOURCES' in categories.keys()) or ('OBJC_SOURCES' in categories.keys()):
+        if ('OBJCXX_SOURCES' in list(categories.keys())) or ('OBJC_SOURCES' in list(categories.keys())):
             makefile.write("LDFLAGS = $(CFLAGS) -lobjc -framework Foundation\n")
 
-        if ('CXX_SOURCES' in categories.keys()):
+        if ('CXX_SOURCES' in list(categories.keys())):
             makefile.write("CXXFLAGS += -std=c++11\n")
 
         makefile.write("include $(LEVEL)/Makefile.rules\n")

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=251129&r1=251128&r2=251129&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Fri Oct 23 12:53:51 2015
@@ -186,7 +186,7 @@ def SETTING_MSG(setting):
 
 def EnvArray():
     """Returns an env variable array from the os.environ map object."""
-    return list(map(lambda k,v: k+"="+v, os.environ.keys(), os.environ.values()))
+    return list(map(lambda k,v: k+"="+v, list(os.environ.keys()), list(os.environ.values())))
 
 def line_number(filename, string_to_match):
     """Helper function to return the line number of the first matched string."""
@@ -2249,7 +2249,7 @@ class Base(unittest2.TestCase):
 class LLDBTestCaseFactory(type):
     def __new__(cls, name, bases, attrs):
         newattrs = {}
-        for attrname, attrvalue in attrs.iteritems():
+        for attrname, attrvalue in attrs.items():
             if attrname.startswith("test") and not getattr(attrvalue, "__no_debug_info_test__", False):
                 @dsym_test
                 def dsym_test_method(self, attrvalue=attrvalue):

Modified: lldb/trunk/test/plugins/builder_base.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/plugins/builder_base.py?rev=251129&r1=251128&r2=251129&view=diff
==============================================================================
--- lldb/trunk/test/plugins/builder_base.py (original)
+++ lldb/trunk/test/plugins/builder_base.py Fri Oct 23 12:53:51 2015
@@ -85,7 +85,7 @@ def getCmdLine(d):
         if k in append_vars and os.environ.has_key(k):
             v = os.environ[k] + " " + v
         return pattern % (k, v)
-    cmdline = " ".join([setOrAppendVariable(k, v) for k, v in d.items()])
+    cmdline = " ".join([setOrAppendVariable(k, v) for k, v in list(d.items())])
 
     return cmdline
 

Modified: lldb/trunk/test/progress.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/progress.py?rev=251129&r1=251128&r2=251129&view=diff
==============================================================================
--- lldb/trunk/test/progress.py (original)
+++ lldb/trunk/test/progress.py Fri Oct 23 12:53:51 2015
@@ -132,7 +132,7 @@ class ProgressWithEvents(AnimatedProgres
         if len(self.events) == 0:
             return
         self.stdout.write('\n')
-        for key in self.events.keys():
+        for key in list(self.events.keys()):
             self.stdout.write(str(key) + ' = ' + str(self.events[key]) + ' ')
         if isatty:
             self.stdout.write('\033[1A')

Modified: lldb/trunk/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py?rev=251129&r1=251128&r2=251129&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py (original)
+++ lldb/trunk/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py Fri Oct 23 12:53:51 2015
@@ -74,7 +74,7 @@ class TestGdbRemoteExpeditedRegisters(gd
         # Generate a stop reply, parse out expedited registers from stop notification.
         expedited_registers = self.gather_expedited_registers()
         # Verify no expedited register was specified multiple times.
-        for (reg_num, value) in expedited_registers.items():
+        for (reg_num, value) in list(expedited_registers.items()):
             if (type(value) == list) and (len(value) > 0):
                 self.fail("expedited register number {} specified more than once ({} times)".format(reg_num, len(value)))
 

Modified: lldb/trunk/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py?rev=251129&r1=251128&r2=251129&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py (original)
+++ lldb/trunk/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py Fri Oct 23 12:53:51 2015
@@ -101,8 +101,8 @@ class TestGdbRemote_qThreadStopInfo(gdbr
         (stop_replies, _) = self.gather_stop_replies_via_qThreadStopInfo(thread_count)
         self.assertIsNotNone(stop_replies)
 
-        no_stop_reason_count   = sum(1 for stop_reason in stop_replies.values() if stop_reason == 0)
-        with_stop_reason_count = sum(1 for stop_reason in stop_replies.values() if stop_reason != 0)
+        no_stop_reason_count   = sum(1 for stop_reason in list(stop_replies.values()) if stop_reason == 0)
+        with_stop_reason_count = sum(1 for stop_reason in list(stop_replies.values()) if stop_reason != 0)
 
         # All but one thread should report no stop reason.
         self.assertEqual(no_stop_reason_count, thread_count - 1)
@@ -128,7 +128,7 @@ class TestGdbRemote_qThreadStopInfo(gdbr
         (_, thread_dicts) = self.gather_stop_replies_via_qThreadStopInfo(thread_count)
         self.assertIsNotNone(thread_dicts)
 
-        for thread_dict in thread_dicts.values():
+        for thread_dict in list(thread_dicts.values()):
             name = thread_dict.get("name")
             self.assertIsNotNone(name)
             self.assertEquals(name, expected_thread_name)

Modified: lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py?rev=251129&r1=251128&r2=251129&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py (original)
+++ lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py Fri Oct 23 12:53:51 2015
@@ -517,7 +517,7 @@ class GdbRemoteTestCaseBase(TestBase):
         process_info_dict = { match.group(1):match.group(2) for match in re.finditer(r"([^:]+):([^;]+);", process_info_raw) }
 
         # Validate keys are known.
-        for (key, val) in process_info_dict.items():
+        for (key, val) in list(process_info_dict.items()):
             self.assertTrue(key in self._KNOWN_PROCESS_INFO_KEYS)
             self.assertIsNotNone(val)
 
@@ -625,7 +625,7 @@ class GdbRemoteTestCaseBase(TestBase):
         mem_region_dict = self.parse_key_val_dict(context.get("memory_region_response"))
 
         # Validate keys are known.
-        for (key, val) in mem_region_dict.items():
+        for (key, val) in list(mem_region_dict.items()):
             self.assertTrue(key in ["start", "size", "permissions", "error"])
             self.assertIsNotNone(val)
 
@@ -808,7 +808,7 @@ class GdbRemoteTestCaseBase(TestBase):
         kv_dict = self.parse_key_val_dict(stop_key_vals_text)
 
         registers = {}
-        for (key, val) in kv_dict.items():
+        for (key, val) in list(kv_dict.items()):
             if re.match(r"^[0-9a-fA-F]+$", key):
                 registers[int(key, 16)] = val
         return registers

Modified: lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py?rev=251129&r1=251128&r2=251129&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py (original)
+++ lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py Fri Oct 23 12:53:51 2015
@@ -481,7 +481,7 @@ class GdbRemoteEntry(GdbRemoteEntryBase)
 
         if self.capture:
             # Handle captures.
-            for group_index, var_name in self.capture.items():
+            for group_index, var_name in list(self.capture.items()):
                 capture_text = match.group(group_index)
                 # It is okay for capture text to be None - which it will be if it is a group that can match nothing.
                 # The user must be okay with it since the regex itself matched above.
@@ -489,7 +489,7 @@ class GdbRemoteEntry(GdbRemoteEntryBase)
 
         if self.expect_captures:
             # Handle comparing matched groups to context dictionary entries.
-            for group_index, var_name in self.expect_captures.items():
+            for group_index, var_name in list(self.expect_captures.items()):
                 capture_text = match.group(group_index)
                 if not capture_text:
                     raise Exception("No content to expect for group index {}".format(group_index))
@@ -713,7 +713,7 @@ class MatchRemoteOutputEntry(GdbRemoteEn
         # Collect up any captures into the context.
         if self._capture:
             # Handle captures.
-            for group_index, var_name in self._capture.items():
+            for group_index, var_name in list(self._capture.items()):
                 capture_text = match.group(group_index)
                 if not capture_text:
                     raise Exception("No content for group index {}".format(group_index))




More information about the lldb-commits mailing list