@@ -76,7 +76,7 @@ def updateChannelFinder(
7676 username = channelfinder username
7777 password = channelfinder password
7878 """
79- if hostName == None or iocName == None :
79+ if hostName is None or iocName is None :
8080 raise RuntimeError ("missing hostName or iocName" )
8181 channels = []
8282 try :
@@ -89,9 +89,9 @@ def updateChannelFinder(
8989 previousChannelsList = client .findByArgs (
9090 [("hostName" , hostName ), ("iocName" , iocName )]
9191 )
92- if previousChannelsList != None :
92+ if previousChannelsList is not None :
9393 for ch in previousChannelsList :
94- if pvNames != None and ch ["name" ] in pvNames :
94+ if pvNames is not None and ch ["name" ] in pvNames :
9595 """"""
9696 channels .append (
9797 updateChannel (
@@ -104,7 +104,7 @@ def updateChannelFinder(
104104 )
105105 )
106106 pvNames .remove (ch ["name" ])
107- elif pvNames == None or ch ["name" ] not in pvNames :
107+ elif pvNames is None or ch ["name" ] not in pvNames :
108108 """Orphan the channel : mark as inactive, keep the old hostName and iocName"""
109109 oldHostName = [
110110 prop ["value" ]
@@ -141,7 +141,7 @@ def updateChannelFinder(
141141 time = time ,
142142 )
143143 )
144- elif ch [0 ] != None :
144+ elif ch [0 ] is not None :
145145 """update existing channel: exists but with a different hostName and/or iocName"""
146146 channels .append (
147147 updateChannel (
@@ -174,9 +174,9 @@ def updateChannel(
174174 ]
175175 else :
176176 properties = []
177- if hostName != None :
177+ if hostName is not None :
178178 properties .append ({"name" : "hostName" , "owner" : owner , "value" : hostName })
179- if iocName != None :
179+ if iocName is not None :
180180 properties .append ({"name" : "iocName" , "owner" : owner , "value" : iocName })
181181 if pvStatus :
182182 properties .append ({"name" : "pvStatus" , "owner" : owner , "value" : pvStatus })
@@ -193,11 +193,11 @@ def createChannel(
193193 Helper to create a channel object with the required properties
194194 """
195195 ch = {"name" : chName , "owner" : chOwner , "properties" : []}
196- if hostName != None :
196+ if hostName is not None :
197197 ch ["properties" ].append (
198198 {"name" : "hostName" , "owner" : chOwner , "value" : hostName }
199199 )
200- if iocName != None :
200+ if iocName is not None :
201201 ch ["properties" ].append ({"name" : "iocName" , "owner" : chOwner , "value" : iocName })
202202 if pvStatus :
203203 ch ["properties" ].append (
@@ -214,7 +214,7 @@ def checkPropertiesExist(client, propOwner):
214214 """
215215 requiredProperties = ["hostName" , "iocName" , "pvStatus" , "time" ]
216216 for propName in requiredProperties :
217- if client .findProperty (propName ) == None :
217+ if client .findProperty (propName ) is None :
218218 try :
219219 client .set (property = {"name" : propName , "owner" : propOwner })
220220 except Exception as e :
@@ -226,7 +226,7 @@ def ifNoneReturnDefault(object, default):
226226 """
227227 if the object is None or empty string then this function returns the default value
228228 """
229- if object == None and object ! = "" :
229+ if object is None or object = = "" :
230230 return default
231231 else :
232232 return object
@@ -348,7 +348,7 @@ def main():
348348 help = "prompt user for password" ,
349349 )
350350 opts , args = parser .parse_args ()
351- if len ( args ) == 0 or args == None :
351+ if not args :
352352 parser .error ("Please specify a file" )
353353 mainRun (opts , args )
354354
0 commit comments