Nexus: Update pseudopotential.py to accept pathlib.Path objects#5933
Merged
prckent merged 6 commits intoMay 21, 2026
Conversation
jtkrogel
requested changes
Apr 30, 2026
| self.error('incorrect use of ppset\nnon-filename provided with set labeled "{0}" for simulation code "{1}"\neach pseudopential file name must be a string\nreceived type: {2}\nwith value: {3}'.format(label,code,pp.__class__.__name__,pp)) | ||
| #end if | ||
| elem_label,symbol,is_elem = pp_elem_label(pp) | ||
| if isinstance(pp, str): |
Contributor
There was a problem hiding this comment.
Why not keep a single line?
elem_label,symbol,is_elem = pp_elem_label(str(pp))
Contributor
Author
There was a problem hiding this comment.
If the file path is a fully resolved path then that would include everything, not just the file name.
Contributor
There was a problem hiding this comment.
Just use pp=path_string(pp) under an isinstance(pp,str|Path)
Contributor
|
Test this please |
jtkrogel
requested changes
May 1, 2026
Contributor
jtkrogel
left a comment
There was a problem hiding this comment.
Halt Path additions until fundamental compatibility problems are addressed
Contributor
|
Approach again after #5944 |
8 tasks
jtkrogel
requested changes
May 19, 2026
| self.error('incorrect use of ppset\nnon-filename provided with set labeled "{0}" for simulation code "{1}"\neach pseudopential file name must be a string\nreceived type: {2}\nwith value: {3}'.format(label,code,pp.__class__.__name__,pp)) | ||
| #end if | ||
| elem_label,symbol,is_elem = pp_elem_label(pp) | ||
| if isinstance(pp, str): |
Contributor
There was a problem hiding this comment.
Just use pp=path_string(pp) under an isinstance(pp,str|Path)
Contributor
|
Test this please |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
This just updates
pseudopotential.pyto acceptpathlib.Pathobjects where necessary. It passes current testing, and seems to pass through a set of small tests where I usepathlib.Pathobjects.This contributes to #5881.
What type(s) of changes does this code introduce?
Does this introduce a breaking change?
What systems has this change been tested on?
Laptop, Fedora 43 KDE Plasma
Python 3.14.4
uv 0.11.8
Numpy 2.4.4
Pytest 9.0.3
Checklist