From 46352abebe5f959c912260c2b6d3c376cce754e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 5 Oct 2024 19:20:34 +0000 Subject: [PATCH] Apply black --- gui/wxpython/core/gconsole.py | 14 ++++++-------- gui/wxpython/history/tree.py | 4 +--- gui/wxpython/location_wizard/wizard.py | 5 +---- python/grass/pygrass/errors.py | 8 ++------ python/grass/temporal/abstract_map_dataset.py | 5 +---- 5 files changed, 11 insertions(+), 25 deletions(-) diff --git a/gui/wxpython/core/gconsole.py b/gui/wxpython/core/gconsole.py index 6cf4cfcea5..a4b58435cf 100644 --- a/gui/wxpython/core/gconsole.py +++ b/gui/wxpython/core/gconsole.py @@ -589,9 +589,7 @@ def RunCmd( import importlib.machinery def load_source(modname, filename): - loader = importlib.machinery.SourceFileLoader( - modname, filename - ) + loader = importlib.machinery.SourceFileLoader(modname, filename) spec = importlib.util.spec_from_file_location( modname, filename, loader=loader ) @@ -625,9 +623,9 @@ def load_source(modname, filename): if hasParams and not isinstance(self._guiparent, FormNotebook): # also parent must be checked, see #3135 for details try: - GUI( - parent=self._guiparent, giface=self._giface - ).ParseCommand(command) + GUI(parent=self._guiparent, giface=self._giface).ParseCommand( + command + ) self.UpdateHistory(status=Status.SUCCESS) except GException as e: print(e, file=sys.stderr) @@ -657,8 +655,8 @@ def load_source(modname, filename): ) self.cmdOutputTimer.Start(50) - # we don't need to change computational region settings - # because we work on a copy + # we don't need to change computational region settings + # because we work on a copy else: # Send any other command to the shell. Send output to # console output window diff --git a/gui/wxpython/history/tree.py b/gui/wxpython/history/tree.py index 68374dd45e..3701fefb00 100644 --- a/gui/wxpython/history/tree.py +++ b/gui/wxpython/history/tree.py @@ -407,9 +407,7 @@ def GetHistoryNode(self, entry, command_index=None): # If no command index is specified, return the first found day node return day_nodes[0] # Search for command nodes under the first day node - command_nodes = self._model.SearchNodes( - parent=day_nodes[0], type=COMMAND - ) + command_nodes = self._model.SearchNodes(parent=day_nodes[0], type=COMMAND) if 0 <= command_index < len(command_nodes): return command_nodes[command_index] diff --git a/gui/wxpython/location_wizard/wizard.py b/gui/wxpython/location_wizard/wizard.py index a109128d1f..d8b6b4180b 100644 --- a/gui/wxpython/location_wizard/wizard.py +++ b/gui/wxpython/location_wizard/wizard.py @@ -1918,10 +1918,7 @@ def OnPageChanging(self, event): # splitting on space alone would break for grid files with # space in pathname for projterm in projlabel.split(" +"): - if ( - projterm.find("towgs84=") != -1 - or projterm.find("nadgrids=") != -1 - ): + if projterm.find("towgs84=") != -1 or projterm.find("nadgrids=") != -1: self.custom_dtrans_string = " +%s" % projterm break diff --git a/python/grass/pygrass/errors.py b/python/grass/pygrass/errors.py index bcba93cbca..a017b85b33 100644 --- a/python/grass/pygrass/errors.py +++ b/python/grass/pygrass/errors.py @@ -22,9 +22,7 @@ def mapinfo_must_be_set(method): def wrapper(self, *args, **kargs): if self.c_mapinfo: return method(self, *args, **kargs) - raise GrassError( - _("The self.c_mapinfo pointer must be correctly initiated") - ) + raise GrassError(_("The self.c_mapinfo pointer must be correctly initiated")) return wrapper @@ -34,8 +32,6 @@ def must_be_in_current_mapset(method): def wrapper(self, *args, **kargs): if self.mapset == libgis.G_mapset().decode(): return method(self, *args, **kargs) - raise GrassError( - _("Map <{}> not found in current mapset").format(self.name) - ) + raise GrassError(_("Map <{}> not found in current mapset").format(self.name)) return wrapper diff --git a/python/grass/temporal/abstract_map_dataset.py b/python/grass/temporal/abstract_map_dataset.py index 7e8da21208..ecbf761d13 100644 --- a/python/grass/temporal/abstract_map_dataset.py +++ b/python/grass/temporal/abstract_map_dataset.py @@ -442,10 +442,7 @@ def set_absolute_time(self, start_time, end_time=None): ) return False self.msgr.error( - _( - "Start time must be of type datetime for " - "%(type)s map <%(id)s>" - ) + _("Start time must be of type datetime for %(type)s map <%(id)s>") % {"type": self.get_type(), "id": self.get_map_id()} ) return False