Conditions | 1 |
Total Lines | 12 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import inspect |
||
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 |