Skip to content

Commit

Permalink
style: Apply ruff format changes not conflicting with Black 25
Browse files Browse the repository at this point in the history
  • Loading branch information
echoix committed Feb 2, 2025
1 parent f580a14 commit 8f1d740
Show file tree
Hide file tree
Showing 239 changed files with 255 additions and 712 deletions.
3 changes: 0 additions & 3 deletions src/display/d.vect.thematic2/d.vect.thematic2.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,6 @@ def main():
# graduated points and line widths thematic mapping

if themetype in ["graduated_points", "graduated_lines"]:

# display graduated points/lines by intervals
if themecalc == "interval":
out(
Expand Down Expand Up @@ -1013,7 +1012,6 @@ def main():

# display graduated points/lines for standard deviation units
if themecalc == "std_deviation":

out(
f_graph,
locals(),
Expand Down Expand Up @@ -1045,7 +1043,6 @@ def main():

# display graduated points/lines for quartiles
if themecalc == "quartiles":

out(
f_graph,
locals(),
Expand Down
8 changes: 4 additions & 4 deletions src/general/g.citation/g.citation.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ def internal_to_csl_json(citation):


def print_using_citeproc(csl_json, keys, style):

from citeproc import CitationStylesStyle, CitationStylesBibliography
from citeproc import Citation, CitationItem
from citeproc import formatter
Expand Down Expand Up @@ -778,8 +777,9 @@ def print_chicago_footnote(citation, output):
authors_text += ", and "
title = "GRASSS GIS module {}".format(citation["module"])
print(
"{authors_text}, {title} ({grass-version}), computer software"
" ({year}).".format(authors_text=authors_text, title=title, **citation),
"{authors_text}, {title} ({grass-version}), computer software ({year}).".format(
authors_text=authors_text, title=title, **citation
),
file=output,
)

Expand Down Expand Up @@ -937,7 +937,7 @@ def main(options, flags):
if output_format == "citeproc":
if not options["style"]:
gs.fatal(
_("Option format=citeproc requires also" " the option style to be set")
_("Option format=citeproc requires also the option style to be set")
)
vertical_separator = options["vertical_separator"]
output = options["output"]
Expand Down
14 changes: 8 additions & 6 deletions src/general/g.download.location/g.download.location.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ def move_extracted_files(extract_dir, target_dir, files):
def extract_zip(name, directory, tmpdir):
"""Extract a ZIP file into a directory"""
gs.debug(
"extract_zip(name={name}, directory={directory},"
" tmpdir={tmpdir})".format(name=name, directory=directory, tmpdir=tmpdir),
"extract_zip(name={name}, directory={directory}, tmpdir={tmpdir})".format(
name=name, directory=directory, tmpdir=tmpdir
),
3,
)
try:
Expand All @@ -136,8 +137,9 @@ def extract_zip(name, directory, tmpdir):
def extract_tar(name, directory, tmpdir):
"""Extract a TAR or a similar file into a directory"""
gs.debug(
"extract_tar(name={name}, directory={directory},"
" tmpdir={tmpdir})".format(name=name, directory=directory, tmpdir=tmpdir),
"extract_tar(name={name}, directory={directory}, tmpdir={tmpdir})".format(
name=name, directory=directory, tmpdir=tmpdir
),
3,
)
try:
Expand Down Expand Up @@ -167,7 +169,7 @@ def download_end_extract(source):
f, h = urlretrieve(source, archive_name)
if h.get("content-type", "") != "application/zip":
raise DownloadError(
_("Download of <%s> failed " "or file is not a ZIP file") % source
_("Download of <%s> failed or file is not a ZIP file") % source
)
extract_zip(name=archive_name, directory=directory, tmpdir=tmpdir)
elif "." in source and (
Expand Down Expand Up @@ -257,7 +259,7 @@ def main(options, flags):
destination = os.path.join(database, name)

if os.path.exists(destination):
gs.fatal(_("Location named <%s> already exists," " download canceled") % name)
gs.fatal(_("Location named <%s> already exists, download canceled") % name)
return

gs.message(_("Downloading and extracting..."))
Expand Down
1 change: 0 additions & 1 deletion src/gui/wxpython/wx.metadata/db.csw.admin/db.csw.admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ def argParser(
return False

def run(self, argv):

if len(argv) == 0:
grass.error("Nothing to do. Set args")
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,6 @@ def initEditor(
GMessage("Select map in data catalog...")

def _layout(self):

self.mainSizer = wx.BoxSizer(wx.VERTICAL)

# self.toolbarPanelSizer = wx.BoxSizer(wx.HORIZONTAL)
Expand Down
21 changes: 6 additions & 15 deletions src/gui/wxpython/wx.metadata/m.csw.update/m.csw.update.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ def __init__(
active_xml_csw_url=False,
not_valid_xml_csw_url=False,
):

from mdlib.dependency import check_dependencies

module_not_found = []
Expand Down Expand Up @@ -384,8 +383,7 @@ def _spreadsheet_file_url(self, path):
if not os.path.exists(path):
gscript.fatal(
_(
"Spreadsheets file '{}' "
"doesn't exists.".format(
"Spreadsheets file '{}' doesn't exists.".format(
path,
),
),
Expand Down Expand Up @@ -432,8 +430,7 @@ def _conns_resrs_xml(self, path):
if not os.path.exists(path):
gscript.fatal(
_(
"Connnections resources file '{}' "
"doesn't exists.".format(
"Connnections resources file '{}' doesn't exists.".format(
path,
),
),
Expand Down Expand Up @@ -586,7 +583,7 @@ def _not_valid_xml_csw_url(self):
def _not_valid_xml_csw_url(self, value):
if not isinstance(value, bool):
gscript.fatal(
_("Param 'not_valid_xml_csw_url' arg require " "boolean value"),
_("Param 'not_valid_xml_csw_url' arg require boolean value"),
)
self.__not_valid_xml_csw_url = value

Expand Down Expand Up @@ -1013,7 +1010,7 @@ def append_csw():

def _get_data_format(self):
"""Get dat row format"""
return "{country}, " "{govermental_level}, " "{api_provider}{separator}" "{url}"
return "{country}, {govermental_level}, {api_provider}{separator}{url}"

def _split_data_row(self, row):
"""Split data row string
Expand Down Expand Up @@ -1045,14 +1042,12 @@ def _print_csw_conn_element(self, row):
name, url = self._split_data_row(row)

if self._valid_csw_url:

# Valid and active
if self._active_csw_url:
if (
url not in self._not_valid_csw_urls
and url not in self._not_active_csw_urls
):

self._print_result = join_char.join(
[
self._print_result,
Expand All @@ -1071,7 +1066,6 @@ def _print_csw_conn_element(self, row):
)

elif self._not_valid_csw_url:

if url in self._not_valid_csw_urls:
self._print_result = join_char.join(
[
Expand Down Expand Up @@ -1100,7 +1094,6 @@ def _print_csw_conn_element(self, row):
url in self._not_active_csw_urls
and url not in self._not_valid_csw_urls
):

self._print_result = join_char.join(
[
self._print_result,
Expand Down Expand Up @@ -1165,8 +1158,7 @@ def _print_summary_stats(self):
[
self._print_summary_result,
(
"Number of new connections resource"
"{value:.>25}{eof}".format(
"Number of new connections resource{value:.>25}{eof}".format(
value=self._new_connections
- len(self._not_valid_csw_urls)
- len(self._not_active_csw_urls),
Expand Down Expand Up @@ -1219,8 +1211,7 @@ def _print_summary_stats(self):
[
self._print_summary_result,
(
"Sum"
"{value:.>57}{eof}".format(
"Sum{value:.>57}{eof}".format(
value=self._new_connections,
eof=eof,
)
Expand Down
3 changes: 0 additions & 3 deletions src/gui/wxpython/wx.metadata/mdlib/cswlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,6 @@ def findServices(self, record, item):
]
services = {}
for link in links:

if "scheme" in link:
link_type = link["scheme"]
elif "protocol" in link:
Expand Down Expand Up @@ -543,7 +542,6 @@ def refreshServiceButt(self, stat=False):
self.bttAddWcs.Enable()

def OnNavigate(self, evt):

name = evt.GetEventObject().GetLabel()
if name == "<<":
self.startfrom = 0
Expand Down Expand Up @@ -883,7 +881,6 @@ def displyResultsGMD(self):
self.findResNumLbl.SetLabel(msg)
index = 0
for rec in self.catalog.records:

if self.catalog.records[rec].identification.identtype:
item = wx.ListItem()
self.resultList.InsertStringItem(
Expand Down
6 changes: 3 additions & 3 deletions src/gui/wxpython/wx.metadata/mdlib/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
},
}

INSTALLED_VERSION_MESSAGE = "Installed version of {} library is " "<{}>."
INSTALLED_VERSION_MESSAGE = "Installed version of {} library is <{}>."
REQ_VERSION_MESSAGE = (
"{name} {version} is required. " "check requirements on the manual page <{url}>."
"{name} {version} is required. check requirements on the manual page <{url}>."
)


Expand Down Expand Up @@ -115,7 +115,7 @@ def check_dependencies(module_name, check_version=False):
except ModuleNotFoundError:
message = "{name} {text} <{url}>.\n".format(
name=module_name,
text="library is missing. Check requirements on the " "manual page",
text="library is missing. Check requirements on the manual page",
url=URL,
)
sys.stderr.write(message)
Expand Down
6 changes: 0 additions & 6 deletions src/gui/wxpython/wx.metadata/mdlib/mdeditorfactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class MdFileWork:
"""initializer of metadata in OWSLib and export OWSLib object to xml by jinja template system"""

def __init__(self, pathToXml=None):

try:
global Environment, FileSystemLoader, etree, GError, GMessage, mdutil

Expand Down Expand Up @@ -659,7 +658,6 @@ def fillComboDB(self, label):
self.valueCtrl.Append(lng)

def validators(self, validationStyle):

if validationStyle == "email":
return EmailValidator()

Expand Down Expand Up @@ -811,7 +809,6 @@ def setValue(self, value):
self.valueCtrl.SetValue(value)

def getValue(self):

value = mdutil.replaceXMLReservedChar(self.valueCtrl.GetValue())
value = value.replace("\n", "")
value = value.replace('"', "")
Expand Down Expand Up @@ -1337,7 +1334,6 @@ def inBlock():
"for" not in str(tagStringLst[self.c]).split()
and "if" not in str(tagStringLst[self.c]).split()
):

value = str(self.mdOWSTagStrList[self.c])
str1 += (
"\t"
Expand Down Expand Up @@ -1590,7 +1586,6 @@ def defineTemplate(self):
except:
pass
if not chcked: # chckbox in gui

if forSTS:
forSTS = False

Expand Down Expand Up @@ -1828,7 +1823,6 @@ def inStatements():
self.plusC(numOfItems)
# (1) 'no init IF'
elif "if" in mdDes[cTmp].tag.split():

objStr = mdDes[cTmp].tag.replace(" md.", " self.md.") + ":\n"

for n in range(leng):
Expand Down
3 changes: 0 additions & 3 deletions src/gui/wxpython/wx.metadata/mdlib/mdgrass.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ def createGrassBasicISO(self, profile=None):
self.md.identification.contact.append(val)

if self.type == "vector":

# Identification/Resource Abstract
# TODO not enough sources for create abstarce
self.md.identification.abstract = mdutil.replaceXMLReservedChar(
Expand Down Expand Up @@ -641,7 +640,6 @@ def updateGrassMd(self, md):
Update some parameters in r/v.support. This part need revision #TODO
"""
if self.type == "vector":

if len(md.contact) > 0:
_org = ""
for co in md.contact:
Expand Down Expand Up @@ -700,7 +698,6 @@ def updateGrassMd(self, md):

# ------------------------------------------------------------------------ RASTER
if self.type == "raster":

if md.identification.title is not (None or ""):
_title = md.identification.title
Module("r.support", map=self.map, title=_title, overwrite=True)
Expand Down
1 change: 0 additions & 1 deletion src/gui/wxpython/wx.metadata/mdlib/mdjinjaparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ def _readJinjaTags(self):
try:
with open(self.template, "r") as f:
for line in f:

# if found start of comments
if str(line).find("{{") != -1:
obj = mdutil.findBetween(line, "{{", "}}")
Expand Down
17 changes: 5 additions & 12 deletions src/gui/wxpython/wx.mwprecip/mw3.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,6 @@ def chckTimeValidity(tIn):
# print baseline.statFce
######## AVG #########
if baseline.statFce == "avg":

if baseline.type == "noDryWin":
if baseline.statFce == "avg":
sql = (
Expand Down Expand Up @@ -1504,17 +1503,11 @@ def __init__(self, database, timeWinConf):
self.timeWinConf = timeWinConf
self.datasetName = database.schema
self.datasetTitle = "MW time dataset"
self.datasetTdescription = (
" IDtype=%s,"
"sumStep=%s,"
"startTime=%s,"
"endTime='%s"
% (
timeWinConf.typeID,
timeWinConf.sumStep,
timeWinConf.startTime,
timeWinConf.endTime,
)
self.datasetTdescription = " IDtype=%s,sumStep=%s,startTime=%s,endTime='%s" % (
timeWinConf.typeID,
timeWinConf.sumStep,
timeWinConf.startTime,
timeWinConf.endTime,
)
self.createTimedataset()
self.registerMaps()
Expand Down
1 change: 0 additions & 1 deletion src/gui/wxpython/wx.mwprecip/mw_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,6 @@ def getFilesInFoldr(fpath, full=False):
if full:
tmp.append(os.path.join(fpath, path))
else:

tmp.append(path)

return tmp
Expand Down
2 changes: 0 additions & 2 deletions src/gui/wxpython/wx.rdigit/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ def _addPanes(self):
self._addPaneToolbar(name="digitMap")

def _addPaneToolbar(self, name):

self.toolbars[name] = RDigitMapManagerToolbar(self, self.mapManager)
self._mgr.AddPane(
self.toolbars[name],
Expand All @@ -224,7 +223,6 @@ def _addPaneToolbar(self, name):
)

def _addPaneMapWindow(self):

self._mgr.AddPane(
self.MapWindow,
wx.aui.AuiPaneInfo()
Expand Down
Loading

0 comments on commit 8f1d740

Please sign in to comment.