Skip to content

Commit

Permalink
restore accidentally deleted io.core.InputFile.from_string
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Aug 8, 2023
1 parent 3fac5dc commit e703c43
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pymatgen/io/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from pathlib import Path
from zipfile import ZipFile

import numpy as np
from monty.io import zopen
from monty.json import MSONable

Expand Down Expand Up @@ -68,6 +69,20 @@ def write_file(self, filename: str | Path) -> None:
with zopen(filename, "wt") as f:
f.write(self.get_string())

@np.deprecate(message="Use from_str instead")
@classmethod
@abc.abstractmethod
def from_string(cls, contents: str):
"""
Create an InputFile object from a string.
Args:
contents: The contents of the file as a single string
Returns:
InputFile
"""

@classmethod
@abc.abstractmethod
def from_str(cls, contents: str):
Expand Down

0 comments on commit e703c43

Please sign in to comment.