From 593537b7183adb0b4371ee19d6c6bd583267d305 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 7 May 2019 12:27:05 -0400 Subject: Docstrings --- delivery_merge/utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'delivery_merge/utils.py') diff --git a/delivery_merge/utils.py b/delivery_merge/utils.py index 2344a13..8935dd7 100644 --- a/delivery_merge/utils.py +++ b/delivery_merge/utils.py @@ -4,6 +4,12 @@ from subprocess import run def sh(prog, *args): + """ Execute a program with arguments + :param prog: str: path to program + :param args: tuple: variadic arguments + Accepts any combination of strings passed as arguments + :returns: subprocess.CompletedProcess + """ command = [prog] tmp = [] for arg in args: @@ -15,11 +21,17 @@ def sh(prog, *args): def git(*args): + """ Execute git commands + :param args: tuple: variadic arguments to pass to git + :returns: subprocess.CompletedProcess + """ return sh('git', *args) def getenv(s): """ Convert string of key pairs to dictionary format + :param s: str: key pairs separated by newlines + :returns: dict: converted key pairs """ return dict([x.split('=', 1) for x in s.splitlines()]) @@ -27,6 +39,7 @@ def getenv(s): @contextmanager def pushd(path): """ Equivalent to shell pushd/popd behavior + :param path: str: path to directory """ last = os.path.abspath(os.getcwd()) os.chdir(path) -- cgit