memoryframes 0.1.6__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: memoryframes
3
- Version: 0.1.6
3
+ Version: 0.2.0
4
4
  Summary: Add your description here
5
5
  Author: David Brownell
6
6
  Author-email: David Brownell <github@DavidBrownell.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "MemoryFrames"
3
- version = "0.1.6"
3
+ version = "0.2.0"
4
4
  # ^^^^^
5
5
  # Wheel names will be generated according to this value. Do not manually modify this value; instead
6
6
  # update it according to committed changes by running this command from the root of the repository:
@@ -0,0 +1,25 @@
1
+ from dataclasses import dataclass, field
2
+ from typing import TYPE_CHECKING
3
+
4
+ if TYPE_CHECKING:
5
+ from uuid import UUID
6
+
7
+ from MemoryFrames.PluginInfra.NoteSource import NoteSource
8
+
9
+
10
+ # ----------------------------------------------------------------------
11
+ @dataclass
12
+ class Note:
13
+ """A note."""
14
+
15
+ id: UUID
16
+
17
+ source: NoteSource
18
+ source_data: object
19
+ """Opaque data provided by the NoteSource that created the note."""
20
+
21
+ metadata: dict[str, object] = field(repr=False)
22
+ content: str = field(repr=False)
23
+
24
+ metadata_hash: bytes = field(repr=False)
25
+ content_hash: bytes = field(repr=False)
@@ -0,0 +1,36 @@
1
+ from abc import ABC, abstractmethod
2
+ from typing import TYPE_CHECKING
3
+
4
+ if TYPE_CHECKING:
5
+ from MemoryFrames.PluginInfra.Note import Note
6
+
7
+
8
+ # ----------------------------------------------------------------------
9
+ class NoteSource:
10
+ """Base class for a plugin component that provides notes to MemoryFrames."""
11
+
12
+ # ----------------------------------------------------------------------
13
+ def __init__(self, observer: NoteSourceObserver) -> None:
14
+ self.observer = observer
15
+
16
+
17
+ # ----------------------------------------------------------------------
18
+ class NoteSourceObserver(ABC):
19
+ """Base class for an observer that receives event notifications from a NoteSource."""
20
+
21
+ # ----------------------------------------------------------------------
22
+ @abstractmethod
23
+ def OnNewNote(
24
+ self,
25
+ note: Note,
26
+ *,
27
+ is_initializing: bool,
28
+ ) -> None:
29
+ """Indicate that a note has been discovered."""
30
+ raise NotImplementedError() # pragma: no cover
31
+
32
+ # ----------------------------------------------------------------------
33
+ @abstractmethod
34
+ def OnInitializationComplete(self, note_source: NoteSource) -> None:
35
+ """Indicate that the NoteSource has completed its initialization."""
36
+ raise NotImplementedError() # pragma: no cover
File without changes
File without changes