diff options
author | BonfaceKilz | 2021-06-29 13:16:09 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-06-29 14:50:30 +0300 |
commit | d6715cff2e5a1771b22bb2ce7680347cad501841 (patch) | |
tree | 5b9f93385e15ae47cee632eacf4e1e84f9845f62 | |
parent | 69da1064e0815f4c60584a977d928c64c3f68507 (diff) | |
download | genenetwork3-d6715cff2e5a1771b22bb2ce7680347cad501841.tar.gz |
Replace list with a tuple as an argument when setting success_codes
* gn3/commands.py (run_cmd): Replace type of success_codes from List to Tuple
* gn3/computations/diff.py (generate_diff): Pass success_codes as a Tuple when
calling "run_cmd".
-rw-r--r-- | gn3/commands.py | 3 | ||||
-rw-r--r-- | gn3/computations/diff.py | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/gn3/commands.py b/gn3/commands.py index 0f526d8..7d42ced 100644 --- a/gn3/commands.py +++ b/gn3/commands.py @@ -6,6 +6,7 @@ from datetime import datetime from typing import Dict from typing import List from typing import Optional +from typing import Tuple from uuid import uuid4 from redis.client import Redis # Used only in type hinting @@ -74,7 +75,7 @@ Returns the name of the specific redis hash for the specific task. return unique_id -def run_cmd(cmd: str, success_codes: List = [0]) -> Dict: +def run_cmd(cmd: str, success_codes: Tuple = (0,)) -> Dict: """Run CMD and return the CMD's status code and output as a dict""" results = subprocess.run(cmd, capture_output=True, shell=True, check=False) diff --git a/gn3/computations/diff.py b/gn3/computations/diff.py index 4bbc6cf..af02f7f 100644 --- a/gn3/computations/diff.py +++ b/gn3/computations/diff.py @@ -6,7 +6,7 @@ from gn3.commands import run_cmd def generate_diff(data: str, edited_data: str) -> Optional[str]: """Generate the diff between 2 files""" - results = run_cmd(f"diff {data} {edited_data}", success_codes=[1, 2]) + results = run_cmd(f"diff {data} {edited_data}", success_codes=(1, 2)) if results.get("code", -1) > 0: return results.get("output") return None |