-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
3,638 additions
and
2,673 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
from flama.applications import * # noqa | ||
from flama.background import * # noqa | ||
from flama.cli import * # noqa | ||
from flama.endpoints import * # noqa | ||
from flama.injection.components import Component # noqa | ||
from flama.modules import Module # noqa | ||
from flama.routing import * # noqa | ||
from flama.injection.components import * # noqa | ||
from flama.modules import * # noqa | ||
from flama.serialize import * # noqa |
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 was deleted.
Oops, something went wrong.
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,3 @@ | ||
from flama.endpoints.base import * # noqa | ||
from flama.endpoints.http import * # noqa | ||
from flama.endpoints.websocket import * # noqa |
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,32 @@ | ||
import typing as t | ||
|
||
from flama import types | ||
|
||
__all__ = ["BaseEndpoint"] | ||
|
||
|
||
class BaseEndpoint(types.EndpointProtocol): | ||
def __init__(self, scope: "types.Scope", receive: "types.Receive", send: "types.Send") -> None: | ||
"""An endpoint. | ||
:param scope: ASGI scope. | ||
:param receive: ASGI receive function. | ||
:param send: ASGI send function. | ||
""" | ||
app = scope["app"] | ||
scope["path"] = scope.get("root_path", "").rstrip("/") + scope["path"] | ||
scope["root_path"] = "" | ||
route, route_scope = app.router.resolve_route(scope) | ||
self.state = { | ||
"scope": route_scope, | ||
"receive": receive, | ||
"send": send, | ||
"exc": None, | ||
"app": app, | ||
"root_app": scope["root_app"], | ||
"path_params": route_scope.get("path_params", {}), | ||
"route": route, | ||
} | ||
|
||
def __await__(self) -> t.Generator: | ||
return self.dispatch().__await__() |
Oops, something went wrong.