generated from pufereq/python-template
Compare commits
4 Commits
0.7.0
...
a805ccf38e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a805ccf38e | ||
|
1e9077c3a8
|
|||
|
89f95004c1
|
|||
|
795410047e
|
14
CHANGELOG.md
14
CHANGELOG.md
@@ -2,6 +2,20 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [0.8.0] - 2026-03-03
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- [`7954100`](https://gitea.pufereq.pl/judas/judas_protocol/commit/795410047ef20ebb39503c09a5359e53475f2274) **types.py**: add `ActionType` type
|
||||||
|
|
||||||
|
### Miscellaneous Tasks
|
||||||
|
|
||||||
|
- [`89f9500`](https://gitea.pufereq.pl/judas/judas_protocol/commit/89f95004c1877263fbd1047fc09fe9196d8494f5) **__init__.py**: add `ActionType` to `__all__`
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- [`1e9077c`](https://gitea.pufereq.pl/judas/judas_protocol/commit/1e9077c3a837d00c793ee50c5cbd754d5f0ec58a) **message.py**: use `ActionType` instead of `Enum`
|
||||||
|
|
||||||
## [0.7.0] - 2026-03-01
|
## [0.7.0] - 2026-03-01
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "judas_protocol"
|
name = "judas_protocol"
|
||||||
version = "0.7.0"
|
version = "0.8.0"
|
||||||
description = "The judas protocol"
|
description = "The judas protocol"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = []
|
authors = []
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
__version__: str = "0.1.0"
|
__version__: str = "0.1.0"
|
||||||
|
|
||||||
from .message import Message
|
from .message import Message
|
||||||
from .types import Category, ControlAction
|
from .types import ActionType, Category, ControlAction
|
||||||
|
|
||||||
__all__ = ["__version__", "Message", "Category", "ControlAction"]
|
__all__ = ["__version__", "Message", "ActionType", "Category", "ControlAction"]
|
||||||
|
|||||||
@@ -3,10 +3,9 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import uuid
|
import uuid
|
||||||
from enum import Enum
|
|
||||||
from typing import Any, override
|
from typing import Any, override
|
||||||
|
|
||||||
from judas_protocol.types import Category, ControlAction
|
from judas_protocol.types import ActionType, Category, ControlAction
|
||||||
|
|
||||||
|
|
||||||
class Message:
|
class Message:
|
||||||
@@ -16,7 +15,7 @@ class Message:
|
|||||||
self,
|
self,
|
||||||
id_: str | None,
|
id_: str | None,
|
||||||
category: Category,
|
category: Category,
|
||||||
action: Enum,
|
action: ActionType,
|
||||||
payload: dict[str, Any] | None = None,
|
payload: dict[str, Any] | None = None,
|
||||||
*,
|
*,
|
||||||
acknowledged: bool = False,
|
acknowledged: bool = False,
|
||||||
@@ -27,14 +26,14 @@ class Message:
|
|||||||
Args:
|
Args:
|
||||||
id_ (str | None): The ID of the message. If None, a new UUID will be generated.
|
id_ (str | None): The ID of the message. If None, a new UUID will be generated.
|
||||||
category (Category): The category of the message.
|
category (Category): The category of the message.
|
||||||
action (Enum): The action of the message.
|
action (ActionType): The action of the message.
|
||||||
payload (dict[str, Any] | None): The payload of the message.
|
payload (dict[str, Any] | None): The payload of the message.
|
||||||
acknowledged (bool): Whether the message has been acknowledged. Defaults to False.
|
acknowledged (bool): Whether the message has been acknowledged. Defaults to False.
|
||||||
ack_required (bool): Whether the message requires an acknowledgment. Defaults to False.
|
ack_required (bool): Whether the message requires an acknowledgment. Defaults to False.
|
||||||
"""
|
"""
|
||||||
self.id: str = id_ or str(uuid.uuid4())
|
self.id: str = id_ or str(uuid.uuid4())
|
||||||
self.category: Category = category
|
self.category: Category = category
|
||||||
self.action: Enum = action
|
self.action: ActionType = action
|
||||||
self.payload: dict[str, Any] = payload or {}
|
self.payload: dict[str, Any] = payload or {}
|
||||||
|
|
||||||
self.acknowledged: bool = acknowledged
|
self.acknowledged: bool = acknowledged
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
|
type ActionType = ControlAction
|
||||||
|
|
||||||
|
|
||||||
class Category(str, Enum):
|
class Category(str, Enum):
|
||||||
CONTROL = "control"
|
CONTROL = "control"
|
||||||
|
|||||||
Reference in New Issue
Block a user