Private instance vars, public get properties
This commit is contained in:
20
sia/entry.py
20
sia/entry.py
@@ -5,10 +5,6 @@ import xml.etree.ElementTree as ET
|
||||
class Entry(ABC):
|
||||
"""
|
||||
Abstract base class for all entry types in the working memory.
|
||||
|
||||
Attributes:
|
||||
id: Unique identifier for the entry
|
||||
timestamp: When the entry was created
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, timestamp: datetime):
|
||||
@@ -19,9 +15,19 @@ class Entry(ABC):
|
||||
id: Unique identifier for this entry
|
||||
timestamp: Creation timestamp for this entry
|
||||
"""
|
||||
self.id = id
|
||||
self.timestamp = timestamp
|
||||
|
||||
self._id = id
|
||||
self._timestamp = timestamp
|
||||
|
||||
@property
|
||||
def id(self) -> str:
|
||||
"""Get entry's unique identifier."""
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def timestamp(self) -> datetime:
|
||||
"""Get entry's creation timestamp."""
|
||||
return self._timestamp
|
||||
|
||||
@abstractmethod
|
||||
def update(self) -> None:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user