You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm very curious about this, as a potential contributor, would someone care to provide examples of what's stated in the documentation?
My assumption is this is typing related and not directly related to using CloudEvents in Python. Is that somewhat right?
@abstractmethod
def _get_attributes(self) -> typing.Dict[str, typing.Any]:
"""
Returns the attributes of the event.
The implementation MUST assume that the returned value MAY be mutated.
Having a function over a property simplifies integration for custom
framework-specific implementations.
:returns: Attributes of the event.
"""
raise NotImplementedError()
data is not an attribute but the event payload. The line in the docs is there to help and navigate developers. What kind of example you'd like to see? How to access data from an event?
You can check e.g. test_http_cloudevent_mutates_equality to find examples of how .data is accessed.
The getitem of this class goes on to describe that:
sdk-python/cloudevents/abstract/event.py
Lines 99 to 100 in c5645d8
providing a reason and perhaps a reference to an example would help developers understand why event.get() is discouraged by this helper method.
For instance, there is confusion in how the private _attributes data should be accessed expressed in #246.
The text was updated successfully, but these errors were encountered: