faust-streaming 0.12.0__cp312-cp312-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- examples/fastapi/__init__.py +0 -0
- examples/fastapi/api/__init__.py +7 -0
- examples/fastapi/api/my_api.py +16 -0
- examples/fastapi/main.py +42 -0
- examples/fastapi/my_faust/__init__.py +0 -0
- examples/fastapi/my_faust/agent/__init__.py +0 -0
- examples/fastapi/my_faust/agent/my_agent.py +10 -0
- examples/fastapi/my_faust/app.py +18 -0
- examples/fastapi/my_faust/table/__init__.py +0 -0
- examples/fastapi/my_faust/table/my_table.py +8 -0
- examples/fastapi/my_faust/timer/__init__.py +6 -0
- examples/fastapi/my_faust/timer/my_timer.py +14 -0
- examples/fastapi/my_faust/topic/__init__.py +0 -0
- examples/fastapi/my_faust/topic/my_topic.py +3 -0
- faust/__init__.py +304 -0
- faust/__main__.py +6 -0
- faust/_cython/__init__.py +1 -0
- faust/_cython/streams.c +19249 -0
- faust/_cython/streams.cp312-win_amd64.pyd +0 -0
- faust/_cython/streams.pyx +198 -0
- faust/_cython/windows.c +14896 -0
- faust/_cython/windows.cp312-win_amd64.pyd +0 -0
- faust/_cython/windows.pyx +109 -0
- faust/agents/__init__.py +16 -0
- faust/agents/actor.py +93 -0
- faust/agents/agent.py +1198 -0
- faust/agents/manager.py +131 -0
- faust/agents/models.py +44 -0
- faust/agents/replies.py +196 -0
- faust/app/__init__.py +5 -0
- faust/app/_attached.py +221 -0
- faust/app/base.py +2128 -0
- faust/app/router.py +122 -0
- faust/assignor/__init__.py +4 -0
- faust/assignor/client_assignment.py +158 -0
- faust/assignor/cluster_assignment.py +56 -0
- faust/assignor/copartitioned_assignor.py +266 -0
- faust/assignor/leader_assignor.py +50 -0
- faust/assignor/partition_assignor.py +466 -0
- faust/auth.py +142 -0
- faust/channels.py +707 -0
- faust/cli/__init__.py +5 -0
- faust/cli/agents.py +62 -0
- faust/cli/base.py +1020 -0
- faust/cli/clean_versions.py +27 -0
- faust/cli/completion.py +37 -0
- faust/cli/faust.py +29 -0
- faust/cli/livecheck.py +20 -0
- faust/cli/model.py +92 -0
- faust/cli/models.py +55 -0
- faust/cli/params.py +81 -0
- faust/cli/reset.py +34 -0
- faust/cli/send.py +89 -0
- faust/cli/tables.py +24 -0
- faust/cli/worker.py +189 -0
- faust/contrib/__init__.py +0 -0
- faust/contrib/sentry.py +146 -0
- faust/events.py +281 -0
- faust/exceptions.py +110 -0
- faust/fixups/__init__.py +31 -0
- faust/fixups/base.py +30 -0
- faust/fixups/django.py +102 -0
- faust/joins.py +51 -0
- faust/livecheck/__init__.py +9 -0
- faust/livecheck/app.py +404 -0
- faust/livecheck/case.py +466 -0
- faust/livecheck/exceptions.py +52 -0
- faust/livecheck/locals.py +38 -0
- faust/livecheck/models.py +142 -0
- faust/livecheck/patches/__init__.py +10 -0
- faust/livecheck/patches/aiohttp.py +82 -0
- faust/livecheck/runners.py +239 -0
- faust/livecheck/signals.py +181 -0
- faust/models/__init__.py +15 -0
- faust/models/base.py +492 -0
- faust/models/fields.py +599 -0
- faust/models/record.py +646 -0
- faust/models/tags.py +203 -0
- faust/models/typing.py +733 -0
- faust/py.typed +1 -0
- faust/sensors/__init__.py +11 -0
- faust/sensors/base.py +328 -0
- faust/sensors/datadog.py +381 -0
- faust/sensors/distributed_tracing.py +164 -0
- faust/sensors/monitor.py +673 -0
- faust/sensors/prometheus.py +533 -0
- faust/sensors/statsd.py +256 -0
- faust/serializers/__init__.py +7 -0
- faust/serializers/codecs.py +365 -0
- faust/serializers/registry.py +189 -0
- faust/serializers/schemas.py +203 -0
- faust/stores/__init__.py +18 -0
- faust/stores/aerospike.py +303 -0
- faust/stores/base.py +249 -0
- faust/stores/memory.py +105 -0
- faust/stores/rocksdb.py +771 -0
- faust/streams.py +1309 -0
- faust/tables/__init__.py +17 -0
- faust/tables/base.py +678 -0
- faust/tables/globaltable.py +13 -0
- faust/tables/manager.py +211 -0
- faust/tables/objects.py +181 -0
- faust/tables/recovery.py +1077 -0
- faust/tables/sets.py +316 -0
- faust/tables/table.py +103 -0
- faust/tables/wrappers.py +536 -0
- faust/topics.py +532 -0
- faust/transport/__init__.py +5 -0
- faust/transport/_cython/__init__.py +1 -0
- faust/transport/_cython/conductor.c +17388 -0
- faust/transport/_cython/conductor.cp312-win_amd64.pyd +0 -0
- faust/transport/_cython/conductor.pyx +134 -0
- faust/transport/base.py +88 -0
- faust/transport/conductor.py +478 -0
- faust/transport/consumer.py +1465 -0
- faust/transport/drivers/__init__.py +18 -0
- faust/transport/drivers/aiokafka.py +1663 -0
- faust/transport/drivers/confluent.py +695 -0
- faust/transport/producer.py +245 -0
- faust/transport/utils.py +117 -0
- faust/types/__init__.py +100 -0
- faust/types/_env.py +53 -0
- faust/types/agents.py +335 -0
- faust/types/app.py +541 -0
- faust/types/assignor.py +67 -0
- faust/types/auth.py +53 -0
- faust/types/channels.py +195 -0
- faust/types/codecs.py +33 -0
- faust/types/core.py +81 -0
- faust/types/enums.py +6 -0
- faust/types/events.py +87 -0
- faust/types/fixups.py +28 -0
- faust/types/joins.py +21 -0
- faust/types/models.py +266 -0
- faust/types/router.py +51 -0
- faust/types/sensors.py +132 -0
- faust/types/serializers.py +143 -0
- faust/types/settings/__init__.py +4 -0
- faust/types/settings/base.py +189 -0
- faust/types/settings/params.py +738 -0
- faust/types/settings/sections.py +169 -0
- faust/types/settings/settings.py +2512 -0
- faust/types/stores.py +104 -0
- faust/types/streams.py +211 -0
- faust/types/tables.py +438 -0
- faust/types/topics.py +125 -0
- faust/types/transports.py +475 -0
- faust/types/tuples.py +254 -0
- faust/types/web.py +172 -0
- faust/types/windows.py +40 -0
- faust/utils/__init__.py +13 -0
- faust/utils/_iso8601_python.py +90 -0
- faust/utils/agent_stopper.py +18 -0
- faust/utils/codegen.py +263 -0
- faust/utils/cron.py +18 -0
- faust/utils/functional.py +53 -0
- faust/utils/iso8601.py +10 -0
- faust/utils/json.py +204 -0
- faust/utils/platforms.py +32 -0
- faust/utils/terminal/__init__.py +16 -0
- faust/utils/terminal/spinners.py +142 -0
- faust/utils/terminal/tables.py +102 -0
- faust/utils/tracing.py +152 -0
- faust/utils/urls.py +76 -0
- faust/utils/venusian.py +30 -0
- faust/web/__init__.py +18 -0
- faust/web/apps/__init__.py +1 -0
- faust/web/apps/graph.py +33 -0
- faust/web/apps/production_index.py +21 -0
- faust/web/apps/router.py +97 -0
- faust/web/apps/stats.py +61 -0
- faust/web/apps/tables.py +118 -0
- faust/web/base.py +429 -0
- faust/web/blueprints.py +205 -0
- faust/web/cache/__init__.py +5 -0
- faust/web/cache/backends/__init__.py +18 -0
- faust/web/cache/backends/base.py +90 -0
- faust/web/cache/backends/memory.py +101 -0
- faust/web/cache/backends/redis.py +190 -0
- faust/web/cache/cache.py +168 -0
- faust/web/cache/exceptions.py +7 -0
- faust/web/drivers/__init__.py +16 -0
- faust/web/drivers/aiohttp.py +325 -0
- faust/web/exceptions.py +133 -0
- faust/web/views.py +344 -0
- faust/windows.py +168 -0
- faust/worker.py +391 -0
- faust_streaming-0.12.0.dist-info/METADATA +656 -0
- faust_streaming-0.12.0.dist-info/RECORD +196 -0
- faust_streaming-0.12.0.dist-info/WHEEL +5 -0
- faust_streaming-0.12.0.dist-info/entry_points.txt +2 -0
- faust_streaming-0.12.0.dist-info/licenses/AUTHORS.md +59 -0
- faust_streaming-0.12.0.dist-info/licenses/LICENSE +53 -0
- faust_streaming-0.12.0.dist-info/scm_file_list.json +721 -0
- faust_streaming-0.12.0.dist-info/scm_version.json +8 -0
- faust_streaming-0.12.0.dist-info/top_level.txt +2 -0
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from typing import Union
|
|
2
|
+
from fastapi import APIRouter
|
|
3
|
+
|
|
4
|
+
from my_faust.table.my_table import greetings_table
|
|
5
|
+
|
|
6
|
+
router = APIRouter()
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@router.get("/items/{item_id}")
|
|
10
|
+
def read_item(item_id: int, q: Union[str, None] = None):
|
|
11
|
+
return {"item_id": item_id, "q": q}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@router.get("/table")
|
|
15
|
+
def read_table():
|
|
16
|
+
return [{k: v} for k, v in greetings_table.items()]
|
examples/fastapi/main.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from contextlib import asynccontextmanager
|
|
2
|
+
from fastapi import FastAPI
|
|
3
|
+
from api import router as api_router
|
|
4
|
+
|
|
5
|
+
from my_faust.timer import router as timer_router
|
|
6
|
+
from my_faust.app import faust_app
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# This is just hello_world.py integrated with a FastAPI application
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def fake_answer_to_everything_ml_model(x: float):
|
|
13
|
+
return x * 42
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
ml_models = {}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@asynccontextmanager
|
|
20
|
+
async def lifespan(app: FastAPI):
|
|
21
|
+
faust_app.discover()
|
|
22
|
+
await faust_app.start()
|
|
23
|
+
yield
|
|
24
|
+
await faust_app.stop()
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# You MUST have "app" defined in order for Faust to discover the app
|
|
28
|
+
# if you're using "faust" on CLI, but this doesn't work yet
|
|
29
|
+
app = fastapi_app = FastAPI(
|
|
30
|
+
lifespan=lifespan,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
# For now, run via "uvicorn fastapi_example:app"
|
|
34
|
+
# then visit http://127.0.0.1:8000/docs
|
|
35
|
+
|
|
36
|
+
app.include_router(router=api_router)
|
|
37
|
+
app.include_router(router=timer_router)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@app.get("/")
|
|
41
|
+
def read_root():
|
|
42
|
+
return {"Hello": "World"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from my_faust.app import faust_app
|
|
2
|
+
from my_faust.table.my_table import greetings_table
|
|
3
|
+
from my_faust.topic.my_topic import greetings_topic
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@faust_app.agent(greetings_topic)
|
|
7
|
+
async def print_greetings(greetings):
|
|
8
|
+
async for greeting in greetings:
|
|
9
|
+
print(f"greeting: {greeting}")
|
|
10
|
+
greetings_table[greeting] = {"hello world"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import faust
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def get_all_packages_to_scan():
|
|
5
|
+
return ["my_faust"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# You MUST have "app" defined in order for Faust to discover the app
|
|
9
|
+
# if you're using "faust" on CLI, but this doesn't work yet
|
|
10
|
+
# autodiscover https://faust-streaming.github.io/faust/userguide/settings.html#autodiscover
|
|
11
|
+
app = faust_app = faust.App(
|
|
12
|
+
'hello-world-fastapi',
|
|
13
|
+
broker='kafka://localhost:9092',
|
|
14
|
+
web_enabled=False,
|
|
15
|
+
autodiscover=get_all_packages_to_scan,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
# For now, run via "faust -A my_faust.app worker -l info"
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from uuid import uuid4
|
|
2
|
+
from fastapi import APIRouter
|
|
3
|
+
|
|
4
|
+
from my_faust.app import faust_app
|
|
5
|
+
from my_faust.topic.my_topic import greetings_topic
|
|
6
|
+
|
|
7
|
+
router = APIRouter()
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@faust_app.timer(5) # make sure you *always* add the timer above if you're using one
|
|
11
|
+
@router.get("/produce")
|
|
12
|
+
async def produce():
|
|
13
|
+
await greetings_topic.send(value=uuid4().hex)
|
|
14
|
+
return {"success": True}
|
|
File without changes
|
faust/__init__.py
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""Python Stream processing."""
|
|
3
|
+
|
|
4
|
+
# :copyright: (c) 2017-2020, Robinhood Markets, Inc.
|
|
5
|
+
# All rights reserved.
|
|
6
|
+
# :license: BSD (3 Clause), see LICENSE for more details.
|
|
7
|
+
|
|
8
|
+
# -- Faust is a Python stream processing library
|
|
9
|
+
# mainly used with Kafka, but is generic enough to be used for general
|
|
10
|
+
# agent and channel based programming.
|
|
11
|
+
|
|
12
|
+
# If you are here to read the code, we suggest you start with:
|
|
13
|
+
#
|
|
14
|
+
# faust/app.py - Faust Application
|
|
15
|
+
# faust/channels.py - Channels for communication.
|
|
16
|
+
# faust/topics.py - A topic is a named channel (e.g. a Kafka topic)
|
|
17
|
+
# faust/streams.py - The stream iterates over events in a channel.
|
|
18
|
+
# faust/tables.py - Data is stored in tables.
|
|
19
|
+
# faust/agents.py - Agents use all of the above.
|
|
20
|
+
# --- ~~~~~ ~ ~ ~ ~ ~ ~ ~
|
|
21
|
+
import os
|
|
22
|
+
import re
|
|
23
|
+
import sys
|
|
24
|
+
import typing
|
|
25
|
+
|
|
26
|
+
if sys.version_info < (3, 8):
|
|
27
|
+
from importlib_metadata import version
|
|
28
|
+
else:
|
|
29
|
+
from importlib.metadata import version
|
|
30
|
+
|
|
31
|
+
from typing import Any, Mapping, NamedTuple, Optional, Sequence, Tuple
|
|
32
|
+
|
|
33
|
+
__version__ = version("faust-streaming")
|
|
34
|
+
__author__ = "Robinhood Markets, Inc."
|
|
35
|
+
__contact__ = "schrohm@gmail.com, vpatki@wayfair.com, williambbarnhart@gmail.com"
|
|
36
|
+
__homepage__ = "https://github.com/faust-streaming/faust"
|
|
37
|
+
__docformat__ = "markdown"
|
|
38
|
+
|
|
39
|
+
# -eof meta-
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class VersionInfo(NamedTuple):
|
|
43
|
+
major: int
|
|
44
|
+
minor: int
|
|
45
|
+
micro: int
|
|
46
|
+
releaselevel: Optional[str] = None
|
|
47
|
+
serial: Optional[str] = None
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
version_info_t = VersionInfo # XXX compat
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# bumpversion can only search for {current_version}
|
|
54
|
+
# so we have to parse the version here.
|
|
55
|
+
_match = re.match(r"^(?P<prefix>v)?(?P<version>[^\+]+)(?P<suffix>.*)?$", __version__)
|
|
56
|
+
if _match is None: # pragma: no cover
|
|
57
|
+
raise RuntimeError("THIS IS A BROKEN RELEASE!")
|
|
58
|
+
_temp = _match.groups()
|
|
59
|
+
VERSION = version_info = VersionInfo(*_temp)
|
|
60
|
+
del _match
|
|
61
|
+
del _temp
|
|
62
|
+
del re
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# This is here to support setting the --datadir argument
|
|
66
|
+
# when executing a faust application module directly:
|
|
67
|
+
# $ python examples/word_count.py
|
|
68
|
+
#
|
|
69
|
+
# When using the ``faust`` command, the entry point is controlled by
|
|
70
|
+
# .cli.base.cli. It sets the F_DATADIR environment variable before the
|
|
71
|
+
# app is imported, which means that when the faust.app module is imported
|
|
72
|
+
# the App will have the correct default paths.
|
|
73
|
+
#
|
|
74
|
+
# However, when examples/word_count.py is executed the app is instantiated
|
|
75
|
+
# before the CLI, so we have to use this hack to to set the
|
|
76
|
+
# environment variable as early as possible.
|
|
77
|
+
#
|
|
78
|
+
# A side effect is that anything importing faust
|
|
79
|
+
# that also happens to have a '-D' argument in sys.argv will have the
|
|
80
|
+
# F_DATADIR environment variable set. I think that's ok. [ask]
|
|
81
|
+
def _extract_arg_from_argv( # pragma: no cover
|
|
82
|
+
argv: Sequence[str] = sys.argv,
|
|
83
|
+
*,
|
|
84
|
+
shortopts: Tuple[str, ...] = (),
|
|
85
|
+
longopts: Tuple[str, ...] = ("--datadir",),
|
|
86
|
+
) -> Optional[str]:
|
|
87
|
+
for i, arg in enumerate(argv): # pragma: no cover
|
|
88
|
+
if arg in shortopts:
|
|
89
|
+
try:
|
|
90
|
+
value = argv[i + 1]
|
|
91
|
+
except IndexError:
|
|
92
|
+
import click
|
|
93
|
+
|
|
94
|
+
raise click.UsageError(f"Missing value for {arg} option")
|
|
95
|
+
return value
|
|
96
|
+
if arg.startswith(longopts): # pragma: no cover
|
|
97
|
+
key, _, value = arg.partition("=")
|
|
98
|
+
if not value:
|
|
99
|
+
try:
|
|
100
|
+
value = argv[i + 1]
|
|
101
|
+
except IndexError:
|
|
102
|
+
import click
|
|
103
|
+
|
|
104
|
+
raise click.UsageError(
|
|
105
|
+
f"Missing {key}! Did you mean --{key}=value?"
|
|
106
|
+
)
|
|
107
|
+
return value
|
|
108
|
+
return None
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
_datadir = (
|
|
112
|
+
_extract_arg_from_argv(longopts=("--datadir",))
|
|
113
|
+
or os.environ.get("FAUST_DATADIR")
|
|
114
|
+
or os.environ.get("F_DATADIR")
|
|
115
|
+
)
|
|
116
|
+
if _datadir: # pragma: no cover
|
|
117
|
+
os.environ["FAUST_DATADIR"] = _datadir
|
|
118
|
+
_loop = (
|
|
119
|
+
_extract_arg_from_argv(shortopts=("-L",), longopts=("--loop",))
|
|
120
|
+
or os.environ.get("FAUST_LOOP")
|
|
121
|
+
or os.environ.get("F_LOOP")
|
|
122
|
+
)
|
|
123
|
+
if _loop: # pragma: no cover
|
|
124
|
+
os.environ["FAUST_LOOP"] = _loop
|
|
125
|
+
import mode.loop
|
|
126
|
+
|
|
127
|
+
mode.loop.use(_loop)
|
|
128
|
+
|
|
129
|
+
# To ensure `import faust` executes quickly, this module imports
|
|
130
|
+
# attributes lazily. The next section provides static type checkers
|
|
131
|
+
# with information about the contents of this module.
|
|
132
|
+
if typing.TYPE_CHECKING: # pragma: no cover
|
|
133
|
+
from mode import Service, ServiceT # noqa: E402
|
|
134
|
+
|
|
135
|
+
from .agents import Agent # noqa: E402
|
|
136
|
+
from .app import App # noqa: E402
|
|
137
|
+
from .auth import ( # noqa: E402
|
|
138
|
+
GSSAPICredentials,
|
|
139
|
+
OAuthCredentials,
|
|
140
|
+
SASLCredentials,
|
|
141
|
+
SSLCredentials,
|
|
142
|
+
)
|
|
143
|
+
from .channels import Channel, ChannelT # noqa: E402
|
|
144
|
+
from .events import Event, EventT # noqa: E402
|
|
145
|
+
from .models import Model, ModelOptions, Record # noqa: E402
|
|
146
|
+
from .sensors import Monitor, Sensor # noqa: E402
|
|
147
|
+
from .serializers import Codec, Schema # noqa: E402
|
|
148
|
+
from .streams import Stream, StreamT, current_event # noqa: E402
|
|
149
|
+
from .tables.globaltable import GlobalTable # noqa: E402
|
|
150
|
+
from .tables.sets import SetGlobalTable, SetTable # noqa: E402
|
|
151
|
+
from .tables.table import Table # noqa: E402
|
|
152
|
+
from .topics import Topic, TopicT # noqa: E402
|
|
153
|
+
from .types.settings import Settings # noqa: E402
|
|
154
|
+
from .utils import uuid
|
|
155
|
+
from .windows import ( # noqa: E402
|
|
156
|
+
HoppingWindow,
|
|
157
|
+
SlidingWindow,
|
|
158
|
+
TumblingWindow,
|
|
159
|
+
Window,
|
|
160
|
+
)
|
|
161
|
+
from .worker import Worker # noqa: E402
|
|
162
|
+
|
|
163
|
+
__all__ = [
|
|
164
|
+
"Agent",
|
|
165
|
+
"App",
|
|
166
|
+
"AppCommand",
|
|
167
|
+
"Command",
|
|
168
|
+
"Channel",
|
|
169
|
+
"ChannelT",
|
|
170
|
+
"Event",
|
|
171
|
+
"EventT",
|
|
172
|
+
"Model",
|
|
173
|
+
"ModelOptions",
|
|
174
|
+
"Record",
|
|
175
|
+
"Monitor",
|
|
176
|
+
"Schema",
|
|
177
|
+
"Sensor",
|
|
178
|
+
"SetTable",
|
|
179
|
+
"SetGlobalTable",
|
|
180
|
+
"Codec",
|
|
181
|
+
"Schema",
|
|
182
|
+
"Service",
|
|
183
|
+
"ServiceT",
|
|
184
|
+
"Stream",
|
|
185
|
+
"StreamT",
|
|
186
|
+
"current_event",
|
|
187
|
+
"Table",
|
|
188
|
+
"GlobalTable",
|
|
189
|
+
"Topic",
|
|
190
|
+
"TopicT",
|
|
191
|
+
"GSSAPICredentials",
|
|
192
|
+
"SASLCredentials",
|
|
193
|
+
"OAuthCredentials",
|
|
194
|
+
"SSLCredentials",
|
|
195
|
+
"Settings",
|
|
196
|
+
"HoppingWindow",
|
|
197
|
+
"TumblingWindow",
|
|
198
|
+
"SlidingWindow",
|
|
199
|
+
"Window",
|
|
200
|
+
"Worker",
|
|
201
|
+
"uuid",
|
|
202
|
+
]
|
|
203
|
+
|
|
204
|
+
# Lazy loading.
|
|
205
|
+
# - See werkzeug/__init__.py for the rationale behind this.
|
|
206
|
+
from types import ModuleType # noqa
|
|
207
|
+
|
|
208
|
+
all_by_module: Mapping[str, Sequence[str]] = {
|
|
209
|
+
"faust.agents": ["Agent"],
|
|
210
|
+
"faust.app": ["App"],
|
|
211
|
+
"faust.channels": ["Channel", "ChannelT"],
|
|
212
|
+
"faust.events": ["Event", "EventT"],
|
|
213
|
+
"faust.models": ["ModelOptions", "Record"],
|
|
214
|
+
"faust.sensors": ["Monitor", "Sensor"],
|
|
215
|
+
"faust.serializers": ["Codec", "Schema"],
|
|
216
|
+
"faust.streams": [
|
|
217
|
+
"Stream",
|
|
218
|
+
"StreamT",
|
|
219
|
+
"current_event",
|
|
220
|
+
],
|
|
221
|
+
"faust.tables.globaltable": ["GlobalTable"],
|
|
222
|
+
"faust.tables.sets": ["SetTable", "SetGlobalTable"],
|
|
223
|
+
"faust.tables.table": ["Table"],
|
|
224
|
+
"faust.topics": ["Topic", "TopicT"],
|
|
225
|
+
"faust.auth": [
|
|
226
|
+
"GSSAPICredentials",
|
|
227
|
+
"SASLCredentials",
|
|
228
|
+
"SSLCredentials",
|
|
229
|
+
"OAuthCredentials",
|
|
230
|
+
],
|
|
231
|
+
"faust.types.settings": ["Settings"],
|
|
232
|
+
"faust.windows": [
|
|
233
|
+
"HoppingWindow",
|
|
234
|
+
"TumblingWindow",
|
|
235
|
+
"SlidingWindow",
|
|
236
|
+
"Window",
|
|
237
|
+
],
|
|
238
|
+
"faust.worker": ["Worker"],
|
|
239
|
+
"faust.utils": ["uuid"],
|
|
240
|
+
"mode.services": ["Service", "ServiceT"],
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
object_origins = {}
|
|
244
|
+
for module, items in all_by_module.items():
|
|
245
|
+
for item in items:
|
|
246
|
+
object_origins[item] = module
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
class _module(ModuleType):
|
|
250
|
+
"""Customized Python module."""
|
|
251
|
+
|
|
252
|
+
standard_package_vars = [
|
|
253
|
+
"__file__",
|
|
254
|
+
"__path__",
|
|
255
|
+
"__doc__",
|
|
256
|
+
"__all__",
|
|
257
|
+
"__docformat__",
|
|
258
|
+
"__name__",
|
|
259
|
+
"__path__",
|
|
260
|
+
"VERSION",
|
|
261
|
+
"VersionInfo",
|
|
262
|
+
"version_info",
|
|
263
|
+
"__package__",
|
|
264
|
+
"__version__",
|
|
265
|
+
"__author__",
|
|
266
|
+
"__contact__",
|
|
267
|
+
"__homepage__",
|
|
268
|
+
"__docformat__",
|
|
269
|
+
]
|
|
270
|
+
|
|
271
|
+
def __getattr__(self, name: str) -> Any:
|
|
272
|
+
if name in object_origins:
|
|
273
|
+
module = __import__(object_origins[name], None, None, [name])
|
|
274
|
+
for extra_name in all_by_module[module.__name__]:
|
|
275
|
+
setattr(self, extra_name, getattr(module, extra_name))
|
|
276
|
+
return getattr(module, name)
|
|
277
|
+
return ModuleType.__getattribute__(self, name)
|
|
278
|
+
|
|
279
|
+
def __dir__(self) -> Sequence[str]:
|
|
280
|
+
return sorted(list(new_module.__all__) + self.standard_package_vars)
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
# keep a reference to this module so that it's not garbage collected
|
|
284
|
+
old_module = sys.modules[__name__]
|
|
285
|
+
|
|
286
|
+
new_module = sys.modules[__name__] = _module(__name__)
|
|
287
|
+
new_module.__dict__.update(
|
|
288
|
+
{
|
|
289
|
+
"__file__": __file__,
|
|
290
|
+
"__path__": __path__, # type: ignore
|
|
291
|
+
"__doc__": __doc__,
|
|
292
|
+
"__all__": tuple(object_origins),
|
|
293
|
+
"__version__": __version__,
|
|
294
|
+
"__author__": __author__,
|
|
295
|
+
"__contact__": __contact__,
|
|
296
|
+
"__homepage__": __homepage__,
|
|
297
|
+
"__docformat__": __docformat__,
|
|
298
|
+
"__package__": __package__,
|
|
299
|
+
"VersionInfo": VersionInfo,
|
|
300
|
+
"version_info_t": version_info_t,
|
|
301
|
+
"version_info": version_info,
|
|
302
|
+
"VERSION": VERSION,
|
|
303
|
+
}
|
|
304
|
+
)
|
faust/__main__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Cython optimized Faust features."""
|