blind review on list-operations added by 2to3:
[nepi.git] / src / nepi / resources / linux / node.py
index 7558475..c10bc58 100644 (file)
@@ -489,7 +489,8 @@ class LinuxNode(ResourceManager):
                     # adding the avoided pids filtered above (avoid_kill) to allow users keep process
                     # alive when using besides ssh connections  
                     kill_pids = set(pids_temp.items()) - set(pids.items())
-                    kill_pids = ' '.join(list(dict(kill_pids).keys()))
+                    # py2/py3 : keep it simple
+                    kill_pids = ' '.join(kill_pids)
 
                     # removing pids from beside connections and its process
                     kill_pids = kill_pids.split(' ')
@@ -773,9 +774,9 @@ class LinuxNode(ResourceManager):
             src = f.name
 
         # If dst files should not be overwritten, check that the files do not
-        # exits already
+        # exist already
         if isinstance(src, str):
-            src = list(map(str.strip, src.split(";")))
+            src = [s.strip() for s in src.split(";")]
     
         if overwrite == False:
             src = self.filter_existing_files(src, dst)
@@ -1178,19 +1179,20 @@ class LinuxNode(ResourceManager):
                 if len(src) > 1 else {dst: src[0]}
 
         command = []
-        for d in list(dests.keys()):
+        for d in dests:
             command.append(" [ -f {dst} ] && echo '{dst}' ".format(dst=d) )
 
         command = ";".join(command)
 
         (out, err), proc = self.execute(command, retry = 1, with_lock = True)
         
-        for d in list(dests.keys()):
+        for d in dests:
             if out.find(d) > -1:
                 del dests[d]
 
         if not dests:
             return []
 
+        # list(..) here added by 2to3 - leaving for safety
         return list(dests.values())