Remove unnecessary difflines() function and unnecessary closing of files in CreatePat...
authorAntoni <a.adaszkiewi@samsung.com>
Mon, 18 Jul 2022 11:33:12 +0000 (13:33 +0200)
committerAntoni <a.adaszkiewi@samsung.com>
Mon, 18 Jul 2022 11:33:12 +0000 (13:33 +0200)
Change-Id: I6abeeca4ed203d0718ca04b51809220fafe11f56

mk_delta/common/bin/CreatePatch.py

index f449e19..cc79811 100755 (executable)
@@ -301,10 +301,6 @@ def path_head(path):
     head, tail = ntpath.split(path)
     return head
 
-def difflines(list1, list2):
-    c = set(list1).union(set(list2))
-    d = set(list1).intersection(set(list2))
-    return list(c-d)
 
 #Creating Diff between OLD and NEW attribute files v12
 def Diff_AttrFiles(ATTR_OLD, ATTR_NEW, ATTR_FILE):
@@ -316,16 +312,11 @@ def Diff_AttrFiles(ATTR_OLD, ATTR_NEW, ATTR_FILE):
        with open(ATTR_NEW, 'r') as f_new:
                lines2 = set(f_new.read().splitlines())
 
-       lines = difflines(lines2, lines1)
+       lines = set.difference(lines2, lines1)
        with open(ATTR_FILE, 'w+') as file_out:
                for line in lines:
-                       if line not in lines1:
-                               logging.info('Diff_AttrFiles - %s' % line)
-                               file_out.write(line+'\n')
-
-       f_new.close()
-       f_old.close()
-       file_out.close()
+                       logging.info('Diff_AttrFiles - %s' % line)
+                       file_out.write(line+'\n')