Skip to content

Commit 47873fb

Browse files
author
Evan Anderson
committed
Adding type info to Converter interface.
Signed-off-by: Evan Anderson <argent@google.com>
1 parent d90a486 commit 47873fb

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

cloudevents/sdk/converters/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ def read(self, event, headers: dict, body: typing.IO,
2525
data_unmarshaller: typing.Callable) -> base.BaseEvent:
2626
raise Exception("not implemented")
2727

28-
def event_supported(self, event):
28+
def event_supported(self, event: object) -> bool:
2929
raise Exception("not implemented")
3030

31-
def can_read(self, content_type):
31+
def can_read(self, content_type: str) -> bool:
3232
raise Exception("not implemented")
3333

3434
def write(self, event: base.BaseEvent,

cloudevents/sdk/converters/binary.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ class BinaryHTTPCloudEventConverter(base.Converter):
2525
TYPE = "binary"
2626
SUPPORTED_VERSIONS = [v02.Event, ]
2727

28-
def can_read(self, content_type):
28+
def can_read(self, content_type: str) -> bool:
2929
return True
3030

31-
def event_supported(self, event):
31+
def event_supported(self, event: object) -> bool:
3232
return type(event) in self.SUPPORTED_VERSIONS
3333

3434
def read(self,

cloudevents/sdk/converters/structured.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class JSONHTTPCloudEventConverter(base.Converter):
2323
TYPE = "structured"
2424
MIME_TYPE = "application/cloudevents+json"
2525

26-
def can_read(self, content_type):
26+
def can_read(self, content_type: str) -> bool:
2727
return content_type and content_type.startswith(self.MIME_TYPE)
2828

29-
def event_supported(self, event):
29+
def event_supported(self, event: object) -> bool:
3030
# structured format supported by both spec 0.1 and 0.2
3131
return True
3232

0 commit comments

Comments
 (0)