Skip to content

Commit acb7581

Browse files
authored
Merge pull request BOINC#4532 from barton2526/isNone
Use `is None` instead of `== None`
2 parents f71d583 + 092e8bc commit acb7581

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

py/Boinc/boincxml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def get_element(node, name, optional=True):
2828
raise SystemExit("ERROR: Couldn't find xml node <%s>"% name)
2929

3030
def _None2Str(object):
31-
if object == None:
31+
if object is None:
3232
return ''
3333
else:
3434
return object

py/Boinc/db_base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ def _commit_object(tablename, paramdict, id=None):
6969
equalcommands = []
7070
for key in paramdict.keys():
7171
value = paramdict[key]
72-
if value == None:
72+
if value is None:
7373
continue
7474
elif isinstance(value, int):
7575
equalcommands.append('%s=%d' %(key,value))
7676
else:
7777
equalcommands.append("%s='%s'"%(key,dbconnection.escape_string(str(value))))
78-
if id == None:
78+
if id is None:
7979
command = 'INSERT INTO %s SET %s' % \
8080
(tablename, ', '.join(equalcommands))
8181
if debug.mysql:
@@ -97,7 +97,7 @@ def _remove_object(command, id=None):
9797
id is given, it assembles the SQL command and deletes the object
9898
from the database. Does nothing if no id is given."""
9999
assert(dbconnection)
100-
if id == None:
100+
if id is None:
101101
pass
102102
else:
103103
cursor = dbconnection.cursor()
@@ -122,7 +122,7 @@ def _select_object(table, searchdict, extra_args="", extra_params=[], select_wha
122122
if join:
123123
command += "," + join
124124
for (key,value) in searchdict.items():
125-
if value == None:
125+
if value is None:
126126
value = ''
127127
escaped_value = dbconnection.escape_string(str(value))
128128
if key == 'text':

py/Boinc/setup_project.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def verbose_sleep(msg, wait):
5757

5858
def get_env_var(name, default = None):
5959
value = os.environ.get(name, default)
60-
if value == None:
60+
if value is None:
6161
print("Environment variable %s not defined" % name)
6262
sys.exit(1)
6363
return value
@@ -209,7 +209,7 @@ def _check_vars(dict, **names):
209209
for key in names:
210210
value = names[key]
211211
if not key in dict:
212-
if value == None:
212+
if value is None:
213213
raise SystemExit('error in test script: required parameter "%s" not specified'%key)
214214
dict[key] = value
215215
for key in dict:

sched/assimilator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def do_pass(self, app):
180180
if result == wu.canonical_result:
181181
canonical_result=result
182182

183-
if canonical_result == None and wu.error_mask == 0:
183+
if canonical_result is None and wu.error_mask == 0:
184184
# If no canonical result found and WU had no other errors,
185185
# something is wrong, e.g. result records got deleted prematurely.
186186
# This is probably unrecoverable, so mark the WU as having

tests/old/testbase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def _check_vars(dict, **names):
125125
for key in names:
126126
value = names[key]
127127
if not key in dict:
128-
if value == None:
128+
if value is None:
129129
raise SystemExit('error in test script: required parameter "%s" not specified'%key)
130130
dict[key] = value
131131
for key in dict:

0 commit comments

Comments
 (0)