mirror of
https://github.com/Novartis/cellxgene-gateway.git
synced 2026-09-30 05:18:11 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
620181ae4d | ||
|
|
73a7920cc8 | ||
|
|
ed3e999cd1 | ||
|
|
2ae2e53863 | ||
|
|
fd0e7d9c31 | ||
|
|
98ef6efd0c | ||
|
|
82e43ff943 | ||
|
|
f8a77423eb | ||
|
|
0375a717c9 | ||
|
|
4bf57832a0 |
@@ -8,7 +8,6 @@ repos:
|
|||||||
types: [python]
|
types: [python]
|
||||||
stages: [commit]
|
stages: [commit]
|
||||||
- id: black
|
- id: black
|
||||||
language_version: python3.6+
|
|
||||||
name: black
|
name: black
|
||||||
language: system
|
language: system
|
||||||
entry: black
|
entry: black
|
||||||
|
|||||||
@@ -1,3 +1,19 @@
|
|||||||
|
# 0.3.7
|
||||||
|
|
||||||
|
* added back /metadata/ip_address endpoint
|
||||||
|
|
||||||
|
# 0.3.6
|
||||||
|
|
||||||
|
* pinned version of werkzeug
|
||||||
|
|
||||||
|
# 0.3.5
|
||||||
|
|
||||||
|
* Pinned flask version to match cellxgene 0.17.0
|
||||||
|
|
||||||
|
# 0.3.4
|
||||||
|
|
||||||
|
* Fixed bug #50 affecting subdirectory listing
|
||||||
|
|
||||||
# 0.3.3
|
# 0.3.3
|
||||||
|
|
||||||
* Fixed bug #48 affecting cache pruning
|
* Fixed bug #48 affecting cache pruning
|
||||||
|
|||||||
@@ -7,4 +7,4 @@
|
|||||||
# OR CONDITIONS OF ANY KIND, either express or implied. See the License for
|
# OR CONDITIONS OF ANY KIND, either express or implied. See the License for
|
||||||
# the specific language governing permissions and limitations under the License.
|
# the specific language governing permissions and limitations under the License.
|
||||||
|
|
||||||
__version__ = "0.3.3"
|
__version__ = "0.3.7"
|
||||||
|
|||||||
@@ -52,6 +52,14 @@ def _force_https(app):
|
|||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
|
def set_no_cache(resp):
|
||||||
|
resp.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
|
||||||
|
resp.headers["Pragma"] = "no-cache"
|
||||||
|
resp.headers["Expires"] = "0"
|
||||||
|
resp.headers["Cache-Control"] = "public, max-age=0"
|
||||||
|
return resp
|
||||||
|
|
||||||
|
|
||||||
app.wsgi_app = _force_https(app.wsgi_app)
|
app.wsgi_app = _force_https(app.wsgi_app)
|
||||||
if (
|
if (
|
||||||
env.proxy_fix_for > 0
|
env.proxy_fix_for > 0
|
||||||
@@ -157,10 +165,7 @@ def filecrawl(path=None):
|
|||||||
path=path,
|
path=path,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
resp.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
|
set_no_cache(resp)
|
||||||
resp.headers["Pragma"] = "no-cache"
|
|
||||||
resp.headers["Expires"] = "0"
|
|
||||||
resp.headers["Cache-Control"] = "public, max-age=0"
|
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
|
|
||||||
@@ -267,6 +272,12 @@ def do_terminate(path):
|
|||||||
return redirect(url_for("do_GET_status"), code=302)
|
return redirect(url_for("do_GET_status"), code=302)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/metadata/ip_address", methods=["GET"])
|
||||||
|
def ip_address():
|
||||||
|
resp = make_response(env.ip)
|
||||||
|
return set_no_cache(resp)
|
||||||
|
|
||||||
|
|
||||||
def launch():
|
def launch():
|
||||||
env.validate()
|
env.validate()
|
||||||
if not item_sources or not len(item_sources):
|
if not item_sources or not len(item_sources):
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class FileItemSource(ItemSource):
|
|||||||
return self.convert_h5ad_path_to_annotation(item.descriptor)
|
return self.convert_h5ad_path_to_annotation(item.descriptor)
|
||||||
|
|
||||||
def list_items(self, filter: str = None) -> ItemTree:
|
def list_items(self, filter: str = None) -> ItemTree:
|
||||||
item_tree = self.scan_directory()
|
item_tree = self.scan_directory("" if filter is None else filter)
|
||||||
|
|
||||||
"""def get_items(dir):
|
"""def get_items(dir):
|
||||||
if dir.branches:
|
if dir.branches:
|
||||||
|
|||||||
+6
-2
@@ -4,11 +4,15 @@ channels:
|
|||||||
dependencies:
|
dependencies:
|
||||||
- python=3.7
|
- python=3.7
|
||||||
- requests
|
- requests
|
||||||
- flask
|
- flask<2.0.0,>=1.0.2
|
||||||
- psutil
|
- psutil
|
||||||
- black
|
- black
|
||||||
|
- twine
|
||||||
|
- isort
|
||||||
- coverage
|
- coverage
|
||||||
- pip
|
- pip
|
||||||
- pip:
|
- pip:
|
||||||
- flask-api
|
- pre_commit
|
||||||
|
- flask-api==2.0
|
||||||
|
- werkzeug==1.0.1
|
||||||
- cellxgene>=0.15
|
- cellxgene>=0.15
|
||||||
|
|||||||
+3
-2
@@ -1,5 +1,6 @@
|
|||||||
cellxgene>=0.15
|
cellxgene>=0.15
|
||||||
flask
|
flask<2.0.0,>=1.0.2
|
||||||
flask_api
|
flask-api==2.0
|
||||||
|
werkzeug==1.0.1
|
||||||
psutil
|
psutil
|
||||||
requests
|
requests
|
||||||
|
|||||||
@@ -1,10 +1,31 @@
|
|||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from cellxgene_gateway.items.file.fileitem_source import FileItemSource
|
from cellxgene_gateway.items.file.fileitem_source import FileItemSource
|
||||||
|
|
||||||
|
|
||||||
|
def stub_join(path):
|
||||||
|
path.join = lambda x, y: x + "/" + y
|
||||||
|
|
||||||
|
|
||||||
class TestFileItemSource(unittest.TestCase):
|
class TestFileItemSource(unittest.TestCase):
|
||||||
|
@patch("os.path")
|
||||||
|
@patch("os.listdir")
|
||||||
|
def test_list_items_GIVEN_no_subpath_THEN_checks_dir(self, listdir, path):
|
||||||
|
stub_join(path)
|
||||||
|
source = FileItemSource("/tmp/unittest", "local")
|
||||||
|
source.list_items()
|
||||||
|
path.exists.assert_called_once_with("/tmp/unittest/")
|
||||||
|
|
||||||
|
@patch("os.path")
|
||||||
|
@patch("os.listdir")
|
||||||
|
def test_list_items_GIVEN_subpath_THEN_checks_subpath(self, listdir, path):
|
||||||
|
stub_join(path)
|
||||||
|
source = FileItemSource("/tmp/unittest", "local")
|
||||||
|
source.list_items("foo")
|
||||||
|
path.exists.assert_called_once_with("/tmp/unittest/foo")
|
||||||
|
|
||||||
def test_make_fileitem_from_path_GIVEN_annotation_file_THEN_name_lacks_csv(
|
def test_make_fileitem_from_path_GIVEN_annotation_file_THEN_name_lacks_csv(
|
||||||
self,
|
self,
|
||||||
):
|
):
|
||||||
|
|||||||
Reference in New Issue
Block a user