Various bug fixes.

This commit is contained in:
lwark
2024-05-30 13:54:35 -05:00
parent ecfc71bcc5
commit 5c52c02f7e
18 changed files with 447 additions and 375 deletions

View File

@@ -100,11 +100,15 @@ class RSLNamer(object):
regex (str): string to construct pattern
filename (str): string to be parsed
"""
# logger.debug(f"Input string to be parsed: {filename}")
logger.debug(f"Input string to be parsed: {filename}")
if regex is None:
regex = BasicSubmission.construct_regex()
else:
regex = re.compile(rf'{regex}', re.IGNORECASE | re.VERBOSE)
logger.debug(f"Incoming regex: {regex}")
try:
regex = re.compile(rf'{regex}', re.IGNORECASE | re.VERBOSE)
except re.error as e:
regex = BasicSubmission.construct_regex()
# logger.debug(f"Using regex: {regex}")
match filename:
case Path():

View File

@@ -194,7 +194,7 @@ class PydSample(BaseModel, extra='allow'):
# logger.debug(f"Data for pydsample: {data}")
model = BasicSample.find_polymorphic_subclass(polymorphic_identity=data.sample_type)
for k, v in data.model_extra.items():
print(k, v)
# print(k, v)
if k in model.timestamps():
if isinstance(v, str):
v = datetime.strptime(v, "%Y-%m-%d")
@@ -463,7 +463,10 @@ class PydSubmission(BaseModel, extra='allow'):
return value
else:
# logger.debug("Constructing plate name.")
output = RSLNamer(filename=values.data['filepath'].__str__(), sub_type=sub_type,
if "pytest" in sys.modules and sub_type.replace(" ", "") == "BasicSubmission":
output = "RSL-BS-Test001"
else:
output = RSLNamer(filename=values.data['filepath'].__str__(), sub_type=sub_type,
data=values.data).parsed_name
return dict(value=output, missing=True)