From b71007519d9bf32b643bb027d190bac491baea8c Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 15 May 2023 13:12:13 +0100 Subject: [PATCH 1/2] Fix headers Signed-off-by: Pedro Algarvio --- .pre-commit-config.yaml | 6 ++---- changelog/30.trivial.rst | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 changelog/30.trivial.rst diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f36b9bd..ca7019d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -70,7 +70,7 @@ repos: - jinja2==3.1.2 - packaging==23.0 - # ----- Formatting ----------------------------------------------------------------------------> + # ----- Code Formatting and Analysis ----------------------------------------------------------> - repo: https://github.com/charliermarsh/ruff-pre-commit rev: "v0.0.265" hooks: @@ -94,9 +94,7 @@ repos: files: ^(docs/.*\.rst|src/saf/.*\.py)$ additional_dependencies: - black==23.3.0 - # <---- Formatting ----------------------------------------------------------------------------- - # ----- Code Analysis -------------------------------------------------------------------------> - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.2.0 hooks: @@ -108,4 +106,4 @@ repos: - types-attrs - types-setuptools - pydantic - # <---- Code Analysis -------------------------------------------------------------------------- + # <---- Code Formatting and Analysis ----------------------------------------------------------- diff --git a/changelog/30.trivial.rst b/changelog/30.trivial.rst new file mode 100644 index 0000000..765a08d --- /dev/null +++ b/changelog/30.trivial.rst @@ -0,0 +1 @@ +Fix `.pre-commit-config.yaml` headers From e46d9e3174dd11f6d0d87147e882863aa3ee81f7 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 15 May 2023 13:12:41 +0100 Subject: [PATCH 2/2] The `CollectedEvent.data` type is now `Mapping` instead of `Dict` This allows to use `TypedDict`'s for that attribute. Signed-off-by: Pedro Algarvio --- changelog/30.improvement.rst | 1 + src/saf/models.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelog/30.improvement.rst diff --git a/changelog/30.improvement.rst b/changelog/30.improvement.rst new file mode 100644 index 0000000..fb74494 --- /dev/null +++ b/changelog/30.improvement.rst @@ -0,0 +1 @@ +The `CollectedEvent.data` type is now `Mapping` instead of `Dict`. This allows to use `TypedDict`'s for that attribute. diff --git a/src/saf/models.py b/src/saf/models.py index b98dc43..41a7bf7 100644 --- a/src/saf/models.py +++ b/src/saf/models.py @@ -13,6 +13,7 @@ from typing import Dict from typing import Generic from typing import List +from typing import Mapping from typing import Optional from typing import Type from typing import TypeVar @@ -299,7 +300,7 @@ class CollectedEvent(BaseModel): Class representing each of the collected events. """ - data: Dict[str, Any] + data: Mapping[str, Any] timestamp: Optional[datetime] = Field(default_factory=dt.utcnow)