From 22501714ce3619a63e016434e3515d3d7fd1b7f8 Mon Sep 17 00:00:00 2001 From: mshukun Date: Tue, 4 Jun 2024 16:33:12 -0400 Subject: [PATCH 1/2] Fix W605-invalid escape sequence --- .flake8 | 30 +++++++++++------------------- utils/g.html2man/ggroff.py | 2 +- utils/gitlog2changelog.py | 2 +- utils/mkrest.py | 2 +- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/.flake8 b/.flake8 index 84c3826b32c..72717c6e6b6 100644 --- a/.flake8 +++ b/.flake8 @@ -20,10 +20,8 @@ per-file-ignores = # F841 local variable assigned to but never used # E741 ambiguous variable name 'l' __init__.py: F401, F403 - lib/init/grass.py: E722, F821, F841, W605 - utils/mkrest.py: W605 - utils/gitlog2changelog.py: E722, E712, W605 - utils/g.html2man/ggroff.py: W605 + lib/init/grass.py: E722, F821, F841 + utils/gitlog2changelog.py: E722, E712 man/build_check_rest.py: F403, F405 man/build_full_index_rest.py: F403, F405 man/parser_standard_options.py: F403, F405 @@ -45,10 +43,9 @@ per-file-ignores = gui/scripts/d.wms.py: E501 gui/wxpython/core/gcmd.py: E402 gui/wxpython/core/gthread.py: F841 - gui/wxpython/core/gconsole.py: E722, W605 - gui/wxpython/core/globalvar.py: W605 + gui/wxpython/core/gconsole.py: E722 gui/wxpython/core/toolboxes.py: E722 - gui/wxpython/core/utils.py: E722, F841, W605 + gui/wxpython/core/utils.py: E722, F841 gui/wxpython/core/workspace.py: E722 gui/wxpython/core/render.py: E722, F841 gui/wxpython/core/ws.py: F841 @@ -64,8 +61,8 @@ per-file-ignores = gui/wxpython/gcp/g.gui.gcp.py: F841 gui/wxpython/gcp/manager.py: F841, E722 gui/wxpython/gcp/mapdisplay.py: F841 - gui/wxpython/gui_core/*: F841, E266, E722, W605 - gui/wxpython/gui_core/dialogs.py: E722, F841, W605 + gui/wxpython/gui_core/*: F841, E266, E722 + gui/wxpython/gui_core/dialogs.py: E722, F841 gui/wxpython/gui_core/forms.py: E722, F841 gui/wxpython/gui_core/ghelp.py: E722 gui/wxpython/gui_core/gselect.py: F841, E266, E722 @@ -76,12 +73,12 @@ per-file-ignores = gui/wxpython/image2target/g.gui.image2target.py: E501, E265, F841 gui/wxpython/iscatt/*: F841, E722, E741, F405, F403 gui/wxpython/lmgr/giface.py: E741 - gui/wxpython/lmgr/frame.py: F841, E722, W605 + gui/wxpython/lmgr/frame.py: F841, E722 # layertree still includes some formatting issues (it is ignored by Black) gui/wxpython/lmgr/layertree.py: E722, E266, W504, E225 gui/wxpython/lmgr/workspace.py: F841 - gui/wxpython/modules/*: F841, E722, W605 - gui/wxpython/nviz/*: F841, E266, E722, W605, F403, F405 + gui/wxpython/modules/*: F841, E722 + gui/wxpython/nviz/*: F841, E266, E722, F403, F405 gui/wxpython/photo2image/*: F841, E722, E265 gui/wxpython/photo2image/g.gui.photo2image.py: E501, F841 gui/wxpython/psmap/*: F841, E266, E722, F405, F403 @@ -116,7 +113,7 @@ per-file-ignores = gui/wxpython/timeline/frame.py: E741 gui/wxpython/tools/build_modules_xml.py: E722 gui/wxpython/web_services/cap_interface.py: E501 - gui/wxpython/web_services/widgets.py: F841, E741, W605, E402 + gui/wxpython/web_services/widgets.py: F841, E741, E402 gui/wxpython/rlisetup/frame.py: E741 gui/wxpython/rlisetup/sampling_frame.py: F841 gui/wxpython/rlisetup/wizard.py: E722, E741 @@ -129,20 +126,15 @@ per-file-ignores = # TODO: Is this really needed? python/grass/pygrass/vector/__init__.py: E402 python/grass/pygrass/raster/__init__.py: E402 - python/grass/gunittest/gmodules.py: W605 python/grass/gunittest/invoker.py: E721 - python/grass/pygrass/vector/geometry.py: W605 python/grass/pygrass/vector/__init__.py: E402 python/grass/pygrass/modules/interface/*.py: F401 - python/grass/pygrass/modules/interface/module.py: W605 - python/grass/pygrass/modules/interface/parameter.py: W605 python/grass/pygrass/modules/grid/*.py: F401 python/grass/pygrass/raster/rowio.py: E741 python/grass/pygrass/raster/category.py: E721 python/grass/pygrass/rpc/__init__.py: F401, F403 python/grass/pygrass/utils.py: E402 - python/grass/script/task.py: W605 - python/grass/temporal/abstract_space_time_dataset.py: W605, F841, E722 + python/grass/temporal/abstract_space_time_dataset.py: F841, E722 python/grass/temporal/c_libraries_interface.py: F841, E722 python/grass/temporal/core.py: E722 python/grass/temporal/datetime_math.py: F841, E722 diff --git a/utils/g.html2man/ggroff.py b/utils/g.html2man/ggroff.py index 24297776bac..a2b50178dd0 100644 --- a/utils/g.html2man/ggroff.py +++ b/utils/g.html2man/ggroff.py @@ -131,7 +131,7 @@ def fmt(self, format, content, var=None): def pp_li(self, content): if self.get("in_ul"): - self.fmt("\n.IP \(bu 4n\n@", content) + self.fmt(r"\n.IP \(bu 4n\n@", content) else: idx = self.get("index") idx[-1] += 1 diff --git a/utils/gitlog2changelog.py b/utils/gitlog2changelog.py index 6e2bb99fd0f..e99155d3b50 100755 --- a/utils/gitlog2changelog.py +++ b/utils/gitlog2changelog.py @@ -108,7 +108,7 @@ continue # Collect the files for this commit. FIXME: Still need to add +/- to files elif authorFound & dateFound & messageFound: - fileList = re.split(" \| ", line, 2) + fileList = re.split(r" \| ", line, 2) if len(fileList) > 1: if len(files) > 0: files = files + ", " + fileList[0].strip() diff --git a/utils/mkrest.py b/utils/mkrest.py index ca04c173f51..24481bc3374 100755 --- a/utils/mkrest.py +++ b/utils/mkrest.py @@ -63,7 +63,7 @@ def read_file(name): "`* `": "`", ">`_*": ">`_", ">`_,*": ">`_,", - '``*\ "': '``"', + r'``*\ "': '``"', "***": "**", } From 3de7c2d9f434638d894cefde459adaea65a92dce Mon Sep 17 00:00:00 2001 From: mshukuno Date: Wed, 5 Jun 2024 18:31:54 -0400 Subject: [PATCH 2/2] Implementing suggested changes from the code review --- utils/g.html2man/ggroff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/g.html2man/ggroff.py b/utils/g.html2man/ggroff.py index a2b50178dd0..714ef717090 100644 --- a/utils/g.html2man/ggroff.py +++ b/utils/g.html2man/ggroff.py @@ -131,7 +131,7 @@ def fmt(self, format, content, var=None): def pp_li(self, content): if self.get("in_ul"): - self.fmt(r"\n.IP \(bu 4n\n@", content) + self.fmt("\n.IP \\(bu 4n\n@", content) else: idx = self.get("index") idx[-1] += 1