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

d.mon: Fix SIM115 linter warnings by using context managers for file operations #5015

Merged
merged 2 commits into from
Jan 31, 2025

Conversation

arohanajit
Copy link
Contributor

This PR addresses SIM115 linter warnings by replacing manual file handling with context managers in d.mon/render_cmd.py, ensuring proper resource management.

Changes:

  • Use with open(...) context managers in update_cmd_file, read_stdin, and temporary file creation.
  • Remove redundant fd is None checks (Python’s open() raises exceptions on failure).
  • Simplify temporary file creation with appropriate suffixes and delete=False where needed

@github-actions github-actions bot added Python Related code is in Python module display labels Jan 30, 2025
@echoix echoix changed the title display: Fix SIM115 linter warnings by using context managers for file operations d.mon: Fix SIM115 linter warnings by using context managers for file operations Jan 30, 2025
@echoix echoix enabled auto-merge (squash) January 30, 2025 23:34
@echoix echoix merged commit 0cade2d into OSGeo:main Jan 31, 2025
27 of 28 checks passed
@github-actions github-actions bot added this to the 8.5.0 milestone Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
display module Python Related code is in Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants