mirror of
https://github.com/Novartis/cellxgene-gateway.git
synced 2026-10-03 14:18:11 +08:00
blackened code
This commit is contained in:
@@ -26,6 +26,7 @@ class CacheEntryStatus(Enum):
|
||||
error = "error"
|
||||
terminated = "terminated"
|
||||
|
||||
|
||||
class CacheEntry:
|
||||
def __init__(
|
||||
self,
|
||||
|
||||
@@ -24,15 +24,16 @@ external_protocol = os.environ.get(
|
||||
ip = os.environ.get("GATEWAY_IP")
|
||||
extra_scripts = os.environ.get("GATEWAY_EXTRA_SCRIPTS")
|
||||
ttl = os.environ.get("GATEWAY_TTL")
|
||||
enable_upload = os.environ.get(
|
||||
"GATEWAY_ENABLE_UPLOAD", ""
|
||||
).lower() in ["true", "1"]
|
||||
enable_upload = os.environ.get("GATEWAY_ENABLE_UPLOAD", "").lower() in [
|
||||
"true",
|
||||
"1",
|
||||
]
|
||||
enable_annotations = os.environ.get(
|
||||
"GATEWAY_ENABLE_ANNOTATIONS", ""
|
||||
).lower() in ["true", "1"]
|
||||
enable_backed_mode = os.environ.get(
|
||||
"GATEWAY_ENABLE_BACKED_MODE", ""
|
||||
).lower() in ['true', '1']
|
||||
).lower() in ["true", "1"]
|
||||
|
||||
env_vars = {
|
||||
"CELLXGENE_LOCATION": cellxgene_location,
|
||||
|
||||
@@ -9,7 +9,12 @@
|
||||
|
||||
import os
|
||||
from cellxgene_gateway import env
|
||||
from cellxgene_gateway.dir_util import make_h5ad, make_annotations, annotations_suffix
|
||||
from cellxgene_gateway.dir_util import (
|
||||
make_h5ad,
|
||||
make_annotations,
|
||||
annotations_suffix,
|
||||
)
|
||||
|
||||
|
||||
def recurse_dir(path):
|
||||
if not os.path.exists(path):
|
||||
@@ -18,6 +23,7 @@ def recurse_dir(path):
|
||||
)
|
||||
|
||||
all_entries = sorted(os.listdir(path))
|
||||
|
||||
def is_h5ad(el):
|
||||
return el.endswith(".h5ad") and os.path.isfile(os.path.join(path, el))
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
from flask import request
|
||||
|
||||
|
||||
def querystring():
|
||||
qs = request.query_string.decode()
|
||||
return f'?{qs}' if len(qs) > 0 else ''
|
||||
return f"?{qs}" if len(qs) > 0 else ""
|
||||
|
||||
@@ -236,7 +236,10 @@ def do_view(path):
|
||||
|
||||
match.timestamp = current_time_stamp()
|
||||
|
||||
if match.status == CacheEntryStatus.loaded or match.status == CacheEntryStatus.loading:
|
||||
if (
|
||||
match.status == CacheEntryStatus.loaded
|
||||
or match.status == CacheEntryStatus.loading
|
||||
):
|
||||
return match.serve_content(path)
|
||||
elif match.status == CacheEntryStatus.error:
|
||||
raise ProcessException.from_cache_entry(match)
|
||||
|
||||
@@ -19,7 +19,6 @@ from cellxgene_gateway.path_util import get_annotation_file_path, get_file_path
|
||||
from cellxgene_gateway.process_exception import ProcessException
|
||||
|
||||
|
||||
|
||||
class SubprocessBackend:
|
||||
def __init__(self):
|
||||
pass
|
||||
@@ -29,7 +28,9 @@ class SubprocessBackend:
|
||||
):
|
||||
if enable_annotations and not annotation_file_path is None:
|
||||
if annotation_file_path == "":
|
||||
extra_args = f" --annotations-dir {make_annotations(file_path)}"
|
||||
extra_args = (
|
||||
f" --annotations-dir {make_annotations(file_path)}"
|
||||
)
|
||||
else:
|
||||
extra_args = f" --annotations-file {annotation_file_path}"
|
||||
else:
|
||||
|
||||
@@ -9,5 +9,6 @@ class TestCacheEntry(unittest.TestCase):
|
||||
entry = CacheEntry.for_key("some-key", 1)
|
||||
self.assertEqual(entry.status, CacheEntryStatus.loading)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -10,7 +10,7 @@ class TestRenderEntry(unittest.TestCase):
|
||||
"path": "/somepath/",
|
||||
"name": "entry",
|
||||
"type": "file",
|
||||
"annotations": []
|
||||
"annotations": [],
|
||||
}
|
||||
rendered = render_entry(entry)
|
||||
self.assertIn("view/somepath", rendered)
|
||||
@@ -20,7 +20,7 @@ class TestRenderEntry(unittest.TestCase):
|
||||
"path": "/somepath",
|
||||
"name": "entry",
|
||||
"type": "file",
|
||||
"annotations": []
|
||||
"annotations": [],
|
||||
}
|
||||
rendered = render_entry(entry)
|
||||
self.assertIn("view/somepath", rendered)
|
||||
@@ -30,7 +30,7 @@ class TestRenderEntry(unittest.TestCase):
|
||||
"path": "somepath/",
|
||||
"name": "entry",
|
||||
"type": "file",
|
||||
"annotations": []
|
||||
"annotations": [],
|
||||
}
|
||||
rendered = render_entry(entry)
|
||||
self.assertIn("view/somepath", rendered)
|
||||
@@ -40,7 +40,7 @@ class TestRenderEntry(unittest.TestCase):
|
||||
"path": "somepath",
|
||||
"name": "entry",
|
||||
"type": "file",
|
||||
"annotations": []
|
||||
"annotations": [],
|
||||
}
|
||||
rendered = render_entry(entry)
|
||||
self.assertIn("view/somepath", rendered)
|
||||
|
||||
Reference in New Issue
Block a user