Skip to content

Commit

Permalink
style: use is True instead of == True (#3845)
Browse files Browse the repository at this point in the history
`== True` (or `== False`) is not a boolean operator and can lead to wrong results

* `is` is also unnoticeably faster
  • Loading branch information
pesekon2 authored Jun 16, 2024
1 parent 5fbf526 commit 4d00732
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gui/wxpython/location_wizard/wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -2520,7 +2520,7 @@ def __init__(self, parent, grassdatabase):
self.grassdatabase = self.startpage.grassdatabase
self.georeffile = self.filepage.georeffile
# FIXME here was code for setting default region, what for is this if:
# if self.altdb == False:
# if self.altdb is False:

else: # -> error
self.wizard.Destroy()
Expand Down
8 changes: 4 additions & 4 deletions python/grass/docs/src/temporal_framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ to access its registered maps.
strds = tgis.SpaceTimeRasterDataset(id)
# Check if the space time raster dataset is in the temporal database
if strds.is_in_db(dbif=dbif) == False:
if strds.is_in_db(dbif=dbif) is False:
dbif.close()
gs.fatal(_("Space time %s dataset <%s> not found") % (
strds.get_new_map_instance(None).get_type(), id))
Expand Down Expand Up @@ -355,14 +355,14 @@ for different space time datasets (raster, 3D raster and vector):
dbif.connect()
# First we check if the dataset is already in the database
if stds.is_in_db(dbif=dbif) and overwrite == False:
if stds.is_in_db(dbif=dbif) and overwrite is False:
dbif.close()
gs.fatal(_("Space time %s dataset <%s> is already in the database. "
"Use the overwrite flag.") %
(stds.get_new_map_instance(None).get_type(), name))
# We delete the exiting dataset and create a new one in case we are allowed to overwrite it
if stds.is_in_db(dbif=dbif) and overwrite == True:
if stds.is_in_db(dbif=dbif) and overwrite is True:
gs.warning(_("Overwrite space time %s dataset <%s> "
"and unregister all maps.") %
(stds.get_new_map_instance(None).get_type(), name))
Expand Down Expand Up @@ -399,7 +399,7 @@ Temporal shifting
stds = tgis.dataset_factory(type, id)
if stds.is_in_db(dbif) == False:
if stds.is_in_db(dbif) is False:
dbif.close()
gs.fatal(_("Space time dataset <%s> not found in temporal database") % (id))
Expand Down
2 changes: 1 addition & 1 deletion utils/gitlog2changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
elif "Signed-off-by" in line:
continue
# Extract the actual commit message for this commit
elif authorFound & dateFound & messageFound == False:
elif authorFound & dateFound & messageFound is False:
# Find the commit message if we can
if len(line) == 1:
if messageNL:
Expand Down

0 comments on commit 4d00732

Please sign in to comment.