Add more meta information to trove entries

This commit is contained in:
Andrew Mulbrook 2026-03-22 23:57:05 -05:00
parent 4ada169bbe
commit bd4d571c95
5 changed files with 80 additions and 7 deletions

View file

@ -1,6 +1,7 @@
from typing import Protocol, runtime_checkable, Optional, Dict, List, Self, NamedTuple, Iterable, TypedDict
from uuid import UUID
from pathlib import PurePosixPath
import datetime as dt
type ObjectId = int | str | UUID
@ -26,11 +27,27 @@ class Note(Protocol):
Protocol for a Note item.
Represents access to an individual note's content and metadata.
"""
@property
def object_id(self) -> ObjectId:
"""The unique identifier for this note."""
...
@property
def mime(self) -> str:
"""The MIME type of the note's content."""
...
@property
def readonly(self) -> bool:
"""Whether the note is read-only."""
...
@property
def mtime(self) -> dt.datetime:
"""The last modification time of the note."""
...
def get_raw_metadata(self, key: str) -> Optional[bytes]:
"""Retrieve metadata value for the given key."""
...
@ -84,10 +101,12 @@ class Tree(Protocol):
"""Return all entries as {name: object_id}."""
...
class BlobNote(Note, Blob):
@runtime_checkable
class BlobNote(Note, Blob, Protocol):
"""Blob Note"""
class TreeNote(Note, Tree):
@runtime_checkable
class TreeNote(Note, Tree, Protocol):
"""Tree Note"""