Skip to content

Commit dab07d2

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 76cef75 commit dab07d2

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

cloudevents/abstract/event.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ def create(
1919
data: typing.Optional[typing.Any],
2020
) -> "AnyCloudEvent":
2121
"""
22-
Creates a new instance of the CloudEvent using supplied `attributes`
22+
Creates a new instance of the CloudEvent using supplied `attributes`
2323
and `data`.
24-
24+
2525
This method should be preferably used over the constructor to create events
2626
while custom framework-specific implementations may require or assume
2727
different arguments.
28-
28+
2929
:param attributes: The attributes of the CloudEvent instance.
3030
:param data: The payload of the CloudEvent instance.
3131
:returns: A new instance of the CloudEvent created from the passed arguments.
@@ -36,12 +36,12 @@ def create(
3636
def _get_attributes(self) -> typing.Dict[str, typing.Any]:
3737
"""
3838
Returns the attributes of the event.
39-
39+
4040
The implementation MUST assume that the returned value MAY be mutated.
41-
42-
Having a function over a property simplifies integration for custom
41+
42+
Having a function over a property simplifies integration for custom
4343
framework-specific implementations.
44-
44+
4545
:returns: Attributes of the event.
4646
"""
4747
raise NotImplementedError()
@@ -70,10 +70,10 @@ def __eq__(self, other: typing.Any) -> bool:
7070
def __getitem__(self, key: str) -> typing.Any:
7171
"""
7272
Returns a value of an attribute of the event denoted by the given `key`.
73-
73+
7474
The `data` of the event should be accessed by the `.data` accessor rather
7575
than this mapping.
76-
76+
7777
:param key: The name of the event attribute to retrieve the value for.
7878
:returns: The event attribute value.
7979
"""
@@ -84,10 +84,10 @@ def get(
8484
) -> typing.Optional[typing.Any]:
8585
"""
8686
Retrieves an event attribute value for the given `key`.
87-
87+
8888
Returns the `default` value if the attribute for the given key does not exist.
8989
90-
The implementation MUST NOT throw an error when the key does not exist, but
90+
The implementation MUST NOT throw an error when the key does not exist, but
9191
rather should return `None` or the configured `default`.
9292
9393
:param key: The name of the event attribute to retrieve the value for.
@@ -111,7 +111,7 @@ def __len__(self) -> int:
111111

112112
def __contains__(self, key: str) -> bool:
113113
"""
114-
Determines if an attribute with a given `key` is present
114+
Determines if an attribute with a given `key` is present
115115
in the event attributes.
116116
"""
117117
return key in self._get_attributes()

cloudevents/conversion.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def to_json(
2828
) -> typing.Union[str, bytes]:
2929
"""
3030
Converts given `event` to a JSON string.
31-
31+
3232
:param event: A CloudEvent to be converted into a JSON string.
3333
:param data_marshaller: Callable function which will cast `event.data`
3434
into a JSON string.
@@ -44,11 +44,11 @@ def from_json(
4444
) -> AnyCloudEvent:
4545
"""
4646
Parses JSON string `data` into a CloudEvent.
47-
47+
4848
:param data: JSON string representation of a CloudEvent.
4949
:param data_unmarshaller: Callable function that casts `data` to a
5050
Python object.
51-
:param event_type: A concrete type of the event into which the data is
51+
:param event_type: A concrete type of the event into which the data is
5252
deserialized.
5353
:returns: A CloudEvent parsed from the given JSON representation.
5454
"""
@@ -78,7 +78,7 @@ def from_http(
7878
e.g. lambda x: x or lambda x: json.loads(x)
7979
:param event_type: The actual type of CloudEvent to deserialize the event to.
8080
:returns: A CloudEvent instance parsed from the passed HTTP parameters of
81-
the specified type.
81+
the specified type.
8282
"""
8383
if data is None or data == b"":
8484
# Empty string will cause data to be marshalled into None
@@ -179,8 +179,8 @@ def to_structured(
179179
data_marshaller: types.MarshallerType = None,
180180
) -> typing.Tuple[dict, typing.Union[bytes, str]]:
181181
"""
182-
Returns a tuple of HTTP headers/body dicts representing this Cloud Event.
183-
182+
Returns a tuple of HTTP headers/body dicts representing this Cloud Event.
183+
184184
If event.data is a byte object, body will have a `data_base64` field instead of
185185
`data`.
186186

0 commit comments

Comments
 (0)