diff --git a/.flake8 b/.flake8 index 06ecd4c5f1a..9a509977289 100644 --- a/.flake8 +++ b/.flake8 @@ -20,7 +20,6 @@ per-file-ignores = # E722 do not use bare 'except' # W605 invalid escape sequence # F821 undefined name 'unicode' - # F841 local variable assigned to but never used # E741 ambiguous variable name 'l' man/build_html.py: E501 man/build_md.py: E501 diff --git a/pyproject.toml b/pyproject.toml index f58e088bc43..ff79043f0f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -166,7 +166,6 @@ ignore = [ "F811", # redefined-while-unused "F821", # undefined-name "F822", # undefined-export - "F841", # unused-variable "FBT001", # boolean-type-hint-positional-argument "FBT002", # boolean-default-value-positional-argument "FBT003", # boolean-positional-value-in-call diff --git a/python/grass/temporal/testsuite/unittests_temporal_algebra_grs.py b/python/grass/temporal/testsuite/unittests_temporal_algebra_grs.py index 5f0610bafd6..0f4501530cb 100644 --- a/python/grass/temporal/testsuite/unittests_temporal_algebra_grs.py +++ b/python/grass/temporal/testsuite/unittests_temporal_algebra_grs.py @@ -178,7 +178,7 @@ def test_common_granularity_2(self) -> None: """Testing the common granularity function year to month sampling.""" ta = tgis.TemporalAlgebraParser(run=True, debug=True) expr = "R = A : C" - ret = ta.setup_common_granularity(expression=expr) + ta.setup_common_granularity(expression=expr) ta.parse(expression=expr, basename="r", overwrite=True) @@ -197,7 +197,7 @@ def test_common_granularity_3(self) -> None: """Testing the common granularity function with gaps.""" ta = tgis.TemporalAlgebraParser(run=True, debug=True) expr = "R = A : D" - ret = ta.setup_common_granularity(expression=expr) + ta.setup_common_granularity(expression=expr) ta.parse(expression=expr, basename="r", overwrite=True) @@ -216,7 +216,7 @@ def test_common_granularity_4(self) -> None: """Testing the common granularity function year to month with gaps.""" ta = tgis.TemporalAlgebraParser(run=True, debug=True) expr = "R = C : D" - ret = ta.setup_common_granularity(expression=expr) + ta.setup_common_granularity(expression=expr) ta.parse(expression=expr, basename="r", overwrite=True) @@ -235,7 +235,7 @@ def test_common_granularity_4(self) -> None: """Testing the common granularity function year to month with gaps.""" ta = tgis.TemporalAlgebraParser(run=True, debug=True) expr = "R = C : D" - ret = ta.setup_common_granularity(expression=expr) + ta.setup_common_granularity(expression=expr) ta.parse(expression=expr, basename="r", overwrite=True) @@ -254,7 +254,7 @@ def test_common_granularity_5(self) -> None: """Testing the common granularity function year to month with gaps.""" ta = tgis.TemporalAlgebraParser(run=True, debug=True) expr = "R = A : C : D" - ret = ta.setup_common_granularity(expression=expr) + ta.setup_common_granularity(expression=expr) ta.parse(expression=expr, basename="r", overwrite=True) @@ -273,7 +273,7 @@ def test_common_granularity_6(self) -> None: """Testing the common granularity function year to month with gaps.""" ta = tgis.TemporalAlgebraParser(run=True, debug=True) expr = "R = if(start_month(A) > 2, A : C : D)" - ret = ta.setup_common_granularity(expression=expr) + ta.setup_common_granularity(expression=expr) ta.parse(expression=expr, basename="r", overwrite=True) diff --git a/python/grass/temporal/testsuite/unittests_temporal_conditionals.py b/python/grass/temporal/testsuite/unittests_temporal_conditionals.py index eacc31bd1f1..ffe53ae72f8 100644 --- a/python/grass/temporal/testsuite/unittests_temporal_conditionals.py +++ b/python/grass/temporal/testsuite/unittests_temporal_conditionals.py @@ -389,7 +389,7 @@ def test_temporal_conditional_13(self) -> None: D = tgis.open_old_stds("R", type="strds") D.select() - maplist = D.get_registered_maps_as_objects() + D.get_registered_maps_as_objects() self.assertEqual(D.metadata.get_number_of_maps(), 4) self.assertEqual(D.metadata.get_min_min(), 1) self.assertEqual(D.metadata.get_max_max(), 4) diff --git a/python/grass/temporal/testsuite/unittests_temporal_raster3d_algebra.py b/python/grass/temporal/testsuite/unittests_temporal_raster3d_algebra.py index 090d9638f22..71074d9680a 100644 --- a/python/grass/temporal/testsuite/unittests_temporal_raster3d_algebra.py +++ b/python/grass/temporal/testsuite/unittests_temporal_raster3d_algebra.py @@ -22,7 +22,7 @@ def setUpClass(cls) -> None: """Initiate the temporal GIS and set the region""" tgis.init(True) # Raise on error instead of exit(1) cls.use_temp_region() - ret = gs.run_command( + gs.run_command( "g.region", n=80.0, s=0.0, e=120.0, w=0.0, t=100.0, b=0.0, res=10.0 ) diff --git a/python/grass/temporal/testsuite/unittests_temporal_raster_algebra.py b/python/grass/temporal/testsuite/unittests_temporal_raster_algebra.py index 6dcf9267632..fb161dfdcfb 100644 --- a/python/grass/temporal/testsuite/unittests_temporal_raster_algebra.py +++ b/python/grass/temporal/testsuite/unittests_temporal_raster_algebra.py @@ -616,7 +616,7 @@ def test_tmap_function1(self) -> None: D = tgis.open_old_stds("R", type="strds") D.select() - maplist = D.get_registered_maps_as_objects() + D.get_registered_maps_as_objects() self.assertEqual(D.metadata.get_number_of_maps(), 1) self.assertEqual(D.metadata.get_min_min(), 99) self.assertEqual(D.metadata.get_max_max(), 99) @@ -633,7 +633,7 @@ def test_tmap_function2(self) -> None: D = tgis.open_old_stds("R", type="strds") D.select() - maplist = D.get_registered_maps_as_objects() + D.get_registered_maps_as_objects() self.assertEqual(D.metadata.get_number_of_maps(), 1) self.assertEqual(D.metadata.get_min_min(), 100) self.assertEqual(D.metadata.get_max_max(), 100) @@ -650,7 +650,7 @@ def test_map_function1(self) -> None: D = tgis.open_old_stds("R", type="strds") D.select() - maplist = D.get_registered_maps_as_objects() + D.get_registered_maps_as_objects() self.assertEqual(D.metadata.get_number_of_maps(), 4) self.assertEqual(D.metadata.get_min_min(), 101) self.assertEqual(D.metadata.get_max_max(), 104) @@ -667,7 +667,7 @@ def test_map_function2(self) -> None: D = tgis.open_old_stds("R", type="strds") D.select() - maplist = D.get_registered_maps_as_objects() + D.get_registered_maps_as_objects() self.assertEqual(D.metadata.get_number_of_maps(), 4) self.assertEqual(D.metadata.get_min_min(), 100) self.assertEqual(D.metadata.get_max_max(), 400) diff --git a/python/grass/temporal/testsuite/unittests_temporal_vector_algebra.py b/python/grass/temporal/testsuite/unittests_temporal_vector_algebra.py index 9d7b3cff4c1..83ded2bf0a7 100644 --- a/python/grass/temporal/testsuite/unittests_temporal_vector_algebra.py +++ b/python/grass/temporal/testsuite/unittests_temporal_vector_algebra.py @@ -185,7 +185,7 @@ def test_temporal_extent1(self) -> None: self.assertTrue(D.is_in_db()) D.select() D.print_info() - maplist = D.get_registered_maps_as_objects() + D.get_registered_maps_as_objects() self.assertEqual(D.metadata.get_number_of_maps(), 2) start, end = D.get_absolute_time() self.assertEqual(start, datetime.datetime(2001, 1, 2)) diff --git a/raster/r.terraflow/testsuite/test_r_terraflow.py b/raster/r.terraflow/testsuite/test_r_terraflow.py index 4c2329cde3c..d21472b9ac8 100644 --- a/raster/r.terraflow/testsuite/test_r_terraflow.py +++ b/raster/r.terraflow/testsuite/test_r_terraflow.py @@ -111,7 +111,9 @@ def test_univar_mfd(self): coeff_var=47.8572213922083 sum=8341670.75914752""" - # cls.assertRasterFitsUnivar(raster="terra_flooded", reference=terra_flooded_univar, precision=3) + self.assertRasterFitsUnivar( + raster="terra_flooded", reference=terra_flooded_univar, precision=3 + ) self.assertRasterFitsUnivar( raster="terra_flowdir", reference=terra_flowdir_univar, precision=3 ) diff --git a/temporal/t.rast3d.algebra/testsuite/test_raster3d_algebra.py b/temporal/t.rast3d.algebra/testsuite/test_raster3d_algebra.py index 1716d7e04b3..88e7ba69140 100644 --- a/temporal/t.rast3d.algebra/testsuite/test_raster3d_algebra.py +++ b/temporal/t.rast3d.algebra/testsuite/test_raster3d_algebra.py @@ -23,7 +23,7 @@ def setUpClass(cls): os.putenv("GRASS_OVERWRITE", "1") tgis.init(True) # Raise on error instead of exit(1) cls.use_temp_region() - ret = gs.run_command( + gs.run_command( "g.region", n=80.0, s=0.0, e=120.0, w=0.0, t=100.0, b=0.0, res=10.0 ) diff --git a/vector/v.generalize/testsuite/v_generalize_test.py b/vector/v.generalize/testsuite/v_generalize_test.py index e50d6666853..f35b84da7a2 100644 --- a/vector/v.generalize/testsuite/v_generalize_test.py +++ b/vector/v.generalize/testsuite/v_generalize_test.py @@ -264,6 +264,7 @@ def test_chaiken_algorithm(self): tolerance, f"Midpoint {midpoint} of segment {i} is not close to any point in the generalized line.", ) + self.assertIsNotNone(closest_point) # Testing the number of vertices after smoothing input_vertices = self.count_vertices("test_chaiken") output_vertices = self.count_vertices("chaiken_line")