-
Notifications
You must be signed in to change notification settings - Fork 0
Protect folder if it exists before it was declared #57
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR modifies the DirectoryObject class to automatically protect folders that already exist when they are instantiated. The protected parameter now defaults to None, which means the protection behavior is determined by whether the directory exists at instantiation time.
- Changed the default value of
protectedparameter fromFalsetoNone - Added logic to automatically set
protected=Truefor existing directories andprotected=Falsefor new directories - Added comprehensive test coverage for the new protection behavior
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pyiron_snippets/files.py | Modified DirectoryObject constructor to handle None protection and auto-detect existing directories |
| tests/unit/test_files.py | Added test cases to verify the new automatic protection behavior |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #57 +/- ##
==========================================
+ Coverage 95.14% 95.15% +0.01%
==========================================
Files 13 13
Lines 535 537 +2
==========================================
+ Hits 509 511 +2
Misses 26 26 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super 👍
Co-authored-by: Liam Huber <liamhuber@greyhavensolutions.com>
Closes #56
Now
protectedisNoneby default, which meansTrueif the folder already exists, andFalseotherwise.