Formatting

This commit is contained in:
Jamie Hardt
2025-08-26 17:21:03 -07:00
parent 5ea64d089f
commit fb56ca1dd4
2 changed files with 12 additions and 8 deletions

View File

@@ -107,8 +107,9 @@ def evaluate(dataset, offset, limit):
miss_counts = []
for cat in cats:
miss_counts.append((cat, len([x for x in results
if x['catid'] == cat and x['result'] == 'MISS'])))
miss_counts.append(
(cat, len([x for x in results
if x['catid'] == cat and x['result'] == 'MISS'])))
miss_counts = sorted(miss_counts, key=lambda x: x[1])

View File

@@ -66,12 +66,14 @@ def build_ucs(components: UcsNameComponents, extension: str) -> str:
"""
Build a UCS filename
"""
assert components.validate(), "UcsNameComponents contains invalid characters"
assert components.validate(), \
"UcsNameComponents contains invalid characters"
return ""
def parse_ucs(rootname: str, catid_list: list[str]) -> Optional[UcsNameComponents]:
def parse_ucs(rootname: str,
catid_list: list[str]) -> Optional[UcsNameComponents]:
"""
Parse the UCS components from a file name root.
@@ -80,11 +82,12 @@ def parse_ucs(rootname: str, catid_list: list[str]) -> Optional[UcsNameComponent
:returns: the components, or `None` if the filename is not in UCS format
"""
regexp1 = r"^(?P<CatID>[A-z]+)(-(?P<UserCat>[^_]+))?_((?P<VendorCat>[^-]+)-)?(?P<FXName>[^_]+)"
regexp1 = r"^(?P<CatID>[A-z]+)(-(?P<UserCat>[^_]+))?_"
regexp2 = r"((?P<VendorCat>[^-]+)-)?(?P<FXName>[^_]+)"
regexp3 = r"(_(?P<CreatorID>[^_]+)(_(?P<SourceID>[^_]+)"
regexp4 = r"(_(?P<UserData>[^.]+))?)?)?"
regexp2 = r"(_(?P<CreatorID>[^_]+)(_(?P<SourceID>[^_]+)(_(?P<UserData>[^.]+))?)?)?"
regexp = regexp1 + regexp2
regexp = regexp1 + regexp2 + regexp3 + regexp4
matches = match(regexp, rootname)