Move get_template_path function to pakcage utils

Moved out the function from testing package to project main package.
This commit is contained in:
David Paz 2022-07-15 14:49:26 +02:00
parent 51e5b74f80
commit f072bb622f
No known key found for this signature in database
GPG key ID: 6600CC47B1C1B063
4 changed files with 8 additions and 7 deletions

View file

@ -8,7 +8,7 @@ from jinja2 import Template
from pre_commit_hooks.util import CalledProcessError
from pre_commit_hooks.util import cmd_output
from testing.util import get_template_path
from pre_commit_hooks.util import get_template_path
def get_current_branch() -> str:

View file

@ -1,5 +1,6 @@
from __future__ import annotations
import os
import subprocess
from typing import Any
@ -30,3 +31,8 @@ def zsplit(s: str) -> list[str]:
return s.split('\0')
else:
return []
def get_template_path(path: str) -> str:
parent_dir = os.path.abspath(os.path.join(os.getcwd(), os.pardir))
return os.path.join(parent_dir, 'templates', path)