Passed
Push — master ( 18b92d...e7c449 )
by Ramon
50s queued 12s
created

barentsz._here   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A here() 0 12 1
1
import inspect
2
from pathlib import Path
3
4
5
def here(frames_back: int = 0) -> Path:
6
    """
7
    Get the current directory from which this function is called.
8
    Args:
9
        frames_back: the number of extra frames to look back.
10
11
    Returns: the directory as a Path instance.
12
13
    """
14
    stack = inspect.stack()
15
    previous_frame = stack[1 + frames_back]
16
    return Path(previous_frame.filename).parent
17