Add more meta information to trove entries
This commit is contained in:
parent
4ada169bbe
commit
bd4d571c95
5 changed files with 80 additions and 7 deletions
|
|
@ -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"""
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue