def guess_project_dir() -> str:
    'Return detected project dir or user home directory.'
    try:
        result = subprocess.run(['git', 'rev-parse', '--show-toplevel'], stderr=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True, check=False)
    except FileNotFoundError:
        return str(Path.home())
    if (result.returncode != 0):
        return str(Path.home())
    return result.stdout.splitlines()[0]
Return detected project dir or user home directory.
def guess_project_dir() -> str:
    
    try:
        result = subprocess.run(['git', 'rev-parse', '--show-toplevel'], stderr=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True, check=False)
    except FileNotFoundError:
        return str(Path.home())
    if (result.returncode != 0):
        return str(Path.home())
    return result.stdout.splitlines()[0]