Spaces:
Runtime error
Runtime error
File size: 717 Bytes
1f03a91 bb7c9a3 1f03a91 af0a2bd c5fe6f5 1f03a91 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
from datetime import datetime
from pydantic import BaseModel, ConfigDict
from typing import Self
class GoogleDriveMetadata(BaseModel):
"""Represents Google Drive file or folder metadata."""
model_config = ConfigDict(frozen=True)
id: str
name: str
modified_time: datetime
mime_type: str
folder_path: str
@classmethod
def from_folder_path_and_dict(cls, folder_path: str, dict: dict) -> Self:
id = dict["id"]
name = dict["name"]
modified_time = datetime.fromisoformat(dict["modifiedTime"])
mime_type = dict["mimeType"]
return GoogleDriveMetadata(id=id, name=name, modified_time=modified_time, mime_type=mime_type, folder_path=folder_path)
|