MCPcopy
hub / github.com/TaskingAI/TaskingAI / _object_key

Function _object_key

backend/tkhelper/database/boto3/client.py:40–53  ·  view source on GitHub ↗
(
    purpose: str,
    file_id: str,
    ext: str,
    tenant_id: str,
    original_name: Optional[str] = None,
)

Source from the content-addressed store, hash-verified

38
39
40def _object_key(
41 purpose: str,
42 file_id: str,
43 ext: str,
44 tenant_id: str,
45 original_name: Optional[str] = None,
46) -> str:
47 type_path = "imgs/" if (ext in image_extensions) else "files/"
48 purpose_path = f"{purpose[0]}/"
49 tenant_path = f"{tenant_id}/"
50 date_path = f"{get_base62_date()}/"
51 ext = f"/{original_name}" if original_name else f".{ext}"
52
53 return f"{type_path}{purpose_path}{tenant_path}{date_path}{file_id}{ext}"
54
55
56class StorageClient:

Callers 7

check_file_existsMethod · 0.85
get_file_metadataMethod · 0.85
download_file_to_pathMethod · 0.85
get_file_urlMethod · 0.85
delete_fileMethod · 0.85

Calls 1

get_base62_dateFunction · 0.90

Tested by

no test coverage detected