diff --git a/awips/gfe/IFPClient.py b/awips/gfe/IFPClient.py index d1e3f46..5709af9 100644 --- a/awips/gfe/IFPClient.py +++ b/awips/gfe/IFPClient.py @@ -42,7 +42,7 @@ from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.server.messa # Date Ticket# Engineer Description # ------------ ---------- ----------- -------------------------- # 07/26/12 dgilling Initial Creation. -# +# 08/31/23 srcarter@ucar From MJ - replace type with isinstance # # @@ -59,7 +59,7 @@ class IFPClient(object): self.__siteId = site def commitGrid(self, request): - if type(request) is CommitGridRequest: + if isinstance(request, CommitGridRequest): return self.__commitGrid([request]) elif self.__isHomogenousIterable(request, CommitGridRequest): return self.__commitGrid([cgr for cgr in request]) @@ -74,8 +74,7 @@ class IFPClient(object): return ssr def getParmList(self, id): - argType = type(id) - if argType is DatabaseID: + if isinstance(argType, DatabaseID): return self.__getParmList([id]) elif self.__isHomogenousIterable(id, DatabaseID): return self.__getParmList([dbid for dbid in id]) @@ -102,7 +101,7 @@ class IFPClient(object): return True def getGridInventory(self, parmID): - if type(parmID) is ParmID: + if isinstance(parmID, ParmID): sr = self.__getGridInventory([parmID]) list = [] try: diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/db/objects/GFERecord.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/db/objects/GFERecord.py index 16453be..1ca1cd8 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/db/objects/GFERecord.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/db/objects/GFERecord.py @@ -39,12 +39,12 @@ class GFERecord(PersistableDataObject): self.dataTime = None self.parmId = None if timeRange is not None: - if type(timeRange) is TimeRange: + if isinstance(timeRange, TimeRange): self.dataTime = DataTime(refTime=timeRange.getStart(), validPeriod=timeRange) else: raise TypeError("Invalid TimeRange object specified.") if parmId is not None: - if type(parmId) is ParmID.ParmID: + if isinstance(parmId, ParmID.ParmID): self.parmId = parmId self.parmName = parmId.getParmName() self.parmLevel = parmId.getParmLevel() diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/db/objects/ParmID.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/db/objects/ParmID.py index e479aad..1d91003 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/db/objects/ParmID.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/db/objects/ParmID.py @@ -36,9 +36,9 @@ class ParmID(object): if (parmIdentifier is not None) and (dbId is not None): self.parmName = parmIdentifier - if type(dbId) is DatabaseID: + if isinstance(dbId, DatabaseID): self.dbId = dbId - elif type(dbId) is str: + elif isinstance(dbId, str): self.dbId = DatabaseID(dbId) else: raise TypeError("Invalid database ID specified.") diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/Level.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/Level.py index 594822d..5ae6273 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/Level.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/Level.py @@ -31,7 +31,7 @@ # 06/29/15 4480 dgilling Implement __hash__, __eq__, # __str__ and rich comparison operators. # 02/17/22 8608 mapeters Subclass PersistableDataObject -# +# 08/31/23 srcarter@ucar From MJ - replace type with isinstance # import numpy @@ -71,17 +71,15 @@ class Level(PersistableDataObject): return hashCode def __eq__(self, other): - if type(self) != type(other): - return False - else: + if isinstance(self, type(other)): return (self.masterLevel, self.levelonevalue, self.leveltwovalue) == \ (other.masterLevel, other.levelonevalue, other.leveltwovalue) - + return False def __ne__(self, other): return not self.__eq__(other) def __lt__(self, other): - if type(self) != type(other): + if not isinstance(self, type(other)): return NotImplemented elif self.masterLevel.getName() != other.masterLevel.getName(): return NotImplemented @@ -113,7 +111,7 @@ class Level(PersistableDataObject): return False def __le__(self, other): - if type(self) != type(other): + if not isinstance(self, type(other)): return NotImplemented elif self.masterLevel.getName() != other.masterLevel.getName(): return NotImplemented @@ -121,7 +119,7 @@ class Level(PersistableDataObject): return self.__lt__(other) or self.__eq__(other) def __gt__(self, other): - if type(self) != type(other): + if not isinstance(self, type(other)): return NotImplemented elif self.masterLevel.getName() != other.masterLevel.getName(): return NotImplemented @@ -153,7 +151,7 @@ class Level(PersistableDataObject): return False def __ge__(self, other): - if type(self) != type(other): + if not isinstance(self, type(other)): return NotImplemented elif self.masterLevel.getName() != other.masterLevel.getName(): return NotImplemented diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/MasterLevel.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/MasterLevel.py index caa50e7..84516ac 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/MasterLevel.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/MasterLevel.py @@ -30,7 +30,7 @@ # 06/29/15 4480 dgilling Implement __hash__, __eq__ # and __str__. # 02/17/22 8608 mapeters Subclass PersistableDataObject -# +# 08/31/23 srcarter@ucar From MJ - replace type with isinstance # from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.persist import PersistableDataObject @@ -49,7 +49,7 @@ class MasterLevel(PersistableDataObject): return hash(self.name) def __eq__(self, other): - if type(self) != type(other): + if not isinstance(self, type(other)): return False else: return self.name == other.name