From 1e866290b8fa0e226ec4fede4697656df30b8705 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Fri, 4 Oct 2024 16:17:58 -0400 Subject: [PATCH] style: Fix invalid-escape-sequence (W605) (#4409) * style: Fix invalid-escape-sequence (W605) Ruff rule: https://docs.astral.sh/ruff/rules/invalid-escape-sequence/ * r.in.ascii: Remove test_csv and test_uncommon_delims --- imagery/i.pca/testsuite/test_pca.py | 2 +- pyproject.toml | 1 - .../r.in.ascii/testsuite/test_r_in_ascii.py | 70 ------------------- 3 files changed, 1 insertion(+), 72 deletions(-) diff --git a/imagery/i.pca/testsuite/test_pca.py b/imagery/i.pca/testsuite/test_pca.py index 8e9df84f2eb..f42fc6ddcc0 100644 --- a/imagery/i.pca/testsuite/test_pca.py +++ b/imagery/i.pca/testsuite/test_pca.py @@ -48,7 +48,7 @@ def test_pca_sample(self): cells=250325 datatype=CELL ncats=0 - comments=\"Eigen values, (vectors), and [percent importance]:PC1 4334.35 ( 0.2824, 0.3342, 0.5092,-0.0087, 0.5264, 0.5217) [83.04%]PC2 588.31 ( 0.2541, 0.1885, 0.2923,-0.7428,-0.5110,-0.0403) [11.27%]PC3 239.22 ( 0.3801, 0.3819, 0.2681, 0.6238,-0.4000,-0.2980) [ 4.58%]PC4 32.85 ( 0.1752,-0.0191,-0.4053, 0.1593,-0.4435, 0.7632) [ 0.63%]PC5 20.73 (-0.6170,-0.2514, 0.6059, 0.1734,-0.3235, 0.2330) [ 0.40%]PC6 4.08 (-0.5475, 0.8021,-0.2282,-0.0607,-0.0208, 0.0252) [ 0.08%]i.pca input=\"lsat7_2002_10,lsat7_2002_20,lsat7_2002_30,lsat7_2002_40\,lsat7_2002_50,lsat7_2002_70\" output=\"lsat7_2002_pca\" rescale=0,255 \percent=99" """ + comments=\"Eigen values, (vectors), and [percent importance]:PC1 4334.35 ( 0.2824, 0.3342, 0.5092,-0.0087, 0.5264, 0.5217) [83.04%]PC2 588.31 ( 0.2541, 0.1885, 0.2923,-0.7428,-0.5110,-0.0403) [11.27%]PC3 239.22 ( 0.3801, 0.3819, 0.2681, 0.6238,-0.4000,-0.2980) [ 4.58%]PC4 32.85 ( 0.1752,-0.0191,-0.4053, 0.1593,-0.4435, 0.7632) [ 0.63%]PC5 20.73 (-0.6170,-0.2514, 0.6059, 0.1734,-0.3235, 0.2330) [ 0.40%]PC6 4.08 (-0.5475, 0.8021,-0.2282,-0.0607,-0.0208, 0.0252) [ 0.08%]i.pca input=\"lsat7_2002_10,lsat7_2002_20,lsat7_2002_30,lsat7_2002_40\\,lsat7_2002_50,lsat7_2002_70\" output=\"lsat7_2002_pca\" rescale=0,255 \\percent=99" """ lsat7_2002_pca_univar_out = [ """n=250325 diff --git a/pyproject.toml b/pyproject.toml index c6cfac4185b..18dbdd75067 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -262,7 +262,6 @@ ignore = [ "UP031", # printf-string-formatting "UP032", # f-string "UP036", # outdated-version-block - "W605", # invalid-escape-sequence ] diff --git a/raster/r.in.ascii/testsuite/test_r_in_ascii.py b/raster/r.in.ascii/testsuite/test_r_in_ascii.py index 20e0c2a8f9e..cff31b7b3e2 100644 --- a/raster/r.in.ascii/testsuite/test_r_in_ascii.py +++ b/raster/r.in.ascii/testsuite/test_r_in_ascii.py @@ -32,44 +32,6 @@ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 """ -INPUT_TSV = """north: 4299000.00 -south: 4247000.00 -east: 528000.00 -west: 500000.00 -rows: 10 -cols: 15 -null: -9999 - -1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15 -1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15 -1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15 -1\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 3@ 4@ 5@ 6@ 7@ 8@ 9@ 10@ 11@ 12@ 13@ 14@ 15 """ - class SimpleCsvTestCase(TestCase): ascii_test = "ascii" @@ -119,38 +81,6 @@ def test_text_delimeter(self): msg="ascii_test in degrees must be between 1 and 5", ) - def test_tsv(self): - """Test loading TSV""" - self.assertModule( - "r.in.ascii", - input="-", - output=self.ascii_test, - type="CELL", - stdin_=INPUT_TSV, - ) - self.assertRasterMinMax( - map=self.ascii_test, - refmin=1, - refmax=15, - msg="ascii_test in degrees must be between 1 and 15", - ) - - def test_uncommon_delims(self): - """Test loading with uncommon delimiters""" - self.assertModule( - "r.in.ascii", - input="-", - output=self.ascii_test, - type="CELL", - stdin_=INPUT_UNCOMMON, - ) - self.assertRasterMinMax( - map=self.ascii_test, - refmin=1, - refmax=15, - msg="ascii_test in degrees must be between 1 and 15", - ) - if __name__ == "__main__": test()