Skip to content

Comments

t.rast.to.vect: Fix passing column parameter to r.to.vect, fix flake8 F841#4206

Merged
echoix merged 4 commits intoOSGeo:mainfrom
mshukuno:flake8-F841-t_rast_to_vect
Aug 23, 2024
Merged

t.rast.to.vect: Fix passing column parameter to r.to.vect, fix flake8 F841#4206
echoix merged 4 commits intoOSGeo:mainfrom
mshukuno:flake8-F841-t_rast_to_vect

Conversation

@mshukuno
Copy link
Contributor

I think the "column" parameter needs to be added to the "r.to.vect" module call, but the test failed after adding it with the error below.

r.to.vect input=a_1@PERMANENT type=area column=values output=test_2001_01@PERMANENT --o --q
DBMI-SQLite driver error:
Error in sqlite3_prepare():
near "values": syntax error

The test passed after I changed the column values in test_to_vect.py to "value". But I'm unsure about modifying unittest code, so I need some advice.

It is also possible to remove line 166 theoretically, but I didn't do so since Flake8 didn't complain about F841. Line 166 returns None or an object, so it could be used to determine whether the process is continuing or terminating.

    # Check the new stvds
    new_sp = tgis.check_new_stds(output, "stvds", dbif=dbif, overwrite=overwrite)

If you could provide me with some insight on this, I would greatly appreciate it.

@github-actions github-actions bot added temporal Related to temporal data processing Python Related code is in Python module tests Related to Test Suite labels Aug 21, 2024
@petrasovaa
Copy link
Contributor

I think the "column" parameter needs to be added to the "r.to.vect" module call, but the test failed after adding it with the error below.

r.to.vect input=a_1@PERMANENT type=area column=values output=test_2001_01@PERMANENT --o --q
DBMI-SQLite driver error:
Error in sqlite3_prepare():
near "values": syntax error

The test passed after I changed the column values in test_to_vect.py to "value". But I'm unsure about modifying unittest code, so I need some advice.

"values" is a reserved sqlite keyword so when you fixed the tool, the specified column "values" started to be used, hence the error. Given there is a default specified, I would simply remove the column parameter from the test.

It is also possible to remove line 166 theoretically, but I didn't do so since Flake8 didn't complain about F841. Line 166 returns None or an object, so it could be used to determine whether the process is continuing or terminating.

    # Check the new stvds
    new_sp = tgis.check_new_stds(output, "stvds", dbif=dbif, overwrite=overwrite)

I would keep the call, but remove the return value, the check function should throw an error.

@mshukuno mshukuno marked this pull request as ready for review August 22, 2024 13:38
@petrasovaa
Copy link
Contributor

Should there be an update in the .flake8 file as well?

@echoix echoix merged commit 913c620 into OSGeo:main Aug 23, 2024
@petrasovaa petrasovaa changed the title Checks: Fix flake8 F841 (local variable assigned to but never used) in /temporal/t.rast.to.vect t.rast.to.vect: Fix passing column parameter to r.to.vect, fix flake8 F841 Aug 23, 2024
@petrasovaa petrasovaa added this to the 8.5.0 milestone Aug 23, 2024
petrasovaa added a commit that referenced this pull request Aug 23, 2024
This is a manual backport to 8.4 of #4206 to include only the fix part.
@mshukuno mshukuno deleted the flake8-F841-t_rast_to_vect branch August 26, 2024 14:53
Mahesh1998 pushed a commit to Mahesh1998/grass that referenced this pull request Sep 19, 2024
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 temporal Related to temporal data processing tests Related to Test Suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants