From ab9914959e1abc6154139804abddb9736a9ee854 Mon Sep 17 00:00:00 2001 From: Shyue Ping Ong Date: Wed, 23 Oct 2024 08:53:24 -0700 Subject: [PATCH] Minor code simplification. --- src/pymatgen/io/vasp/outputs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pymatgen/io/vasp/outputs.py b/src/pymatgen/io/vasp/outputs.py index caf3f2c5b56..b124884f2cd 100644 --- a/src/pymatgen/io/vasp/outputs.py +++ b/src/pymatgen/io/vasp/outputs.py @@ -5788,7 +5788,9 @@ def __init__(self, dirname: str | Path): dirname: The directory containing the VASP calculation as a string or Path. """ self.path = Path(dirname).absolute() - self.files = [Path(d) / f for d, subd, fnames in os.walk(self.path) for f in fnames] + + # Note that py3.12 has Path.walk(). But we need to use os.walk to ensure backwards compatibility for now. + self.files = [Path(d) / f for d, _, fnames in os.walk(self.path) for f in fnames] self._parsed_files: dict[str, Any] = {} def reset(self): @@ -5823,7 +5825,7 @@ def __getitem__(self, item): return self._parsed_files[item] warnings.warn( - f"No parser defined for {item}. Full text of file is returned as a string.", + f"No parser defined for {item}. Contents are returned as a string.", UserWarning, ) with zopen(fpath, "rt") as f: