Skip to content

Commit

Permalink
style: Fix python logging-related pylint and ruff warnings (OSGeo#3998)
Browse files Browse the repository at this point in the history
  • Loading branch information
echoix authored Jul 9, 2024
1 parent 18d11ad commit 2f5bed6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ ignore = [
"FURB154", # repeated-global
"FURB171", # single-item-membership-test
"FURB192", # sorted-min-max
"G002", # logging-percent-format
"G003", # logging-string-concat
"I001", # unsorted-imports
"ISC003", # explicit-string-concatenation
"PERF102", # incorrect-dict-iterator
Expand Down
2 changes: 1 addition & 1 deletion python/grass/pygrass/rpc/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def _check_restart_server(self, caller="main thread"):

if self.stopped is not True:
logging.warning(
"Needed to restart the libgis server, caller: %s" % (caller)
"Needed to restart the libgis server, caller: {caller}", caller=caller
)

self.threadLock.release()
Expand Down
13 changes: 9 additions & 4 deletions python/grass/temporal/c_libraries_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,9 @@ def _write_timestamp(lock, conn, data):
check = libgis.G_scan_timestamp(byref(ts), timestring)

if check != 1:
logging.error("Unable to convert the timestamp: " + timestring)
logging.error(
"Unable to convert the timestamp: {timestring}", timestring=timestring
)
return -2

if maptype == RPCDefs.TYPE_RASTER:
Expand Down Expand Up @@ -555,7 +557,8 @@ def _read_semantic_label(lock, conn, data):
semantic_label = decode(ret)
else:
logging.error(
"Unable to read semantic label. Unsupported map type %s" % maptype
"Unable to read semantic label. Unsupported map type {maptype}",
maptype=maptype,
)
return -1
except:
Expand Down Expand Up @@ -592,7 +595,8 @@ def _write_semantic_label(lock, conn, data):
libraster.Rast_write_semantic_label(name, semantic_label)
else:
logging.error(
"Unable to write semantic label. Unsupported map type %s" % maptype
"Unable to write semantic label. Unsupported map type {maptype}",
maptype=maptype,
)
return -2
except:
Expand Down Expand Up @@ -626,7 +630,8 @@ def _remove_semantic_label(lock, conn, data):
check = libgis.G_remove_misc("cell_misc", "semantic_label", name)
else:
logging.error(
"Unable to remove semantic label. Unsupported map type %s" % maptype
"Unable to remove semantic label. Unsupported map type {maptype}",
maptype=maptype,
)
return -2
except:
Expand Down

0 comments on commit 2f5bed6

Please sign in to comment.