Passed
Push — main ( 834059...84c92a )
by Yohann
01:29
created

pincer.utils.directory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

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

1 Function

Rating   Name   Duplication   Size   Complexity  
A chdir() 0 8 1
1
import os
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
3
from contextlib import contextmanager
4
from typing import Generator, Any
5
6
7
@contextmanager
8
def chdir(path) -> Generator[str, Any, None]:
9
    """Change the cwd to the given path as a context manager."""
10
    current_path = os.getcwd()
11
    os.chdir(path)
12
13
    yield current_path
14
    os.chdir(current_path)
15