diff --git a/pyproject.toml b/pyproject.toml index b909b44e50..b4bbfa4b50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -98,7 +98,6 @@ ignore = [ "B904", # raise-without-from-inside-except "B909", # loop-iterator-mutation "BLE001", # blind-except - "C404", # unnecessary-list-comprehension-dict "C414", # unnecessary-double-cast-or-process "C416", # unnecessary-comprehension "COM812", # missing-trailing-comma diff --git a/python/grass/pydispatch/robustapply.py b/python/grass/pydispatch/robustapply.py index 9636fedad6..2ec88443a1 100644 --- a/python/grass/pydispatch/robustapply.py +++ b/python/grass/pydispatch/robustapply.py @@ -86,5 +86,5 @@ def robustApply(receiver, *arguments, **named): ) # fc does not have a **kwds type parameter, therefore # remove unacceptable arguments. - named = dict([(k, v) for k, v in named.items() if k in acceptable]) + named = {k: v for k, v in named.items() if k in acceptable} return receiver(*arguments, **named) diff --git a/python/grass/pygrass/modules/grid/grid.py b/python/grass/pygrass/modules/grid/grid.py index e0dbd30965..661d5a3df6 100644 --- a/python/grass/pygrass/modules/grid/grid.py +++ b/python/grass/pygrass/modules/grid/grid.py @@ -122,9 +122,7 @@ def read_gisrc(gisrc): True """ with open(gisrc) as gfile: - gis = dict( - [(k.strip(), v.strip()) for k, v in [row.split(":", 1) for row in gfile]] - ) + gis = {k.strip(): v.strip() for k, v in [row.split(":", 1) for row in gfile]} return gis["MAPSET"], gis["LOCATION_NAME"], gis["GISDBASE"] @@ -603,7 +601,7 @@ def get_works(self): indx = row * cols + col inms[key] = "%s@%s" % (self.inlist[key][indx], self.mset.name) # set the computational region, prepare the region parameters - bbox = dict([(k[0], str(v)) for k, v in box.items()[:-2]]) + bbox = {k[0]: str(v) for k, v in box.items()[:-2]} bbox["nsres"] = "%f" % reg.nsres bbox["ewres"] = "%f" % reg.ewres new_mset = ( diff --git a/python/grass/pygrass/modules/interface/env.py b/python/grass/pygrass/modules/interface/env.py index 1f0519d23c..d3d6e37123 100644 --- a/python/grass/pygrass/modules/interface/env.py +++ b/python/grass/pygrass/modules/interface/env.py @@ -14,12 +14,9 @@ def get_env(): if gisrc is None: raise RuntimeError("You are not in a GRASS session, GISRC not found.") with open(gisrc) as grc: - return dict( - [ - (k.strip(), v.strip()) - for k, v in [row.split(":", 1) for row in grc if row] - ] - ) + return { + k.strip(): v.strip() for k, v in [row.split(":", 1) for row in grc if row] + } def get_debug_level(): diff --git a/utils/g.html2man/ghtml.py b/utils/g.html2man/ghtml.py index 2212b7ddd7..4b30950ff0 100644 --- a/utils/g.html2man/ghtml.py +++ b/utils/g.html2man/ghtml.py @@ -95,7 +95,7 @@ def setify(d): - return dict([(key, frozenset(val)) for key, val in d.items()]) + return {key: frozenset(val) for key, val in d.items()} def omit(allowed, tags):