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

Refactor file handling to use context manager for safer operations #3257

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from

Conversation

mahdirahimi1999
Copy link

Refactor file handling to use context manager for safer operations

Related Issue(s) n
Has Unit Tests (y/n) n
Documentation Included (y/n) n

Change Description

This pull request refactors file handling throughout the project by replacing manual file open and close operations with the with statement (context manager). This ensures files are properly closed even in case of exceptions, improving code safety and readability. The changes also simplify the file writing logic, aligning it with best practices for file management in Python.

@mahdirahimi1999
Copy link
Author

@thomas-bc, could you please review this PR? It refactors file handling to use the context manager for better resource management. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant