diff --git a/cellxgene_gateway/cache_entry.py b/cellxgene_gateway/cache_entry.py
index aa3bb0c..8c72efc 100644
--- a/cellxgene_gateway/cache_entry.py
+++ b/cellxgene_gateway/cache_entry.py
@@ -58,7 +58,6 @@ class CacheEntry:
@classmethod
def for_key(cls, key, port):
-
return cls(
None,
key,
diff --git a/cellxgene_gateway/filecrawl.py b/cellxgene_gateway/filecrawl.py
index 2ae9487..f812091 100644
--- a/cellxgene_gateway/filecrawl.py
+++ b/cellxgene_gateway/filecrawl.py
@@ -60,8 +60,8 @@ def render_item_tree(item_tree, item_source):
return html
-def render_item_source(item_source, path=None):
- item_tree = item_source.list_items(path)
- path_part = "" if path is None else ":" + path
- heading = f"
"
+def render_item_source(item_source, filter=None):
+ item_tree = item_source.list_items(filter)
+ filterpart = "" if filter is None else ":" + filter
+ heading = f""
return heading + render_item_tree(item_tree, item_source)
diff --git a/cellxgene_gateway/gateway.py b/cellxgene_gateway/gateway.py
index c930974..1b9c14e 100644
--- a/cellxgene_gateway/gateway.py
+++ b/cellxgene_gateway/gateway.py
@@ -80,7 +80,6 @@ cache = BackendCache()
@app.errorhandler(CellxgeneException)
def handle_invalid_usage(error):
-
message = f"{error.http_status} Error : {error.message}"
return (
@@ -95,7 +94,6 @@ def handle_invalid_usage(error):
@app.errorhandler(ProcessException)
def handle_invalid_process(error):
-
message = []
message.append(error.message)
diff --git a/cellxgene_gateway/items/file/fileitem_source.py b/cellxgene_gateway/items/file/fileitem_source.py
index 1028ef4..9addc5d 100644
--- a/cellxgene_gateway/items/file/fileitem_source.py
+++ b/cellxgene_gateway/items/file/fileitem_source.py
@@ -50,8 +50,8 @@ class FileItemSource(ItemSource):
def get_annotations_subpath(self, item) -> str:
return self.convert_h5ad_path_to_annotation(item.descriptor)
- def list_items(self, subpath: str = None) -> ItemTree:
- item_tree = self.scan_directory("" if subpath is None else subpath)
+ def list_items(self, filter: str = None) -> ItemTree:
+ item_tree = self.scan_directory("" if filter is None else filter)
"""def get_items(dir):
if dir.branches:
@@ -102,7 +102,9 @@ class FileItemSource(ItemSource):
]
# Exclude branches without files as leaves. Since traversal is applied pre-order,
# branch.branches has already been processed and we don't need to check deeper nesting.
- branches = [branch for branch in branches if branch.items or branch.branches]
+ branches = [
+ branch for branch in branches if branch.items or branch.branches
+ ]
return ItemTree(subpath, items, branches)
diff --git a/cellxgene_gateway/items/item_source.py b/cellxgene_gateway/items/item_source.py
index fbc26cc..eb778ff 100644
--- a/cellxgene_gateway/items/item_source.py
+++ b/cellxgene_gateway/items/item_source.py
@@ -21,7 +21,7 @@ class LookupResult:
class ItemSource(ABC):
@abstractmethod
- def list_items(self, subpath: str = None) -> List[Item]:
+ def list_items(self, filter: str = None) -> List[Item]:
raise Exception('"list_items" unimplemented')
@abstractmethod
diff --git a/cellxgene_gateway/items/s3/s3item_source.py b/cellxgene_gateway/items/s3/s3item_source.py
index 0a18ad5..e186e62 100644
--- a/cellxgene_gateway/items/s3/s3item_source.py
+++ b/cellxgene_gateway/items/s3/s3item_source.py
@@ -72,8 +72,8 @@ class S3ItemSource(ItemSource):
def get_annotations_subpath(self, item) -> str:
return self.convert_h5ad_key_to_annotation(item.descriptor)
- def list_items(self, subpath: str = None) -> ItemTree:
- item_tree = self.scan_directory("" if subpath is None else subpath)
+ def list_items(self, filter: str = None) -> ItemTree:
+ item_tree = self.scan_directory("" if filter is None else filter)
return item_tree
@property
@@ -116,7 +116,9 @@ class S3ItemSource(ItemSource):
branches = None
if len(subdir_keys) > 0:
branches = [self.scan_directory(key) for key in subdir_keys]
- branches = [branch for branch in branches if branch.items or branch.branches]
+ branches = [
+ branch for branch in branches if branch.items or branch.branches
+ ]
return ItemTree(directory_key, items, branches)
diff --git a/tests/test_filecrawl.py b/tests/test_filecrawl.py
index c626a0c..c64df8a 100644
--- a/tests/test_filecrawl.py
+++ b/tests/test_filecrawl.py
@@ -51,6 +51,7 @@ class TestRenderItemSource(unittest.TestCase):
class TestRenderItemTree(unittest.TestCase):
def setUp(self):
from cellxgene_gateway.gateway import app
+
self.app = app
self.app_context = self.app.test_request_context()
self.app_context.push()
@@ -72,9 +73,16 @@ class TestRenderItemTree(unittest.TestCase):
"",
)
- @patch("os.listdir", side_effect=lambda parent: defaultdict(list, {"tmp": ["foo"], "tmp/foo": ["bar"]})[parent])
+ @patch(
+ "os.listdir",
+ side_effect=lambda parent: defaultdict(
+ list, {"tmp": ["foo"], "tmp/foo": ["bar"]}
+ )[parent],
+ )
@patch("os.path.exists", return_value=True)
- def test_GIVEN_dirs_without_h5ad_THEN_excludes_dirs_in_output(self, listdir, exists):
+ def test_GIVEN_dirs_without_h5ad_THEN_excludes_dirs_in_output(
+ self, listdir, exists
+ ):
# Directories:
# - tmp
# - foo