Skip to content

Commit

Permalink
Change is/is not to ==/!= for literal comparisons (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
HuidaeCho committed Dec 19, 2019
1 parent 5edd165 commit 74fbbf9
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion gui/wxpython/core/gconsole.py
Expand Up @@ -597,7 +597,7 @@ def RunCmd(self, command, compReg=True, env=None, skipInterface=False,
for line in sfile.readlines():
if len(line) < 2:
continue
if line[0] is '#' and line[1] is '%':
if line[0] == '#' and line[1] == '%':
skipInterface = False
break
sfile.close()
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/dbmgr/vinfo.py
Expand Up @@ -167,7 +167,7 @@ def SelectFromTable(self, layer, cols='*', where=None):

table = self.layers[layer]["table"] # get table desc
# select values (only one record)
if where is None or where is '':
if where is None or where == '':
sql = "SELECT %s FROM %s" % (cols, table)
else:
sql = "SELECT %s FROM %s WHERE %s" % (cols, table, where)
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/gmodeler/model.py
Expand Up @@ -258,7 +258,7 @@ def GetMaps(self, prompt):
for data in self.GetData():
if prompt == data.GetPrompt():
mapName = data.GetValue()
if not mapName or mapName[0] is '%':
if not mapName or mapName[0] == '%':
continue # skip variables
maps.append(mapName)

Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/gui_core/gselect.py
Expand Up @@ -1865,7 +1865,7 @@ def SetSourceType(self, sourceType):
self.changingSizer.Show(
self.protocolPanel, show=(
sourceType == 'pro'))
self.changingSizer.Show(self.dbPanel, show=(sourceType is 'db'))
self.changingSizer.Show(self.dbPanel, show=(sourceType == 'db'))

self.changingSizer.Layout()

Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/location_wizard/wizard.py
Expand Up @@ -1303,7 +1303,7 @@ def OnSearch(self, event):
try:
self.ellipse, self.ellipsedesc = self.ellipselist.Search(
index=[0, 1], pattern=event.GetString())
if self.scope is 'earth':
if self.scope == 'earth':
self.ellipseparams = self.parent.ellipsoids[self.ellipse][1]
else:
self.ellipseparams = self.parent.planetary_ellipsoids[
Expand Down
2 changes: 1 addition & 1 deletion lib/python/pygrass/gis/__init__.py
Expand Up @@ -72,7 +72,7 @@ def _check_raise(value, path, type):
if value is empty return environmental variable
:rtype: str
"""
if value is '':
if value == '':
from grass.pygrass.utils import getenv
return getenv(type)
if is_valid(value, path, type):
Expand Down
4 changes: 2 additions & 2 deletions lib/python/temporal/core.py
Expand Up @@ -62,7 +62,7 @@ def profile_function(func):
"""Profiling function provided by the temporal framework"""
do_profiling = os.getenv("GRASS_TGIS_PROFILE")

if do_profiling is "True" or do_profiling is "1":
if do_profiling == "True" or do_profiling == "1":
import cProfile, pstats
try:
import StringIO as io
Expand Down Expand Up @@ -579,7 +579,7 @@ def init(raise_fatal_error=False):
enable_timestamp_write = False
msgr.warning("TGIS_DISABLE_TIMESTAMP_WRITE is True")

if driver_string is not None and driver_string is not "":
if driver_string is not None and driver_string != "":
driver_string = decode(driver_string)
if driver_string == "sqlite":
tgis_backend = driver_string
Expand Down
2 changes: 1 addition & 1 deletion lib/python/temporal/temporal_algebra.py
Expand Up @@ -2292,7 +2292,7 @@ def p_statement_assign(self, t):
# Do not register empty maps if not required
# In case of a null map continue, do not register null maps

if map_i.get_type() is "raster" or map_i.get_type() is "raster3d":
if map_i.get_type() == "raster" or map_i.get_type() == "raster3d":
if map_i.metadata.get_min() is None and \
map_i.metadata.get_max() is None:
if not self.register_null:
Expand Down
2 changes: 1 addition & 1 deletion scripts/d.rast.leg/d.rast.leg.py
Expand Up @@ -141,7 +141,7 @@ def main():
lmap = map

kv = grass.raster_info(map=lmap)
if kv['datatype'] is 'CELL':
if kv['datatype'] == 'CELL':
leg_at = None
else:
leg_at = '%f,95,5,10' % VSpacing
Expand Down

0 comments on commit 74fbbf9

Please sign in to comment.