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
from collections.abc import Callable, Collection | |
from typing import ParamSpec, TypeVar | |
R = TypeVar("R") | |
P = ParamSpec("P") | |
def disable( | |
func_or_metrics: Collection[int] | Callable[P, R] | |
) -> Callable[[Callable[P, R]], Callable[P, R]] | Callable[P, R]: |
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
[tool.poetry] | |
name = "app" | |
version = "0.1.0" | |
description = "" | |
authors = ["App Author <[email protected]>"] | |
packages = [{ include = "app", from = "." }] | |
[[tool.poetry.source]] | |
name = "custom-python" |
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
# file: app.py | |
from flask import Flask | |
from redis_instance import create_redis | |
def create_app(script_info: ScriptInfo = None): | |
app = Flask('myapp') | |
with app.app_context(): | |
from flask import g | |
g.redis = create_redis() | |
return app |
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
>>> from flask import Flask | |
>>> from flask import g | |
>>> app=Flask('test') | |
>>> with app.app_context(): | |
... g.e='test' | |
... | |
>>> with app.app_context(): | |
... print(g.e) | |
... | |
Traceback (most recent call last): |