From 4b742faddd3ec29dc9da11cedb3c9c835b41e5d6 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 16 Oct 2020 11:07:33 +0200 Subject: [PATCH 1/2] logger keyword argument is skipped in function definition but is popped from kwargs --- pype/lib.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pype/lib.py b/pype/lib.py index f364945a86..f85d689ef9 100644 --- a/pype/lib.py +++ b/pype/lib.py @@ -81,7 +81,7 @@ def get_ffmpeg_tool_path(tool="ffmpeg"): # Special naming case for subprocess since its a built-in method. -def _subprocess(*args, logger=None, **kwargs): +def _subprocess(*args, **kwargs): """Convenience method for getting output errors for subprocess. Entered arguments and keyword arguments are passed to subprocess Popen. @@ -107,8 +107,7 @@ def _subprocess(*args, logger=None, **kwargs): filtered_env = {k: str(v) for k, v in env.items()} # Use lib's logger if was not passed with kwargs. - if not logger: - logger = log + logger = kwargs.pop("logger", log) # set overrides kwargs['stdout'] = kwargs.get('stdout', subprocess.PIPE) From 771ba3e966b59a560d962f4e2a6ab40661eab564 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 16 Oct 2020 11:07:41 +0200 Subject: [PATCH 2/2] modified docstring --- pype/lib.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pype/lib.py b/pype/lib.py index f85d689ef9..a53aae2086 100644 --- a/pype/lib.py +++ b/pype/lib.py @@ -87,10 +87,10 @@ def _subprocess(*args, **kwargs): Entered arguments and keyword arguments are passed to subprocess Popen. Args: - logger (logging.Logger): Logger object if want to use different than - lib's logger. *args: Variable length arument list passed to Popen. - **kwargs : Arbitary keyword arguments passed to Popen. + **kwargs : Arbitary keyword arguments passed to Popen. Is possible to + pass `logging.Logger` object under "logger" if want to use + different than lib's logger. Returns: str: Full output of subprocess concatenated stdout and stderr.