OXIESEC PANEL
- Current Dir:
/
/
snap
/
core24
/
888
/
usr
/
lib
/
python3
/
dist-packages
/
jinja2
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
03/18/2025 08:12:15 AM
rwxr-xr-x
📄
__init__.py
1.88 KB
04/28/2022 05:20:15 PM
rw-r--r--
📁
__pycache__
-
03/18/2025 08:12:15 AM
rwxr-xr-x
📄
_identifier.py
1.91 KB
03/24/2022 02:16:48 PM
rw-r--r--
📄
async_utils.py
2.41 KB
03/24/2022 02:16:48 PM
rw-r--r--
📄
bccache.py
13.73 KB
04/28/2022 02:08:26 PM
rw-r--r--
📄
compiler.py
70.83 KB
03/10/2025 04:56:35 PM
rw-r--r--
📄
constants.py
1.4 KB
03/11/2022 10:53:03 PM
rw-r--r--
📄
debug.py
6.15 KB
03/24/2022 02:16:48 PM
rw-r--r--
📄
defaults.py
1.24 KB
03/11/2022 10:53:03 PM
rw-r--r--
📄
environment.py
59.91 KB
04/25/2022 07:41:10 PM
rw-r--r--
📄
exceptions.py
4.95 KB
03/11/2022 10:53:03 PM
rw-r--r--
📄
ext.py
30.76 KB
03/24/2022 02:16:48 PM
rw-r--r--
📄
filters.py
53.34 KB
03/10/2025 04:56:35 PM
rw-r--r--
📄
idtracking.py
10.45 KB
03/11/2022 10:53:03 PM
rw-r--r--
📄
lexer.py
29.09 KB
03/10/2025 04:56:35 PM
rw-r--r--
📄
loaders.py
22.66 KB
04/28/2022 04:37:28 PM
rw-r--r--
📄
meta.py
4.29 KB
03/11/2022 10:53:03 PM
rw-r--r--
📄
nativetypes.py
4.13 KB
03/24/2022 02:16:48 PM
rw-r--r--
📄
nodes.py
33.81 KB
03/10/2025 04:56:35 PM
rw-r--r--
📄
optimizer.py
1.61 KB
03/11/2022 10:53:03 PM
rw-r--r--
📄
parser.py
38.67 KB
03/11/2022 10:53:03 PM
rw-r--r--
📄
py.typed
0 bytes
03/11/2022 10:53:03 PM
rw-r--r--
📄
runtime.py
32.69 KB
03/24/2022 02:16:48 PM
rw-r--r--
📄
sandbox.py
14.68 KB
03/10/2025 04:56:35 PM
rw-r--r--
📄
tests.py
5.77 KB
03/11/2022 10:53:03 PM
rw-r--r--
📄
utils.py
23.47 KB
03/10/2025 04:56:35 PM
rw-r--r--
📄
visitor.py
3.48 KB
04/25/2022 07:41:10 PM
rw-r--r--
Editing: async_utils.py
Close
import inspect import typing as t from functools import WRAPPER_ASSIGNMENTS from functools import wraps from .utils import _PassArg from .utils import pass_eval_context V = t.TypeVar("V") def async_variant(normal_func): # type: ignore def decorator(async_func): # type: ignore pass_arg = _PassArg.from_obj(normal_func) need_eval_context = pass_arg is None if pass_arg is _PassArg.environment: def is_async(args: t.Any) -> bool: return t.cast(bool, args[0].is_async) else: def is_async(args: t.Any) -> bool: return t.cast(bool, args[0].environment.is_async) # Take the doc and annotations from the sync function, but the # name from the async function. Pallets-Sphinx-Themes # build_function_directive expects __wrapped__ to point to the # sync function. async_func_attrs = ("__module__", "__name__", "__qualname__") normal_func_attrs = tuple(set(WRAPPER_ASSIGNMENTS).difference(async_func_attrs)) @wraps(normal_func, assigned=normal_func_attrs) @wraps(async_func, assigned=async_func_attrs, updated=()) def wrapper(*args, **kwargs): # type: ignore b = is_async(args) if need_eval_context: args = args[1:] if b: return async_func(*args, **kwargs) return normal_func(*args, **kwargs) if need_eval_context: wrapper = pass_eval_context(wrapper) wrapper.jinja_async_variant = True return wrapper return decorator _common_primitives = {int, float, bool, str, list, dict, tuple, type(None)} async def auto_await(value: t.Union[t.Awaitable["V"], "V"]) -> "V": # Avoid a costly call to isawaitable if type(value) in _common_primitives: return t.cast("V", value) if inspect.isawaitable(value): return await t.cast("t.Awaitable[V]", value) return t.cast("V", value) async def auto_aiter( iterable: "t.Union[t.AsyncIterable[V], t.Iterable[V]]", ) -> "t.AsyncIterator[V]": if hasattr(iterable, "__aiter__"): async for item in t.cast("t.AsyncIterable[V]", iterable): yield item else: for item in t.cast("t.Iterable[V]", iterable): yield item async def auto_to_list( value: "t.Union[t.AsyncIterable[V], t.Iterable[V]]", ) -> t.List["V"]: return [x async for x in auto_aiter(value)]