Skip to content

Commit

Permalink
style: Fix unnecessary-comprehension-in-call (C419) (OSGeo#4027)
Browse files Browse the repository at this point in the history
  • Loading branch information
echoix authored Jul 11, 2024
1 parent ff453d2 commit ff2da11
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
6 changes: 2 additions & 4 deletions gui/wxpython/datacatalog/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -2092,10 +2092,8 @@ def _popupMenuLayer(self):

if not isinstance(self._giface, StandaloneGrassInterface):
if all(
[
each.data["name"] == genv["LOCATION_NAME"]
for each in self.selected_location
]
each.data["name"] == genv["LOCATION_NAME"]
for each in self.selected_location
):
if len(self.selected_layer) > 1:
item = wx.MenuItem(menu, wx.ID_ANY, _("&Display layers"))
Expand Down
2 changes: 1 addition & 1 deletion lib/init/grass.py
Original file line number Diff line number Diff line change
Expand Up @@ -1947,7 +1947,7 @@ def print_params(params):

# check if we are dealing with parameters which require dev files
dev_params = ["arch", "compiler", "build", "date"]
if any([param in dev_params for param in params]):
if any(param in dev_params for param in params):
plat = gpath("include", "Make", "Platform.make")
if not os.path.exists(plat):
fatal(_("Please install the GRASS GIS development package"))
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ ignore = [
"C405", # unnecessary-literal-set
"C414", # unnecessary-double-cast-or-process
"C416", # unnecessary-comprehension
"C419", # unnecessary-comprehension-in-call
"COM812", # missing-trailing-comma
"COM818", # trailing-comma-on-bare-tuple
"D1",
Expand Down
8 changes: 4 additions & 4 deletions python/grass/temporal/temporal_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -2249,7 +2249,7 @@ def build_condition_list(self, tvarexpr, thenlist, topolist=["EQUAL"]):
# Use method eval_global_var to evaluate expression.
resultlist = self.eval_global_var(tvarexpr, thenlist)
# Check if a given list is a list of maps.
elif all([issubclass(type(ele), AbstractMapDataset) for ele in tvarexpr]):
elif all(issubclass(type(ele), AbstractMapDataset) for ele in tvarexpr):
# Use method eval_map_list to evaluate map_list in comparison to thenlist.
resultlist = self.eval_map_list(tvarexpr, thenlist, topolist)
elif len(tvarexpr) % 2 != 0:
Expand All @@ -2259,12 +2259,12 @@ def build_condition_list(self, tvarexpr, thenlist, topolist=["EQUAL"]):
expr = tvarexpr[iter]
operator = tvarexpr[iter + 1]
relexpr = tvarexpr[iter + 2]
if all([issubclass(type(ele), list) for ele in [expr, relexpr]]):
if all(issubclass(type(ele), list) for ele in [expr, relexpr]):
resultlist = self.build_spatio_temporal_topology_list(expr, relexpr)
# Loop through the list, search for map lists or global variables.
for expr in tvarexpr:
if isinstance(expr, list):
if all([issubclass(type(ele), AbstractMapDataset) for ele in expr]):
if all(issubclass(type(ele), AbstractMapDataset) for ele in expr):
# Use method eval_map_list to evaluate map_list
resultlist = self.eval_map_list(expr, thenlist, topolist)
else:
Expand All @@ -2274,7 +2274,7 @@ def build_condition_list(self, tvarexpr, thenlist, topolist=["EQUAL"]):
elif isinstance(expr, GlobalTemporalVar):
# Use according functions for different global variable types.
if expr.get_type() == "operator":
if all(["condition_value" in dir(map_i) for map_i in thenlist]):
if all("condition_value" in dir(map_i) for map_i in thenlist):
# Add operator string to the condition list.
[
map_i.condition_value.extend(expr.get_type_value())
Expand Down
2 changes: 1 addition & 1 deletion scripts/d.polar/d.polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ def main():
occurrences = sorted([(math.radians(x), freq[x]) for x in freq])

# find the maximum value
maxradius = max([f for a, f in occurrences])
maxradius = max(f for a, f in occurrences)

# now do cos() sin()
sine_cosine = [(math.cos(a) * f, math.sin(a) * f) for a, f in occurrences]
Expand Down

0 comments on commit ff2da11

Please sign in to comment.