aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--allocbench/directories.py5
-rw-r--r--allocbench/facter.py6
-rw-r--r--allocbench/util.py4
3 files changed, 9 insertions, 6 deletions
diff --git a/allocbench/directories.py b/allocbench/directories.py
index c9c1006..5459842 100644
--- a/allocbench/directories.py
+++ b/allocbench/directories.py
@@ -16,12 +16,15 @@
# along with allocbench. If not, see <http://www.gnu.org/licenses/>.
"""Functions to obtain specific directories in the allocbench directory tree"""
+from os import PathLike
from pathlib import Path
from typing import Optional, Union
# /.../allocbench/allocbench
SRCDIR = Path(__file__).parent
+PathType = Union[str, PathLike]
+
def get_allocbench_src_dir() -> Path:
"""Return path to allocbench's sources"""
@@ -85,7 +88,7 @@ def get_allocbench_benchmark_build_dir() -> Path:
RESDIR = None
-def set_current_result_dir(resdir: Union[Path, str]):
+def set_current_result_dir(resdir: PathType):
"""Set the path to the result directory of the current invocation and silently create it"""
global RESDIR # pylint: disable=global-statement
RESDIR = Path(resdir)
diff --git a/allocbench/facter.py b/allocbench/facter.py
index 840aea6..5b34a65 100644
--- a/allocbench/facter.py
+++ b/allocbench/facter.py
@@ -24,17 +24,15 @@ import multiprocessing
import os
import platform
from subprocess import CalledProcessError
-from typing import Any, Dict, Tuple, Optional, Union
+from typing import Any, Dict, Tuple, Optional
-from allocbench.directories import get_allocbench_build_dir
+from allocbench.directories import get_allocbench_build_dir, PathType
from allocbench.util import run_cmd, get_logger
logger = get_logger(__file__)
FACTS: Dict[str, Any] = {}
-PathType = Union[str, os.PathLike]
-
def collect_facts():
"""Collect general facts about the benchmark environment"""
diff --git a/allocbench/util.py b/allocbench/util.py
index 149374c..3432996 100644
--- a/allocbench/util.py
+++ b/allocbench/util.py
@@ -23,6 +23,8 @@ import subprocess
import sys
from typing import List, Optional, Union
+from allocbench.directories import PathType
+
# Verbosity level -1: quiet, 0: logging.WARNING, 1: logging.INFO, 2: logging.DEBUG
VERBOSITY = 0
@@ -55,7 +57,7 @@ def run_cmd( # pylint: disable=too-many-arguments
capture=False,
shell=False,
check=True,
- cwd=None,
+ cwd: PathType = None,
input: str = None # pylint: disable=redefined-builtin
) -> subprocess.CompletedProcess:
# yapf: enable