diff options
author | BonfaceKilz | 2021-10-09 09:43:40 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-10-25 14:00:14 +0300 |
commit | 0c6ad845e6f461e880b423bd8f79156754658f8a (patch) | |
tree | ad0a0aa63302f607a5732f5ed381ef0d69c51af5 /wqflask | |
parent | a22ffd365e669b0d8d577a82ea6bcd9c5c188b2b (diff) | |
download | genenetwork2-0c6ad845e6f461e880b423bd8f79156754658f8a.tar.gz |
Move markdown_routes to api/markdown
All new API definitions should be migrated to "wqflask/ api"
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/tests/unit/wqflask/api/test_markdown_routes.py (renamed from wqflask/tests/unit/wqflask/test_markdown_routes.py) | 10 | ||||
-rw-r--r-- | wqflask/wqflask/__init__.py | 16 | ||||
-rw-r--r-- | wqflask/wqflask/api/correlation.py | 6 | ||||
-rw-r--r-- | wqflask/wqflask/api/markdown.py (renamed from wqflask/wqflask/markdown_routes.py) | 0 |
4 files changed, 13 insertions, 19 deletions
diff --git a/wqflask/tests/unit/wqflask/test_markdown_routes.py b/wqflask/tests/unit/wqflask/api/test_markdown_routes.py index 90e0f17c..1c513ac5 100644 --- a/wqflask/tests/unit/wqflask/test_markdown_routes.py +++ b/wqflask/tests/unit/wqflask/api/test_markdown_routes.py @@ -1,10 +1,10 @@ -"""Test functions in markdown utils""" +"""Test functions for wqflask/api/markdown.py""" import unittest from unittest import mock from dataclasses import dataclass -from wqflask.markdown_routes import render_markdown +from wqflask.api.markdown import render_markdown @dataclass @@ -24,9 +24,9 @@ This is another sub-heading""" class TestMarkdownRoutesFunctions(unittest.TestCase): - """Test cases for functions in markdown_routes""" + """Test cases for functions in markdown""" - @mock.patch('wqflask.markdown_routes.requests.get') + @mock.patch('wqflask.api.markdown.requests.get') def test_render_markdown_when_fetching_locally(self, requests_mock): requests_mock.return_value = MockRequests404() markdown_content = render_markdown("general/glossary/glossary.md") @@ -38,7 +38,7 @@ class TestMarkdownRoutesFunctions(unittest.TestCase): self.assertRegexpMatches(markdown_content, "Content for general/glossary/glossary.md not available.") - @mock.patch('wqflask.markdown_routes.requests.get') + @mock.patch('wqflask.api.markdown.requests.get') def test_render_markdown_when_fetching_remotely(self, requests_mock): requests_mock.return_value = MockRequests200() markdown_content = render_markdown("general/glossary/glossary.md") diff --git a/wqflask/wqflask/__init__.py b/wqflask/wqflask/__init__.py index 8b2055cd..5758b13e 100644 --- a/wqflask/wqflask/__init__.py +++ b/wqflask/wqflask/__init__.py @@ -8,14 +8,14 @@ from flask import Flask from typing import Tuple from urllib.parse import urlparse from utility import formatting -from wqflask.markdown_routes import glossary_blueprint -from wqflask.markdown_routes import references_blueprint -from wqflask.markdown_routes import links_blueprint -from wqflask.markdown_routes import policies_blueprint -from wqflask.markdown_routes import environments_blueprint -from wqflask.markdown_routes import facilities_blueprint -from wqflask.markdown_routes import blogs_blueprint -from wqflask.markdown_routes import news_blueprint +from wqflask.api.markdown import glossary_blueprint +from wqflask.api.markdown import references_blueprint +from wqflask.api.markdown import links_blueprint +from wqflask.api.markdown import policies_blueprint +from wqflask.api.markdown import environments_blueprint +from wqflask.api.markdown import facilities_blueprint +from wqflask.api.markdown import blogs_blueprint +from wqflask.api.markdown import news_blueprint app = Flask(__name__) diff --git a/wqflask/wqflask/api/correlation.py b/wqflask/wqflask/api/correlation.py index a135ecc8..9b875c99 100644 --- a/wqflask/wqflask/api/correlation.py +++ b/wqflask/wqflask/api/correlation.py @@ -9,7 +9,6 @@ from utility.db_tools import escape from wqflask.correlation import correlation_functions - def do_correlation(start_vars): assert('db' in start_vars) assert('target_db' in start_vars) @@ -26,7 +25,6 @@ def do_correlation(start_vars): corr_results = calculate_results( this_trait, this_dataset, target_dataset, corr_params) - #corr_results = collections.OrderedDict(sorted(corr_results.items(), key=lambda t: -abs(t[1][0]))) final_results = [] for _trait_counter, trait in enumerate(list(corr_results.keys())[:corr_params['return_count']]): @@ -54,11 +52,7 @@ def do_correlation(start_vars): "#_strains": num_overlap, "p_value": sample_p } - final_results.append(result_dict) - - # json_corr_results = generate_corr_json(final_corr_results, this_trait, this_dataset, target_dataset, for_api = True) - return final_results diff --git a/wqflask/wqflask/markdown_routes.py b/wqflask/wqflask/api/markdown.py index 580b9ac0..580b9ac0 100644 --- a/wqflask/wqflask/markdown_routes.py +++ b/wqflask/wqflask/api/markdown.py |