Skip to content

Commit

Permalink
Merge branch 'materialsproject:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
benrich37 authored Oct 25, 2024
2 parents b9e0454 + 17855fe commit 1dc0c38
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/pymatgen/io/vasp/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5803,18 +5803,16 @@ def __init__(self, dirname: str | Path):
dirname: The directory containing the VASP calculation as a string or Path.
"""
self.path = Path(dirname).absolute()

# Note that py3.12 has Path.walk(). But we need to use os.walk to ensure backwards compatibility for now.
self.files = [str(Path(d) / f).lstrip(str(self.path)) for d, _, fnames in os.walk(self.path) for f in fnames]
self._parsed_files: dict[str, Any] = {}
self.reset()

def reset(self):
"""
Reset all loaded files and recheck the directory for files. Use this when the contents of the directory has
changed.
"""
# Note that py3.12 has Path.walk(). But we need to use os.walk to ensure backwards compatibility for now.
self.files = [str(Path(d) / f).lstrip(str(self.path)) for d, _, fnames in os.walk(self.path) for f in fnames]
self._parsed_files = {}
self._parsed_files: dict[str, Any] = {}

def __len__(self):
return len(self.files)
Expand Down

0 comments on commit 1dc0c38

Please sign in to comment.