refactor: Reduce code duplication in scripts/

This commit is contained in:
Martin Fischer 2023-01-20 07:54:38 +01:00 committed by Charlie Marsh
parent 6cc160bc2b
commit 67ca50e9f2
3 changed files with 15 additions and 22 deletions

13
scripts/_utils.py Normal file
View file

@ -0,0 +1,13 @@
import os
from pathlib import Path
ROOT_DIR = Path(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
def dir_name(origin: str) -> str:
return origin.replace("-", "_")
def pascal_case(origin: str) -> str:
"""Convert from snake-case to PascalCase."""
return "".join(word.title() for word in origin.split("-"))