Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Fix yoda-conditions (SIM300) #4044

Merged
merged 2 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gui/wxpython/core/gcmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def kill(self):
import win32api

handle = win32api.OpenProcess(1, 0, self.pid)
return 0 != win32api.TerminateProcess(handle, 0)
return win32api.TerminateProcess(handle, 0) != 0
else:
try:
os.kill(-self.pid, signal.SIGTERM) # kill whole group
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def GetLayerNameFromCmd(dcmd, fullyQualified=False, param=None, layerType=None):
if len(dcmd) < 1:
return mapname, False

if "d.grid" == dcmd[0]:
if dcmd[0] == "d.grid":
mapname = "grid"
elif "d.geodesic" in dcmd[0]:
mapname = "geodesic"
Expand Down
13 changes: 7 additions & 6 deletions gui/wxpython/iclass/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,8 +857,9 @@ def ExportAreas(self, vectorName, withTable):
% {"band": i + 1, "stat": statistic, "format": format}
)

if 0 != RunCommand(
"v.db.addtable", map=vectorName, columns=columns, parent=self
if (
RunCommand("v.db.addtable", map=vectorName, columns=columns, parent=self)
!= 0
):
wx.EndBusyCursor()
return False
Expand Down Expand Up @@ -1305,10 +1306,10 @@ def CheckInput(self, group, vector):
rasterInfo = gs.raster_info(groupLayers[0])

if (
regionBox.N > rasterInfo["north"]
or regionBox.S < rasterInfo["south"]
or regionBox.E > rasterInfo["east"]
or regionBox.W < rasterInfo["west"]
rasterInfo["north"] < regionBox.N
or rasterInfo["south"] > regionBox.S
or rasterInfo["east"] < regionBox.E
or rasterInfo["west"] > regionBox.W
):
GMessage(
parent=self,
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/lmgr/layertree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ def OnCopyMap(self, event):
return

kwargs = {key: "%s,%s" % (lnameSrc, lnameDst)}
if 0 != RunCommand("g.copy", overwrite=True, **kwargs):
if RunCommand("g.copy", overwrite=True, **kwargs) != 0:
GError(_("Unable to make copy of <%s>") % lnameSrc, parent=self)
return

Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/web_services/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ def UpdateWidgetsByCmd(self, cmd):

if "bgcolor" in dcmd and self.params["bgcolor"]:
bgcolor = dcmd["bgcolor"].strip().lower()
if len(bgcolor) == 8 and "0x" == bgcolor[:2]:
if len(bgcolor) == 8 and bgcolor[:2] == "0x":
colour = "#" + bgcolor[2:]
self.params["bgcolor"].SetColour(colour)

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ ignore = [
"SIM118", # in-dict-keys
"SIM201", # negate-equal-op
"SIM223", # expr-and-false
"SIM300", # yoda-conditions
"SIM401", # if-else-block-instead-of-dict-get
"SLF001", # private-member-access
"TRY002", # raise-vanilla-class
Expand Down
Loading
Loading