Skip to content

feat: Check if saved files exists and raise an early error if they do - #223

Merged
sbillinge merged 8 commits into
diffpy:mainfrom
cadenmyers13:check-saved-files
Apr 2, 2026
Merged

feat: Check if saved files exists and raise an early error if they do#223
sbillinge merged 8 commits into
diffpy:mainfrom
cadenmyers13:check-saved-files

Conversation

@cadenmyers13

Copy link
Copy Markdown
Contributor

closes#220

Before, this was just a print statement which was confusing. Now an error is raised if the output file already exists.

@cadenmyers13

Copy link
Copy Markdown
ContributorAuthor

@sbillinge ready for review

@cadenmyers13

Copy link
Copy Markdown
ContributorAuthor

Ah, it's failing

@sbillingesbillinge left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the ocde. modulo a couple of small comments it looks good. Let me know when tests are passing and I can merge.

if outfile.exists() and not args.force:
print(f"WARNING: {outfile} exists. Use --force to overwrite.")
return
outfile = args.output_directory / (input_path.stem + "-mud-corrected.chi")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no biggie, but as a general rule, let's compose as f-strings, not using +

Comment threadsrc/diffpy/labpdfproc/tools.py Outdated
and output directory."""
existing_files = []
for path in args.input_paths:
outfile = args.output_directory / (path.stem + "-mud-corrected.chi")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

@sbillinge
sbillinge merged commit 9dda146 into diffpy:mainApr 2, 2026
5 checks passed
@codecov

codecovBot commented Apr 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.17%. Comparing base (24c43cb) to head (5125fa9).
⚠️ Report is 30 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #223 +/- ##
==========================================
+ Coverage 99.13% 99.17% +0.04% 
==========================================
Files 5 5 Lines 345 364 +19 ==========================================
+ Hits 342 361 +19 
Misses 3 3 
Files with missing linesCoverage Δ
tests/conftest.py100.00% <100.00%> (ø)
tests/test_tools.py98.74% <100.00%> (+0.07%)⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cadenmyers13
cadenmyers13 deleted the check-saved-files branch April 2, 2026 16:23
Sign up for freeto 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.

docs: some little documentation tweaks for the 0.4.0 release

2 participants

@cadenmyers13@sbillinge