Skip to contentSkip to conversation

graph-build-time: support python3

PATCH New Vivien Didelot 3 participants 3 messages Jun 23, 2014 – Jun 29, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 graph-build-time: support python3

This patch is the result of 2to3.

---
 support/scripts/graph-build-time | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
support/scripts/graph-build-time +3 -3
index 8ef065f..524c30d 100755
@@ -80,16 +80,16 @@ class Package:
             self.steps_start[step] = time
         else:
             self.steps_end[step] = time
-        if self.steps_start.has_key(step) and self.steps_end.has_key(step):
+        if step in self.steps_start and step in self.steps_end:
             self.steps_duration[step] = self.steps_end[step] - self.steps_start[step]
 
     def get_duration(self, step=None):
         if step is None:
             duration = 0
-            for step in self.steps_duration.keys():
+            for step in list(self.steps_duration.keys()):
                 duration += self.steps_duration[step]
             return duration
-        if self.steps_duration.has_key(step):
+        if step in self.steps_duration:
             return self.steps_duration[step]
         return 0
 
Signature · 1 line
2.0.0
#1 lore raw

PATCH 1/1 graph-build-time: support python3

Quoted 3 lines · Vivien Didelot

This patch is the result of 2to3.

(with Python 2.7.7 and Python 3.4.1)

Regards,
Arnout

Quoted 29 lines
---
 support/scripts/graph-build-time | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
support/scripts/graph-build-time +3 -3
index 8ef065f..524c30d 100755
@@ -80,16 +80,16 @@ class Package:
             self.steps_start[step] = time
         else:
             self.steps_end[step] = time
-        if self.steps_start.has_key(step) and self.steps_end.has_key(step):
+        if step in self.steps_start and step in self.steps_end:
             self.steps_duration[step] = self.steps_end[step] - self.steps_start[step]
 
     def get_duration(self, step=None):
         if step is None:
             duration = 0
-            for step in self.steps_duration.keys():
+            for step in list(self.steps_duration.keys()):
                 duration += self.steps_duration[step]
             return duration
-        if self.steps_duration.has_key(step):
+        if step in self.steps_duration:
             return self.steps_duration[step]
         return 0
 
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#2 lore raw

PATCH 1/1 graph-build-time: support python3

In reply to Vivien Didelot

Dear Vivien Didelot,

Quoted 6 lines · Vivien Didelot

This patch is the result of 2to3.

---
 support/scripts/graph-build-time | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Applied, thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com