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

Implemented overwrite guardrails thanks to @tjlaboss. #443

Merged
merged 8 commits into from
Jul 15, 2024

Conversation

MicahGale
Copy link
Collaborator

@MicahGale MicahGale commented Jul 11, 2024

Description

This introduces a new argument to MCNP_Problem.write_to_file, (and montepy.input_parser.input_file.write_to_file.open), overwrite, which indicates if the existing file should be overwritten. The default behavior is to raise a FileExistsError if the file exists, and overwrite is not specified. This error is ignored in overwrite=True. No matter what a IsADirectoryError is raised if the path is a folder.

Thanks @tjlaboss for the prototyping.

Fixes #442

Checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@MicahGale MicahGale linked an issue Jul 11, 2024 that may be closed by this pull request
@MicahGale MicahGale self-assigned this Jul 11, 2024
@MicahGale MicahGale requested a review from tjlaboss July 11, 2024 21:57
@MicahGale
Copy link
Collaborator Author

Do you think this change counts as a minor or patch version change?

@MicahGale MicahGale marked this pull request as ready for review July 12, 2024 14:41
@MicahGale
Copy link
Collaborator Author

MicahGale commented Jul 15, 2024

I need to update the getting started guide accordingly.

Completed.

@MicahGale MicahGale marked this pull request as draft July 15, 2024 14:02
@MicahGale MicahGale marked this pull request as ready for review July 15, 2024 16:56
@tjlaboss
Copy link
Collaborator

Do you think this change counts as a minor or patch version change?

MINOR version when you add functionality in a backward compatible manner
PATCH version when you make backward compatible bug fixes

This fits the description of MINOR version more closely than PATCH version I'd say.

@tjlaboss
Copy link
Collaborator

Nice to see that #439 is useful.

@MicahGale
Copy link
Collaborator Author

Do you think this change counts as a minor or patch version change?

MINOR version when you add functionality in a backward compatible manner
PATCH version when you make backward compatible bug fixes

This fits the description of MINOR version more closely than PATCH version I'd say.

Ok I'll update docs to say version 0.3.0. Yay we are off the rails of running into the version 0.2.15 train on test-pypi

@MicahGale MicahGale merged commit 566a20e into develop Jul 15, 2024
14 checks passed
@MicahGale MicahGale deleted the 442-guardrail-for-mcnp_problemwrite_to_file branch July 15, 2024 21:14
@MicahGale MicahGale mentioned this pull request Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Guardrail for MCNP_Problem.write_to_file()
2 participants