Skip to content

temporal: Unused variables in temporal modules#1082

Closed
nobeeakon wants to merge 1 commit intoOSGeo:mainfrom
nobeeakon:unused-temp-vars
Closed

temporal: Unused variables in temporal modules#1082
nobeeakon wants to merge 1 commit intoOSGeo:mainfrom
nobeeakon:unused-temp-vars

Conversation

@nobeeakon
Copy link
Contributor

Remove unused variables from temporal module.
removed F841, # local variable... from temporal/.flake8

Copy link
Member

@wenzeslaus wenzeslaus left a comment

Choose a reason for hiding this comment

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

Thank you. This looks great overall. I have some questions and one request for change (see the comments).

Please, try to run all tests in temporal locally to see if it breaks anything. I think it will show that the one for t.rast3d.algebra is failing (see the comment). You can see it failing in Checks > CI > ubuntu-18.04 tests > Run tests, but if you run it locally, you can run it with and without your changes and see the specific errors.

cls.use_temp_region()
ret = grass.script.run_command("g.region", n=80.0, s=0.0, e=120.0,
w=0.0, t=100.0, b=0.0, res=10.0)

Copy link
Member

Choose a reason for hiding this comment

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

Did you try to run this test? This call has an "side effect" meaning it does something else than just generate the return value, specifically it sets the computational region to whatever the test is meant to be executed with. The run_command() return value can be ignored in this case (it should be None actually). Removing the variable is the solution, while the call needs to stay in place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great, thanks for the comments, yeah, completely missed the testing. However, I'm not completely sure how to run them locally, if you could give me some light on that I would really appreciate it.

Copy link
Member

Choose a reason for hiding this comment

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

For running tests you need NC SPM sample dataset. Use the alpha version from http://fatra.cnr.ncsu.edu/data/nc_spm_full_v2alpha2.tar.gz to have the same one used in the CI.

The commands to run the tests are at the following page under Running tests and creating report and under Running individual test files. You can run a single file or a (sub)directory.

https://grass.osgeo.org/grass79/manuals/libpython/gunittest_running_tests.html

output="dummy", run_=False,
finish_=False, flags=flags,
type=method, overwrite=overwrite,
column=column,
Copy link
Member

Choose a reason for hiding this comment

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

Good catch. Do you also consider the previous state a bug?

Mentioning @veroandreo to have this confirmed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, I'm not sure. This is a call to r.to.vect which default for column parameter is value. Hence dunno if needed here. In the end the module converts each raster from a strds into a vector and registers them as stvds, what other thing would we store when converting a raster to a vector if not the value? All the examples in r.to.vect omit the column parameter

Copy link
Member

Choose a reason for hiding this comment

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

In both cases, the documentation says it is Name of attribute column to store value. So according to the doc, it is a name, not what should be be stored. (In theory, you could store, e.g., color, but that's not the case here.) Then it makes sense to pass it and since there is a default which is often good enough, it is not surprising that nobody complained.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it puts value as default column name. Since there's no option to store any other attribute, I believe it's a reasonable default name. Of course, maybe better to have it explicitly there in case eventually r.to.vect allows to store something else and hence the name value would no longer apply


D = tgis.open_old_stds("R", type="strds")

maplist = D.get_registered_maps_as_objects()
Copy link
Member

Choose a reason for hiding this comment

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

Similarly to the ret = grass.script.run_command line, these also do something, but since the test is about something else there seems to be no reason to just test if get_registered_maps_as_objects() executes, nor further investigate its result. So, I agree with removing those.

@neteler neteler added the Python Related code is in Python label Dec 9, 2021
@neteler neteler added this to the 8.0.1 milestone Dec 9, 2021
@ninsbl ninsbl modified the milestones: 8.0.1, 8.0.2 Feb 20, 2022
@ninsbl
Copy link
Member

ninsbl commented Feb 20, 2022

Bumping up milestone as 8.0.1 is due in two days, while this has not been part of RC1 and there has not been activity for some time.

@wenzeslaus wenzeslaus modified the milestones: 8.0.2, 8.2.0, 8.4.0 Feb 24, 2022
@wenzeslaus wenzeslaus modified the milestones: 8.3.0, 8.4.0 Feb 14, 2023
@echoix
Copy link
Member

echoix commented Mar 21, 2024

Some conflicts need to be solved manually, they are not editable in the UI in this case.

@echoix echoix added conflicts/needs rebase Rebase to or merge with the latest base branch is needed info needed Waiting on more info from the submitter labels Mar 21, 2024
@wenzeslaus wenzeslaus modified the milestones: 8.4.0, Future Apr 27, 2024
@echoix
Copy link
Member

echoix commented Sep 26, 2024

@arohanajit Can you look if any of the changes are still relevant (in other words, have they all been already addressed?)

If it's not needed anymore, we'll close the PR.

@arohanajit
Copy link
Contributor

arohanajit commented Sep 27, 2024

@arohanajit Can you look if any of the changes are still relevant (in other words, have they all been already addressed?)

If it's not needed anymore, we'll close the PR.

Just checking in on the current state of the repo, the issues addressed in this PR are not present anymore. These files still have flake8 errors but its E501 not F841. So I don't think merging this would solve anythng

@echoix
Copy link
Member

echoix commented Sep 27, 2024

So you suggest closing this ?

@arohanajit
Copy link
Contributor

Yes, I don't think this is relevant anymore

@echoix echoix closed this Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflicts/needs rebase Rebase to or merge with the latest base branch is needed info needed Waiting on more info from the submitter Python Related code is in Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants