Skip to content

Commit

Permalink
tweak type
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielYang59 committed Oct 18, 2024
1 parent 6799044 commit 3ce90e8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/pymatgen/io/vasp/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ def from_str(cls, string: str) -> Self:
for sline in line.split(";"):
if match := re.match(r"(\w+)\s*=\s*(.*)", sline.strip()):
key: str = match[1].strip()
val: Any = match[2].strip()
val: str = match[2].strip()
params[key] = cls.proc_val(key, val)
return cls(params)

Expand Down
18 changes: 9 additions & 9 deletions src/pymatgen/util/io_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from monty.io import zopen

if TYPE_CHECKING:
from collections.abc import Generator
from collections.abc import Iterator

__author__ = "Shyue Ping Ong, Rickard Armiento, Anubhav Jain, G Matteo, Ioannis Petousis"
__copyright__ = "Copyright 2011, The Materials Project"
Expand All @@ -21,21 +21,21 @@


def clean_lines(
string_list,
remove_empty_lines=True,
rstrip_only=False,
) -> Generator[str, None, None]:
string_list: list[str],
remove_empty_lines: bool = True,
rstrip_only: bool = False,
) -> Iterator[str]:
"""Strips whitespace, carriage returns and empty lines from a list of strings.
Args:
string_list: List of strings
remove_empty_lines: Set to True to skip lines which are empty after
string_list(list[str]): List of strings.
remove_empty_lines(bool): Set to True to skip lines which are empty after
stripping.
rstrip_only: Set to True to strip trailing whitespaces only (i.e.,
rstrip_only(bool): Set to True to strip trailing whitespaces only (i.e.,
to retain leading whitespaces). Defaults to False.
Yields:
list: clean strings with no whitespaces. If rstrip_only == True,
str: clean strings with no whitespaces. If rstrip_only == True,
clean strings with no trailing whitespaces.
"""
for s in string_list:
Expand Down

0 comments on commit 3ce90e8

Please sign in to comment.