Skip to content

Commit 1de9efb

Browse files
committed
Use raw string for regex to avoid SyntaxWarning
This fixes the following warnings: ```python /home/patrick/virtualenvs/conda/envs/hexrdgui/src/hexrdgui/hexrdgui/llnl_import_tool_dialog.py:739: SyntaxWarning: "\d" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\d"? A raw string is also an option. image = re.sub("CAMERA-\d{2}-", "CAMERA-*-", selected_file) /home/patrick/virtualenvs/conda/envs/hexrdgui/src/hexrdgui/hexrdgui/llnl_import_tool_dialog.py:740: SyntaxWarning: "\d" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\d"? A raw string is also an option. files = re.sub("-\d{3}.h", "-*.h", image) ``` Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
1 parent 1851c39 commit 1de9efb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

hexrdgui/llnl_import_tool_dialog.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,8 +736,8 @@ def load_detector_images(self):
736736
# TD_TC000-000_FIDDLE_CAMERA-02-DB_SHOT_RAW-FIDDLE-CAMERA_N240717-001-999.h5
737737
# ->
738738
# TD_TC000-000_FIDDLE_CAMERA-*-DB_SHOT_RAW-FIDDLE-CAMERA_N240717-001-*.h5
739-
image = re.sub("CAMERA-\d{2}-", "CAMERA-*-", selected_file)
740-
files = re.sub("-\d{3}.h", "-*.h", image)
739+
image = re.sub(r"CAMERA-\d{2}-", "CAMERA-*-", selected_file)
740+
files = re.sub(r"-\d{3}.h", "-*.h", image)
741741

742742
# Sort matched files. We know that those ending in -999 are data files.
743743
# Dark files may have different values at the end (-003, -005, etc.) so

0 commit comments

Comments
 (0)