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

grass.temporal.abstract_space_time_dataset: Use Path.read_text() to load SQL template files #4335

Merged

Conversation

echoix
Copy link
Member

@echoix echoix commented Sep 17, 2024

Fixes ResourceWarnings about unclosed files, fixing ruff SIM115 at the same time.

These 4 places were opening a file and reading it completely in the same line, but never closed explicitly the file, nor used a context manager that would kick in as much as possible on errors inside the calls.

See PR description of #4234 for an illustration of the implementation of read_text() and write_text(), to see that a simple context manager is used, so we don’t have to maintain it.

…oad sql template files

Fixes ResourceWarnings about unclosed files, fixing ruff SIM115 at the same time
@echoix echoix added this to the 8.5.0 milestone Sep 17, 2024
@github-actions github-actions bot added Python Related code is in Python libraries labels Sep 17, 2024
@echoix echoix merged commit 3bc6e95 into OSGeo:main Sep 17, 2024
26 checks passed
@echoix echoix deleted the fix-resourcewarning-abstract_space_time_dataset branch September 19, 2024 21:08
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants