REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 1.58 KB
Close
/opt/hc_python/lib/python3.12/site-packages/mako/testing/helpers.py
Text
Base64
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
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 7
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
__pycache__
DIR
-
drwxr-xr-x
2025-04-04 08:02:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
assertions.py
5.04 KB
lrw-r--r--
2025-04-04 08:02:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
config.py
323 B
lrw-r--r--
2025-04-04 08:02:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
exclusions.py
1.52 KB
lrw-r--r--
2025-04-04 08:02:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
fixtures.py
2.97 KB
lrw-r--r--
2025-04-04 08:02:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
helpers.py
1.58 KB
lrw-r--r--
2025-04-04 08:02:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
_config.py
3.48 KB
lrw-r--r--
2025-04-04 08:02:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__init__.py
0 B
lrw-r--r--
2025-04-04 08:02:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).