Skip to content

Conversation

@samwaseda
Copy link
Member

Closes #56

Now protected is None by default, which means True if the folder already exists, and False otherwise.

@github-actions
Copy link

github-actions bot commented Aug 5, 2025

Binder 👈 Launch a binder notebook on branch pyiron/pyiron_snippets/delete

@samwaseda samwaseda requested review from Copilot and liamhuber August 5, 2025 19:39
Copy link
Contributor

Copilot AI left a 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 protected parameter from False to None
  • Added logic to automatically set protected=True for existing directories and protected=False for 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
Copy link

codecov bot commented Aug 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.15%. Comparing base (4b26ce9) to head (9476546).
⚠️ Report is 6 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@liamhuber liamhuber left a 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>
@samwaseda samwaseda merged commit ec3d20a into main Aug 6, 2025
4 of 5 checks passed
@samwaseda samwaseda deleted the delete branch August 6, 2025 05:08
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.

Re-use accidentally kills directories?

2 participants