diff options
author | zsloan | 2022-09-06 13:32:28 -0500 |
---|---|---|
committer | GitHub | 2022-09-06 13:32:28 -0500 |
commit | d8bc7067b717e0b680d98b7cfcbc26c758a109bf (patch) | |
tree | 571677761b3bb464b55bc19f208f135214321ad2 /wqflask/utility | |
parent | e0626f40d8fe4fa83daba52b82c1b459b34b1849 (diff) | |
parent | 363237f11b9eb14f52c4f0c43a931c99c827c496 (diff) | |
download | genenetwork2-d8bc7067b717e0b680d98b7cfcbc26c758a109bf.tar.gz |
Merge branch 'testing' into feature/generalize_tables
Diffstat (limited to 'wqflask/utility')
-rw-r--r-- | wqflask/utility/Plot.py | 4 | ||||
-rw-r--r-- | wqflask/utility/benchmark.py | 52 | ||||
-rw-r--r-- | wqflask/utility/gen_geno_ob.py | 4 | ||||
-rw-r--r-- | wqflask/utility/helper_functions.py | 3 | ||||
-rw-r--r-- | wqflask/utility/logger.py | 1 | ||||
-rw-r--r-- | wqflask/utility/pillow_utils.py | 3 | ||||
-rw-r--r-- | wqflask/utility/redis_tools.py | 2 | ||||
-rw-r--r-- | wqflask/utility/startup_config.py | 3 | ||||
-rw-r--r-- | wqflask/utility/tools.py | 2 |
9 files changed, 2 insertions, 72 deletions
diff --git a/wqflask/utility/Plot.py b/wqflask/utility/Plot.py index d4256a46..df7156b4 100644 --- a/wqflask/utility/Plot.py +++ b/wqflask/utility/Plot.py @@ -33,8 +33,7 @@ from math import * import utility.corestats as corestats from base import webqtlConfig from utility.pillow_utils import draw_rotated_text -import utility.logger -logger = utility.logger.getLogger(__name__) + # ---- Define common colours ---- # BLUE = ImageColor.getrgb("blue") @@ -105,7 +104,6 @@ def find_outliers(vals): """ if vals: - #logger.debug("vals is:", pf(vals)) stats = corestats.Stats(vals) low_hinge = stats.percentile(25) up_hinge = stats.percentile(75) diff --git a/wqflask/utility/benchmark.py b/wqflask/utility/benchmark.py deleted file mode 100644 index 6ece2f21..00000000 --- a/wqflask/utility/benchmark.py +++ /dev/null @@ -1,52 +0,0 @@ -import collections -import inspect -import time -from utility.tools import LOG_BENCH - -from utility.logger import getLogger -logger = getLogger(__name__) - - -class Bench: - entries = collections.OrderedDict() - - def __init__(self, name=None, write_output=LOG_BENCH): - self.name = name - self.write_output = write_output - - def __enter__(self): - if self.write_output: - if self.name: - logger.debug("Starting benchmark: %s" % (self.name)) - else: - logger.debug("Starting benchmark at: %s [%i]" % ( - inspect.stack()[1][3], inspect.stack()[1][2])) - self.start_time = time.time() - - def __exit__(self, type, value, traceback): - time_taken = time.time() - self.start_time - if self.write_output: - if self.name: - name = self.name - else: - name = "That" - - logger.info(" %s took: %f seconds" % (name, (time_taken))) - - if self.name: - Bench.entries[self.name] = Bench.entries.get( - self.name, 0) + time_taken - - @classmethod - def report(cls): - total_time = sum( - (time_taken for time_taken in list(cls.entries.values()))) - print("\nTiming report\n") - for name, time_taken in list(cls.entries.items()): - percent = int(round((time_taken / total_time) * 100)) - print("[{}%] {}: {}".format(percent, name, time_taken)) - print() - - def reset(cls): - """Reset the entries""" - cls.entries = collections.OrderedDict() diff --git a/wqflask/utility/gen_geno_ob.py b/wqflask/utility/gen_geno_ob.py index e619b7b6..c7a1ea59 100644 --- a/wqflask/utility/gen_geno_ob.py +++ b/wqflask/utility/gen_geno_ob.py @@ -1,7 +1,3 @@ -import utility.logger -logger = utility.logger.getLogger(__name__) - - class genotype: """ Replacement for reaper.Dataset so we can remove qtlreaper use while still generating mapping output figure diff --git a/wqflask/utility/helper_functions.py b/wqflask/utility/helper_functions.py index 27dd0729..4229a91f 100644 --- a/wqflask/utility/helper_functions.py +++ b/wqflask/utility/helper_functions.py @@ -6,9 +6,6 @@ from utility import hmac from flask import g -import logging -logger = logging.getLogger(__name__) - def get_species_dataset_trait(self, start_vars): if "temp_trait" in list(start_vars.keys()): diff --git a/wqflask/utility/logger.py b/wqflask/utility/logger.py index d706e32a..65f2f1ee 100644 --- a/wqflask/utility/logger.py +++ b/wqflask/utility/logger.py @@ -27,7 +27,6 @@ # We'll add more overrides soon. import logging -import string from inspect import isfunction from pprint import pformat as pf from inspect import stack diff --git a/wqflask/utility/pillow_utils.py b/wqflask/utility/pillow_utils.py index 5713e155..e302df18 100644 --- a/wqflask/utility/pillow_utils.py +++ b/wqflask/utility/pillow_utils.py @@ -2,9 +2,6 @@ from PIL import Image, ImageColor, ImageDraw, ImageFont from utility.tools import TEMPDIR -import utility.logger -logger = utility.logger.getLogger(__name__) - BLACK = ImageColor.getrgb("black") WHITE = ImageColor.getrgb("white") diff --git a/wqflask/utility/redis_tools.py b/wqflask/utility/redis_tools.py index 641d973e..945efbbd 100644 --- a/wqflask/utility/redis_tools.py +++ b/wqflask/utility/redis_tools.py @@ -5,8 +5,6 @@ import datetime import redis # used for collections from utility.hmac import hmac_creation -from utility.logger import getLogger -logger = getLogger(__name__) def get_redis_conn(): diff --git a/wqflask/utility/startup_config.py b/wqflask/utility/startup_config.py index 778fb64d..59923fa1 100644 --- a/wqflask/utility/startup_config.py +++ b/wqflask/utility/startup_config.py @@ -23,12 +23,9 @@ def app_config(): if mode in ["DEV", "DEBUG"]: app.config['TEMPLATES_AUTO_RELOAD'] = True if mode == "DEBUG": - from flask_debugtoolbar import DebugToolbarExtension app.debug = True - toolbar = DebugToolbarExtension(app) print("==========================================") - show_settings() port = get_setting_int("SERVER_PORT") diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py index db0b4320..19bf686b 100644 --- a/wqflask/utility/tools.py +++ b/wqflask/utility/tools.py @@ -50,7 +50,7 @@ def get_setting(command_id, guess=None): app_set(command_id, command) return command else: - return None + return app.config.get(command_id) # ---- Check whether environment exists # print("Looking for "+command_id+"\n") |