Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checks: Flake8 F841 fixes in the scripts directory part 2 #4241

Merged
merged 3 commits into from
Sep 7, 2024

Conversation

mshukuno
Copy link
Contributor

Description

Flake8 F841 (local variable assigned to but never used) fixes in the scripts directory.

Motivation and context

Changes require resolving a part of Flake8 warnings that are currently ignored. The issue title and number as follows.

  • [Bug] Fix currently ignored Flake8 warnings #1522

How has this been tested?

v.semantic.label
Removed unused as e from except. I don’t see this type of fix cause any issues. However, I tested with testsuit and all passed.

v.import
Removed unused tgtsrs value assignment and left gs.read_command("g.proj", flags="j", quiet=True).
With the GUI, I tried importing the data/all_types.gpkg and data/all_types_wgs84.gpkg files and encountered no errors.

Testsuit test_import_gpkg_wgs84 failed for self.assertVectorFitsRegionInfo. I don't see how this is related to F841 fixes, more likely GDAL version differences or something else. I personally find it no big deal since it's just a slight difference in reference and GUI worked just fine.

v.report
Removed unused line numcols = len(colnames) + len(extracolnames) . Tested with GUI since no testsuit. Worked fine.

v.unpack
Removed a variable assignment kept grass.read_command(…). Tested with testsuit and all passed.

Types of changes

Remove unused variables and/or entire lines when applicable.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing
    functionality to not work as before)

Checklist

It would be greatly appreciated if someone could point me to documentation on when to use "checks" prefix in PRs.

  • PR title provides summary of the changes and starts with one of the
    pre-defined prefixes
  • My code follows the code style
    of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@github-actions github-actions bot added vector Related to vector data processing raster Related to raster data processing Python Related code is in Python module labels Aug 28, 2024
@mshukuno mshukuno changed the title [checks] Flake8 F841 fixes in the scripts directory part 2 checks: Flake8 F841 fixes in the scripts directory part 2 Aug 28, 2024
scripts/v.unpack/v.unpack.py Outdated Show resolved Hide resolved
scripts/v.import/v.import.py Show resolved Hide resolved
@petrasovaa petrasovaa added this to the 8.5.0 milestone Aug 28, 2024
@echoix echoix merged commit 102bc38 into OSGeo:main Sep 7, 2024
26 checks passed
@mshukuno mshukuno deleted the flake8-F841-scripts-2 branch September 18, 2024 15:18
Mahesh1998 pushed a commit to Mahesh1998/grass that referenced this pull request Sep 19, 2024
* Fix F841 problems in `scripts` directory

* Update `.flake8` with fixes for F841

* Remove unused lines based on reviewed suggestions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module Python Related code is in Python raster Related to raster data processing vector Related to vector data processing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants