GRAYBYTE WORDPRESS FILE MANAGER2209

Server IP : 198.54.121.189 / Your IP : 216.73.216.140
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /opt/hc_python/lib/python3.12/site-packages/mako/testing/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /opt/hc_python/lib/python3.12/site-packages/mako/testing//helpers.py
import contextlib
import pathlib
from pathlib import Path
import re
import time
from typing import Union
from unittest import mock


def flatten_result(result):
    return re.sub(r"[\s\r\n]+", " ", result).strip()


def result_lines(result):
    return [
        x.strip()
        for x in re.split(r"\r?\n", re.sub(r" +", " ", result))
        if x.strip() != ""
    ]


def result_raw_lines(result):
    return [x for x in re.split(r"\r?\n", result) if x.strip() != ""]


def make_path(
    filespec: Union[Path, str],
    make_absolute: bool = True,
    check_exists: bool = False,
) -> Path:
    path = Path(filespec)
    if make_absolute:
        path = path.resolve(strict=check_exists)
    if check_exists and (not path.exists()):
        raise FileNotFoundError(f"No file or directory at {filespec}")
    return path


def _unlink_path(path, missing_ok=False):
    # Replicate 3.8+ functionality in 3.7
    cm = contextlib.nullcontext()
    if missing_ok:
        cm = contextlib.suppress(FileNotFoundError)

    with cm:
        path.unlink()


def replace_file_with_dir(pathspec):
    path = pathlib.Path(pathspec)
    _unlink_path(path, missing_ok=True)
    path.mkdir(exist_ok=True)
    return path


def file_with_template_code(filespec):
    with open(filespec, "w") as f:
        f.write(
            """
i am an artificial template just for you
"""
        )
    return filespec


@contextlib.contextmanager
def rewind_compile_time(hours=1):
    rewound = time.time() - (hours * 3_600)
    with mock.patch("mako.codegen.time") as codegen_time:
        codegen_time.time.return_value = rewound
        yield

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
April 04 2025 08:00:26
root / root
0755
__pycache__
--
April 04 2025 08:00:26
root / root
0755
__init__.py
0 KB
April 04 2025 08:00:26
root / root
0644
_config.py
3.482 KB
April 04 2025 08:00:26
root / root
0644
assertions.py
5.04 KB
April 04 2025 08:00:26
root / root
0644
config.py
0.315 KB
April 04 2025 08:00:26
root / root
0644
exclusions.py
1.517 KB
April 04 2025 08:00:26
root / root
0644
fixtures.py
2.973 KB
April 04 2025 08:00:26
root / root
0644
helpers.py
1.585 KB
April 04 2025 08:00:26
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF