df_cols is now created as a set. All operations were already set operations on the object. If the order of the columns will need to be maintained in future versions, this should be restored to the original list.

This commit is contained in:
Samuel J. Woodward 2025-01-06 09:15:38 -05:00
parent 799cb0f6cf
commit 56d3b66a5c

View File

@ -136,7 +136,7 @@ def find(
representations = []
# required columns for representations
df_cols = [
df_cols = {
"identity",
"hash",
"embedding",
@ -144,7 +144,7 @@ def find(
"target_y",
"target_w",
"target_h",
]
}
# Ensure the proper pickle file exists
if not os.path.exists(datastore_path):
@ -157,7 +157,7 @@ def find(
# check each item of representations list has required keys
for i, current_representation in enumerate(representations):
missing_keys = set(df_cols) - set(current_representation.keys())
missing_keys = df_cols - set(current_representation.keys())
if len(missing_keys) > 0:
raise ValueError(
f"{i}-th item does not have some required keys - {missing_keys}."