Skip to content

Commit

Permalink
Fixing some names
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecThomson committed Jan 15, 2025
1 parent 9f16506 commit 0534368
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions flint/naming.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ def rename_linear_to_stokes(
if stokes.lower() not in ("q", "u"):
raise NameError(f"Stokes {stokes=} is not linear!")

pattern = r"\.qu\." # Regex pattern to replace

if isinstance(linear_name, Path):
name_str = linear_name.as_posix()
stokes_name = re.sub(r"\.qu\.", stokes, name_str)
stokes_name = re.sub(pattern, stokes, name_str)
return Path(stokes_name)
else:
stokes_name = re.sub(r"\.qu\.", stokes, linear_name)
stokes_name = re.sub(pattern, stokes, linear_name)
return stokes_name


Expand Down

0 comments on commit 0534368

Please sign in to comment.