Skip to content

Commit 416913a

Browse files
author
David Erb
committed
makes visit patern case insensitive
1 parent 8a5852a commit 416913a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/dls_utilpack/visit.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def get_visit_year(beamline, visit):
3838
def get_xchem_subdirectory(visit):
3939

4040
# This is the pattern all visits must have.
41-
pattern = r"^([a-z][a-z][0-9][0-9][0-9][0-9][0-9])[-]([0-9]+)([_].*)?$"
41+
pattern = r"^([A-Za-z][A-Za-z][0-9][0-9][0-9][0-9][0-9])[-]([0-9]+)([_].*)?$"
4242

4343
match = re.search(pattern, visit)
4444

@@ -47,8 +47,8 @@ def get_xchem_subdirectory(visit):
4747
f'the visit name "{visit}" does not conform to the visit naming convention'
4848
)
4949

50-
part1 = match.group(1)
51-
part2 = match.group(2)
50+
part1 = match.group(1).lower()
51+
part2 = match.group(2).lower()
5252

5353
subdirectory = f"{part1}/{part1}-{part2}"
5454

tests/test_visit.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ async def _main_coroutine(
3232

3333
# Check valid visits.
3434
assert get_xchem_subdirectory("aa12345-1") == "aa12345/aa12345-1"
35+
assert get_xchem_subdirectory("AB12345-1") == "ab12345/ab12345-1"
36+
assert get_xchem_subdirectory("Ab12345-1") == "ab12345/ab12345-1"
37+
assert get_xchem_subdirectory("aB12345-1") == "ab12345/ab12345-1"
3538
assert get_xchem_subdirectory("aa12345-1234") == "aa12345/aa12345-1234"
3639
assert get_xchem_subdirectory("aa12345-1234_") == "aa12345/aa12345-1234"
3740
assert (

0 commit comments

Comments
 (0)