Skip to content

Commit

Permalink
Merge pull request #1321 from janisozaur/is-none
Browse files Browse the repository at this point in the history
Compare to `None` using identity `is` operator
  • Loading branch information
jturney committed Nov 2, 2018
2 parents bfc839d + 9a8feec commit 56b8841
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion psi4/driver/p4util/python_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def py_psi_set_global_option_python(key, EXTERN):
if (key != "EXTERN"):
raise ValidationError("Options: set_global_option_python does not recognize keyword %s" % key)

if EXTERN == None:
if EXTERN is None:
core.EXTERN = None
core.set_global_option("EXTERN", False)
elif isinstance(EXTERN, core.ExternalPotential):
Expand Down
18 changes: 9 additions & 9 deletions psi4/driver/qcdb/libmintscoordentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,15 +487,15 @@ def invalidate(self):
def print_in_input_format(self):
"""Prints the updated geometry, in the format provided by the user"""
text = ""
if self.rto == None and self.ato == None and self.dto == None:
if self.rto is None and self.ato is None and self.dto is None:
# The first atom
text += "\n"
elif self.ato == None and self.dto == None:
elif self.ato is None and self.dto is None:
# The second atom
now_rto = self.rto.entry_number() + 1
now_rval = self.rval.variable_to_string(10)
text += " %5d %11s\n" % (now_rto, now_rval)
elif self.dto == None:
elif self.dto is None:
# The third atom
now_rto = self.rto.entry_number() + 1
now_rval = self.rval.variable_to_string(10)
Expand All @@ -518,15 +518,15 @@ def print_in_input_format(self):
def print_in_input_format_cfour(self):
"""Prints the updated geometry, in the format provided by the user"""
text = ""
if self.rto == None and self.ato == None and self.dto == None:
if self.rto is None and self.ato is None and self.dto is None:
# The first atom
text += "\n"
elif self.ato == None and self.dto == None:
elif self.ato is None and self.dto is None:
# The second atom
now_rto = self.rto.entry_number() + 1
now_rval = self.rval.variable_to_string(10)
text += " %d %s\n" % (now_rto, now_rval)
elif self.dto == None:
elif self.dto is None:
# The third atom
now_rto = self.rto.entry_number() + 1
now_rval = self.rval.variable_to_string(10)
Expand Down Expand Up @@ -594,21 +594,21 @@ def compute(self):
return self.coordinates

# place first atom at the origin
if self.rto == None and self.ato == None and self.dto == None:
if self.rto is None and self.ato is None and self.dto is None:
self.coordinates[0] = 0.0
self.coordinates[1] = 0.0
self.coordinates[2] = 0.0

# place second atom directly above the first
elif self.ato == None and self.dto == None:
elif self.ato is None and self.dto is None:
self.coordinates[0] = 0.0
self.coordinates[1] = 0.0
self.coordinates[2] = self.rval.compute()

# place third atom pointing upwards
# this rTo rVal aTo aVal
# A B C
elif self.dto == None:
elif self.dto is None:
r = self.rval.compute()
a = self.aval.compute() * math.pi / 180.0
cosABC = math.cos(a)
Expand Down
2 changes: 1 addition & 1 deletion psi4/driver/qcdb/libmintsmolecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,7 @@ def rotor_type(self, tol=FULL_PG_TOL):
"""
rot_const = self.rotational_constants()
for i in range(3):
if rot_const[i] == None:
if rot_const[i] is None:
rot_const[i] = 0.0

# Determine degeneracy of rotational constants.
Expand Down
2 changes: 1 addition & 1 deletion psi4/driver/qcdb/psiutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def query_yes_no(question, default=True):
yes = re.compile(r'^(y|yes|true|on|1)', re.IGNORECASE)
no = re.compile(r'^(n|no|false|off|0)', re.IGNORECASE)

if default == None:
if default is None:
prompt = " [y/n] "
elif default == True:
prompt = " [Y/n] "
Expand Down

0 comments on commit 56b8841

Please sign in to comment.