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 various FURB (small count) #4046

Merged
merged 5 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
6 changes: 2 additions & 4 deletions gui/wxpython/animation/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
HashCmds,
)
from animation.data import AnimationData
from itertools import starmap


class AnimationController(wx.EvtHandler):
Expand Down Expand Up @@ -368,10 +369,7 @@ def _updateAnimations(self, activeIndices, mapNamesDict=None):
if anim.viewMode == "3d":
regions = [None] * len(regions)
self.animations[i].SetFrames(
[
HashCmds(cmdList, region)
for cmdList, region in zip(anim.cmdMatrix, regions)
]
list(starmap(HashCmds, zip(anim.cmdMatrix, regions)))
)
self.animations[i].SetActive(True)
else:
Expand Down
3 changes: 1 addition & 2 deletions gui/wxpython/animation/temporal_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ def _setTemporalState(self):
# check for units for relative type
if relative:
units = set()
for infoDict in self.timeseriesInfo.values():
units.add(infoDict["unit"])
units.update(infoDict["unit"] for infoDict in self.timeseriesInfo.values())
if len(units) > 1:
message = _(
"It is not allowed to display data with different units (%s)."
Expand Down
3 changes: 1 addition & 2 deletions gui/wxpython/animation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ def checkSeriesCompatibility(mapSeriesList=None, timeseriesList=None):

if mapSeriesList:
count = set()
for mapSeries in mapSeriesList:
count.add(len(mapSeries))
count.update(len(mapSeries) for mapSeries in mapSeriesList)
if len(count) > 1:
raise GException(
_(
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/core/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ def _projInfo(self):
for line in ret.splitlines():
if ":" in line:
key, val = (x.strip() for x in line.split(":", 1))
if key in {"units"}:
if key == "units":
val = val.lower()
projinfo[key] = val
elif "XY location (unprojected)" in line:
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/core/toolboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def getMessages():


def clearMessages():
del _MESSAGES[:]
_MESSAGES.clear()


def _debug(level, message):
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/mapwin/buffered.py
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@ def OnDragging(self, event):
self.mouse["end"] = event.GetPosition()
if event.LeftIsDown() and not (
digitToolbar
and digitToolbar.GetAction() in {"moveLine"}
and digitToolbar.GetAction() == "moveLine"
and len(self.digit.GetDisplay().GetSelected()) > 0
):
self.MouseDraw(pdc=self.pdcTmp)
Expand Down
4 changes: 2 additions & 2 deletions gui/wxpython/psmap/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3978,7 +3978,7 @@ def OnIsLegend(self, event):
if page == 0 or event is None:
children = self.panelRaster.GetChildren()
if self.isRLegend.GetValue():
for i, widget in enumerate(children):
for widget in children:
widget.Enable()
self.OnRaster(None)
self.OnRange(None)
Expand All @@ -3990,7 +3990,7 @@ def OnIsLegend(self, event):
if page == 1 or event is None:
children = self.panelVector.GetChildren()
if self.isVLegend.GetValue():
for i, widget in enumerate(children):
for widget in children:
widget.Enable()
self.OnSpan(None)
self.OnBorder(None)
Expand Down
2 changes: 1 addition & 1 deletion lib/init/grass.py
Original file line number Diff line number Diff line change
Expand Up @@ -2520,7 +2520,7 @@ def main():
)
if sh in {"csh", "tcsh"}:
shell_process = csh_startup(mapset_settings.full_mapset, grass_env_file)
elif sh in {"zsh"}:
elif sh == "zsh":
shell_process = sh_like_startup(
mapset_settings.full_mapset,
mapset_settings.location,
Expand Down
5 changes: 0 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,8 @@ ignore = [
"FURB101", # read-whole-file
"FURB103", # write-whole-file.
"FURB118", # reimplemented-operator
"FURB131", # delete-full-slice
"FURB140", # reimplemented-starmap
"FURB142", # for-loop-set-mutations
"FURB148", # unnecessary-enumerate
"FURB152", # math-constant
"FURB154", # repeated-global
"FURB171", # single-item-membership-test
"I001", # unsorted-imports
"ISC003", # explicit-string-concatenation
"PERF203", # try-except-in-loop
Expand Down
8 changes: 4 additions & 4 deletions python/grass/grassdb/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def filter(json_data, command, timestamp):
return None


def _remove_entry_from_plain_text(history_path, index):
def _remove_entry_from_plain_text(history_path, index: int):
"""Remove entry from plain text history file.
:param str history_path: path to the history log file
Expand All @@ -174,7 +174,7 @@ def _remove_entry_from_plain_text(history_path, index):
file_history.seek(0)
file_history.truncate()
for number, line in enumerate(lines):
if number not in [index]:
if number != index:
file_history.write(line)
except OSError as e:
raise OSError(
Expand All @@ -184,7 +184,7 @@ def _remove_entry_from_plain_text(history_path, index):
) from e


def _remove_entry_from_JSON(history_path, index):
def _remove_entry_from_JSON(history_path, index: int):
"""Remove entry from JSON history file.
:param str history_path: path to the history log file
Expand Down Expand Up @@ -214,7 +214,7 @@ def _remove_entry_from_JSON(history_path, index):
) from e


def remove_entry(history_path, index):
def remove_entry(history_path, index: int):
"""Remove entry from history file.
:param str history_path: path to the history log file
Expand Down
2 changes: 1 addition & 1 deletion scripts/g.extension/g.extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -1900,7 +1900,7 @@ def download_source_code(
)
)
download_source_code_svn(url, name, outdev, directory)
elif source in {"remote_zip"}:
elif source == "remote_zip":
gs.message(
_("Fetching <{name}> from <{url}> (be patient)...").format(
name=name, url=url
Expand Down
Loading