Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The CollectedEvent.data type is now Mapping instead of Dict #30

Merged
merged 2 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -108,4 +106,4 @@ repos:
- types-attrs
- types-setuptools
- pydantic
# <---- Code Analysis --------------------------------------------------------------------------
# <---- Code Formatting and Analysis -----------------------------------------------------------
1 change: 1 addition & 0 deletions changelog/30.improvement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The `CollectedEvent.data` type is now `Mapping` instead of `Dict`. This allows to use `TypedDict`'s for that attribute.
1 change: 1 addition & 0 deletions changelog/30.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix `.pre-commit-config.yaml` headers
3 changes: 2 additions & 1 deletion src/saf/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)


Expand Down