Passed
Push — main ( bc64e0...ce7d48 )
by Eran
01:35
created

graphinate.server.web   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 2
1
import inspect
2
import pathlib
3
from collections.abc import Mapping
4
5
6
def current_file() -> pathlib.Path | None:
7
    """Returns current file name"""
8
    if current_frame := inspect.currentframe():
9
        return pathlib.Path(inspect.getfile(current_frame.f_back))
10
    return None
11
12
13
paths_mapping: Mapping[str, pathlib.Path] = {p.name: p for p in current_file().parent.iterdir() if p.is_dir()}
14
15
16
def get_static_path(relative_path: str) -> pathlib.Path:
17
    return paths_mapping['static'] / relative_path
18