Salome HOME
Copyright update 2022
[modules/paravis.git] / src / Macro / annotate_groups.py
index c1a4cf2d2bf553b8df8eb7ff20bc7c3468514a41..3f6a4aacdb1b5c6452b9de45acb10351fd91c8d7 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2016  CEA/DEN, EDF R&D
+# Copyright (C) 2014-2022  CEA/DEN, EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -154,9 +154,9 @@ def ExctractSILInformation(smProxy, mapFamilies, mapGroups, mapRelations):
       mapGroups[groupName] = familiesOnGroups
 
   # Establish the relations between families and groups
-  for family_name, family_id in mapFamilies.iteritems():
+  for family_name, family_id in mapFamilies.items():
     groupNames = []
-    for group_name, family_name_on_group in mapGroups.iteritems():
+    for group_name, family_name_on_group in mapGroups.items():
       if family_name in family_name_on_group:
         groupNames.append(group_name)
     if len(groupNames) > 0:
@@ -264,8 +264,7 @@ if not ExctractSILInformation(smproxy, mapFamilies, mapGroups, mapRelations):
   raise RuntimeError("Extraction SIL graph failed.")
 
 # Sort families array by ID
-sortedArray = mapFamilies.values()
-sortedArray.sort()
+sortedArray = sorted(list(mapFamilies.values()))
 
 # Prepare 'Annotation' list for lookup-table
 numberValues = 0
@@ -287,9 +286,9 @@ for idFamily in sortedArray:
   numberValues += 1
 
   # Iterate over all families to get group(s) by family name
-  for famName, famID in mapFamilies.iteritems():
+  for famName, famID in mapFamilies.items():
     if idFamily == famID:
-      if mapRelations.has_key(famName):
+      if famName in mapRelations:
         annotationList.append(str(', ').join(mapRelations.get(famName)))
       else:
         annotationList.append(str('No group'))