Skip to content

Commit

Permalink
checks: Replace bare except (Flake8 E722) in po stats script (#4354)
Browse files Browse the repository at this point in the history
This addresses the PEP8 style error of mentioning specific exceptions (Flake8 E722) by specifying the exception type in the except clause within the writejson function in grass_po_stats.py. Now, bare except is replaced by OSError to catch only OS-related exceptions because os.remove() can raise various OS-related exceptions such as FileNotFoundError or PermissionError.

Additionally, it confirms that no other common Flake8 errors (E122, E128, E231, E401) are present in the file by removing the other ignores.
  • Loading branch information
arohanajit authored Sep 23, 2024
1 parent 6325a18 commit c32dd52
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ per-file-ignores =
imagery/i.atcorr/create_iwave.py: F632, F821, W293
doc/python/m.distance.py: E501
doc/gui/wxpython/example/dialogs.py: F401
locale/grass_po_stats.py: E122, E128, E231, E401, E722
gui/scripts/d.wms.py: E501
gui/wxpython/core/gconsole.py: E722
gui/wxpython/core/render.py: E722
Expand Down
2 changes: 1 addition & 1 deletion locale/grass_po_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def writejson(stats, outfile):
fout.close()
try:
os.remove("messages.mo")
except:
except OSError:
pass


Expand Down

0 comments on commit c32dd52

Please sign in to comment.