-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: initial typing of the public API (#248)
* Initial typing of the public API This adds type annotations for the 2 main decorators of the library. Closes: #190 * fix typing * Remove zip_safe flag, as it's not needed anymore. * run black * fix import order --------- Co-authored-by: Gareth <garethgeorge@google.com>
- Loading branch information
1 parent
049e031
commit 45aed53
Showing
6 changed files
with
30 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import typing | ||
|
||
if typing.TYPE_CHECKING: # pragma: no cover | ||
import flask | ||
|
||
from cloudevents.http.event import CloudEvent | ||
|
||
import functions_framework | ||
|
||
@functions_framework.http | ||
def hello(request: flask.Request) -> flask.typing.ResponseReturnValue: | ||
return "Hello world!" | ||
|
||
@functions_framework.cloud_event | ||
def hello_cloud_event(cloud_event: CloudEvent) -> None: | ||
print(f"Received event: id={cloud_event['id']} and data={cloud_event.data}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters