Skip to content

Commit

Permalink
Remove deprecated unicode2str monty import
Browse files Browse the repository at this point in the history
  • Loading branch information
rashatwi committed Mar 17, 2024
1 parent a81fda0 commit 1575d5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions pymatgen/analysis/cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import scipy.constants as const
from monty.design_patterns import singleton
from monty.string import unicode2str

from pymatgen.core.composition import Composition
from pymatgen.core.periodic_table import Element
Expand Down Expand Up @@ -100,7 +99,7 @@ def __init__(self, filename):
self._chemsys_entries = defaultdict(list)
filename = os.path.join(os.path.dirname(__file__), filename)
with open(filename, "rt") as f:
reader = csv.reader(f, quotechar=unicode2str("|"))
reader = csv.reader(f, quotechar="|")
for row in reader:
comp = Composition(row[0])
cost_per_mol = float(row[1]) * comp.weight.to("kg") * const.N_A
Expand Down
9 changes: 4 additions & 5 deletions pymatgen/entries/entry_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from typing import Iterable, List, Set, Union

from monty.json import MontyDecoder, MontyEncoder, MSONable
from monty.string import unicode2str

from pymatgen.analysis.phase_diagram import PDEntry
from pymatgen.analysis.structure_matcher import SpeciesComparator, StructureMatcher
Expand Down Expand Up @@ -282,8 +281,8 @@ def to_csv(self, filename: str, latexify_names: bool = False):
with open(filename, "w") as f:
writer = csv.writer(
f,
delimiter=unicode2str(","),
quotechar=unicode2str('"'),
delimiter=",",
quotechar='"',
quoting=csv.QUOTE_MINIMAL,
)
writer.writerow(["Name"] + [el.symbol for el in elements] + ["Energy"])
Expand All @@ -307,8 +306,8 @@ def from_csv(cls, filename: str):
with open(filename, "r", encoding="utf-8") as f:
reader = csv.reader(
f,
delimiter=unicode2str(","),
quotechar=unicode2str('"'),
delimiter=",",
quotechar='"',
quoting=csv.QUOTE_MINIMAL,
)
entries = list()
Expand Down

0 comments on commit 1575d5c

Please sign in to comment.