Skip to content

Commit

Permalink
Fix linter B006 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
camlyall committed Jan 22, 2024
1 parent b259476 commit eecf640
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/archivematicaCommon/lib/executeOrRunSubProcess.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
import sys
import tempfile


def launchSubProcess(
command,
stdIn="",
printing=True,
arguments=[],
env_updates={},
arguments=None,
env_updates=None,
capture_output=False,
):
"""
Expand Down Expand Up @@ -59,6 +60,10 @@ def launchSubProcess(
returned IF the subprocess has failed, i.e., returned a
non-zero exit code.
"""
if arguments is None:
arguments = []
if env_updates is None:
env_updates = {}
stdError = ""
stdOut = ""

Expand Down Expand Up @@ -134,8 +139,12 @@ def launchSubProcess(


def createAndRunScript(
text, stdIn="", printing=True, arguments=[], env_updates={}, capture_output=True
text, stdIn="", printing=True, arguments=None, env_updates=None, capture_output=True
):
if arguments is None:
arguments = []
if env_updates is None:
env_updates = {}
# Output the text to a temporary file
with tempfile.NamedTemporaryFile(
encoding="utf-8", mode="wt", delete=False
Expand Down Expand Up @@ -163,8 +172,8 @@ def executeOrRun(
text,
stdIn="",
printing=True,
arguments=[],
env_updates={},
arguments=None,
env_updates=None,
capture_output=True,
):
"""
Expand Down Expand Up @@ -197,6 +206,10 @@ def executeOrRun(
capture_output: Whether or not to capture output for the executed process.
Default is `True`.
"""
if arguments is None:
arguments = []
if env_updates is None:
env_updates = {}
if type == "command":
return launchSubProcess(
text,
Expand Down

0 comments on commit eecf640

Please sign in to comment.