renaming
This commit is contained in:
parent
2c902f3129
commit
ece918fc0e
@ -22,7 +22,7 @@ def build_file_path(storage_upload_info, folder):
|
||||
return f"{storage_upload_info['fileId']}" + (f"/{folder}" if folder else "")
|
||||
|
||||
|
||||
def standardize(data) -> Dict:
|
||||
def standardize(storage_item) -> Dict:
|
||||
"""Storage items can be a blob or a blob with metadata. Standardizes to the latter.
|
||||
|
||||
Cases:
|
||||
@ -40,17 +40,17 @@ def standardize(data) -> Dict:
|
||||
def is_blob_with_metadata(data: Dict):
|
||||
return isinstance(data, dict)
|
||||
|
||||
if is_blob_without_metadata(data):
|
||||
return wrap(data)
|
||||
if is_blob_without_metadata(storage_item):
|
||||
return wrap(storage_item)
|
||||
|
||||
elif is_blob_with_metadata(data):
|
||||
validate(data)
|
||||
return data
|
||||
elif is_blob_with_metadata(storage_item):
|
||||
validate(storage_item)
|
||||
return storage_item
|
||||
|
||||
else: # Fallback / used for testing with simple data
|
||||
logger.warning("Encountered storage data in unexpected format.")
|
||||
assert isinstance(data, str)
|
||||
return wrap(string_to_bytes(data))
|
||||
assert isinstance(storage_item, str)
|
||||
return wrap(string_to_bytes(storage_item))
|
||||
|
||||
|
||||
def wrap(data):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user