-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Move state to a separate module
Maintaining the application state in a separate module makes it possible to make use (`mpypy`) of type hints for state variables.
- Loading branch information
1 parent
14717a5
commit f0d8e03
Showing
2 changed files
with
86 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from __future__ import annotations | ||
|
||
import time | ||
import typing as t | ||
|
||
import prometheus_client | ||
|
||
if t.TYPE_CHECKING: | ||
import pathlib | ||
|
||
import capellambse | ||
import fastapi.templating | ||
import jinja2 | ||
|
||
import capella_model_explorer.backend.templates | ||
|
||
diff: dict = {} | ||
idle_time_gauge = prometheus_client.Gauge( | ||
"idletime_minutes", | ||
"Time in minutes since the last user interaction", | ||
) | ||
jinja_env: jinja2.Environment | ||
last_interaction = time.time() | ||
model: capellambse.MelodyModel | ||
object_diff: dict = {} | ||
templates: fastapi.templating.Jinja2Templates | ||
templates_loader: capella_model_explorer.backend.templates.TemplateLoader | ||
templates_index: ( | ||
capella_model_explorer.backend.templates.TemplateCategories | None | ||
) | ||
templates_path: pathlib.Path |