Skip to content

Commit

Permalink
ruff fix
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorvaladi committed Apr 30, 2024
1 parent 0889f42 commit 28612e9
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions fedn/fedn/utils/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
"""

import os
import subprocess
import sys
Expand Down Expand Up @@ -68,6 +69,7 @@ def _exec_cmd(
Args:
----
cmd: The command to run, as a string or a list of strings.
cwd: The current working directory.
throw_on_error: If True, raises an Exception if the exit code of the program is nonzero.
extra_env: Extra environment variables to be defined when running the child process.
If this argument is specified, `kwargs` cannot contain `env`.
Expand Down Expand Up @@ -96,9 +98,7 @@ def _exec_cmd(
raise ValueError("`extra_env` and `env` cannot be used at the same time")

if capture_output and stream_output:
raise ValueError(
"`capture_output=True` and `stream_output=True` cannot be specified at the same time"
)
raise ValueError("`capture_output=True` and `stream_output=True` cannot be specified at the same time")

env = env if extra_env is None else {**os.environ, **extra_env}

Expand All @@ -110,9 +110,7 @@ def _exec_cmd(

if capture_output or stream_output:
if kwargs.get("stdout") is not None or kwargs.get("stderr") is not None:
raise ValueError(
"stdout and stderr arguments may not be used with capture_output or stream_output"
)
raise ValueError("stdout and stderr arguments may not be used with capture_output or stream_output")
kwargs["stdout"] = subprocess.PIPE
if capture_output:
kwargs["stderr"] = subprocess.PIPE
Expand Down Expand Up @@ -150,19 +148,18 @@ def _exec_cmd(


def run_process(args, cwd):
""" Run a process and log the output.
"""Run a process and log the output.
:param args: The arguments to the process.
:type args: list
:param cwd: The current working directory.
:type cwd: str
:return:
"""
status = subprocess.Popen(
args, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
status = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

def check_io():
""" Check stdout/stderr of the child process.
"""Check stdout/stderr of the child process.
:return:
"""
Expand Down

0 comments on commit 28612e9

Please sign in to comment.