Skip to content

Conversation

@RhythmP619
Copy link

Enable pylint rule W0611 (unused-import) and clean up code to comply.
Changes:

  • Removed W0611 from disabled rules in pyproject.toml.
  • Fixed unused imports in affected files (2 modules updated).
  • Verified clean state: ran pylint with no W0611 warnings remaining.

@github-actions github-actions bot added Python Related code is in Python libraries tests Related to Test Suite labels Nov 26, 2025
Copy link
Member

@echoix echoix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Glad you found an easy one. I’m checking here with others about the underlying problems.

# for now it is the only place where it works
grass.gunittest.utils.do_doctest_gettext_workaround()

# tests.addTests(doctest.DocTestSuite(gmodules.shortcuts))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrasovaa Do you remember how this test works and why it is commented out? It was the usage of the unused import

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, and no time to look at it now, so I am for removing the import.

tests.addTests(doctest.DocTestSuite(grid.grid))
tests.addTests(doctest.DocTestSuite(grid.patch))
tests.addTests(doctest.DocTestSuite(grid.split))
# tests.addTests(doctest.DocTestSuite(shortcuts))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, what is the shortcuts? It’s the source of the unused imports

…es_grid_doctests.py

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@echoix
Copy link
Member

echoix commented Dec 3, 2025

How to handle the remaining 1000+ issues in the gui folder?

@petrasovaa
Copy link
Contributor

petrasovaa commented Dec 4, 2025

How to handle the remaining 1000+ issues in the gui folder?

I am not sure I fully understand the output, but I think it's just 9 files, we could fix those.

************* Module doc.examples.gui.wxpython.dialogs
doc/examples/gui/wxpython/dialogs.py:23:0: W0611: Unused import grass (unused-import)
************* Module utils.mkhtml
utils/mkhtml.py:30:4: W0611: Unused grass.script imported as gs (unused-import)
************* Module utils.mkmarkdown
utils/mkmarkdown.py:27:4: W0611: Unused grass.script imported as gs (unused-import)
************* Module gui.wxpython.wxgui
gui/wxpython/wxgui.py:41:4: W0611: Unused wx.lib.agw.advancedsplash imported as SC (unused-import)
************* Module gui.wxpython.vdigit.main
gui/wxpython/vdigit/main.py:18:4: W0611: Unused GV_LINES imported from vdigit.wxdigit (unused-import)
************* Module gui.wxpython.gui_core.wrap
gui/wxpython/gui_core/wrap.py:59:4: W0611: Unused NewIdRef imported from wx as NewId (unused-import)
gui/wxpython/gui_core/wrap.py:61:4: W0611: Unused NewId imported from wx (unused-import)
************* Module gui.wxpython.nviz.main
gui/wxpython/nviz/main.py:23:4: W0611: Unused glcanvas imported from wx (unused-import)
gui/wxpython/nviz/main.py:27:4: W0611: Unused wxnviz imported from nviz (unused-import)
************* Module gui.wxpython.mapwin.decorations
gui/wxpython/mapwin/decorations.py:26:4: W0611: Unused Image imported from PIL (unused-import)
************* Module gui.wxpython.psmap.utils
gui/wxpython/psmap/utils.py:[31](https://github.com/OSGeo/grass/actions/runs/19704457764/job/56448444221?pr=6668#step:27:32):4: W0611: Unused Image imported from PIL as PILImage (unused-import)

@echoix
Copy link
Member

echoix commented Dec 4, 2025

If it’s really only this, sure it’s a good idea to fix these right away

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libraries Python Related code is in Python tests Related to Test Suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants