Passed
Push — main ( 05fcff...04a574 )
by Eran
01:28
created

web.get_static_path()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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