From 570df78481648f52f7abd64fc13a9fe3a7c82e65 Mon Sep 17 00:00:00 2001
From: Marko Petric <marko.petric@cern.ch>
Date: Thu, 25 Jul 2019 15:53:53 +0200
Subject: [PATCH] change dict.has_key to key in dict

---
 DDCore/python/dd4hepFactories.py | 4 ++--
 DDG4/python/DDG4.py              | 2 +-
 DDG4/python/g4MaterialScan.py    | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/DDCore/python/dd4hepFactories.py b/DDCore/python/dd4hepFactories.py
index 71eba0ba1..7995161a9 100755
--- a/DDCore/python/dd4hepFactories.py
+++ b/DDCore/python/dd4hepFactories.py
@@ -56,7 +56,7 @@ class ComponentDumper:
         component_count = 0
         duplicate_count = 0
         for lib, comp in self.all_components:
-            if entries.has_key(comp):
+            if comp in entries:
                 dupl = entries[comp]
                 if dupl[1] == 0:
                     if not summary_only:
@@ -79,7 +79,7 @@ class ComponentDumper:
         library_count = 0
         component_count = 0
         for lib, comp in self.all_components:
-            if not entries.has_key(lib):
+            if lib not in entries:
                 entries[lib] = [comp]
                 library_count = library_count + 1
                 component_count = component_count + 1
diff --git a/DDG4/python/DDG4.py b/DDG4/python/DDG4.py
index 0f64cb3a9..b009bd037 100644
--- a/DDG4/python/DDG4.py
+++ b/DDG4/python/DDG4.py
@@ -517,7 +517,7 @@ class Geant4:
       if sd.isValid():
         typ = sd.type()
         sdtyp = 'Unknown'
-        if self.sensitive_types.has_key(typ):
+        if typ in self.sensitive_types:
           sdtyp = self.sensitive_types[typ]
         logger.info('+++  %-32s type:%-12s  --> Sensitive type: %s',o.name(), typ, sdtyp)
 
diff --git a/DDG4/python/g4MaterialScan.py b/DDG4/python/g4MaterialScan.py
index c5698a0d7..8d58d8dbd 100644
--- a/DDG4/python/g4MaterialScan.py
+++ b/DDG4/python/g4MaterialScan.py
@@ -36,7 +36,7 @@ def materialScan(opts):
     sd = geant4.description.sensitiveDetector(o.name())
     if sd.isValid():
       typ = sd.type()
-      if geant4.sensitive_types.has_key(typ):
+      if typ in geant4.sensitive_types:
         geant4.setupDetector(o.name(),geant4.sensitive_types[typ])
         sdtyp = geant4.sensitive_types[typ]
       else:
-- 
GitLab