Skip to content

Commit

Permalink
Update regular expressions for python 3.12 compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
smcolby committed Dec 18, 2024
1 parent 5ebdc8a commit fe11a63
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions isicle/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def _find_output_by_header(self, header):
pattern = (
r"(-{2,})\n\s{0,}("
+ re.escape(header)
+ ")\s{0,}\n-{2,}\n([\s\S]*?)(?=-{2,}\n[^\n]*\n-{2,}\n|$)"
+ r")\s{0,}\n-{2,}\n([\s\S]*?)(?=-{2,}\n[^\n]*\n-{2,}\n|$)"
)

# Search ORCA output file
Expand Down Expand Up @@ -242,8 +242,8 @@ def _parse_spin(self):

# Parse table
text = [x.strip() for x in text if x.strip() != "" and "*" not in x]
columns = [x.replace(" ", "") for x in re.split("\s{2,}", text[0])]
body = [re.split("\s{2,}", x)[1:] for x in text[1:-1]]
columns = [x.replace(" ", "") for x in re.split(r"\s{2,}", text[0])]
body = [re.split(r"\s{2,}", x)[1:] for x in text[1:-1]]

# Construct data frame
return pd.DataFrame(body, dtype=float, columns=columns, index=columns)
Expand Down

0 comments on commit fe11a63

Please sign in to comment.