From 303e4b71c2172da5be19c84d4be5a062329ac013 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 26 Aug 2020 19:12:33 +0300 Subject: Remove "from __future__ import new_feature" statements See: --- webtests/browser_run.py | 4 +--- webtests/correlation_matrix_test.py | 2 -- webtests/correlation_test.py | 2 -- webtests/marker_regression_test.py | 2 -- webtests/show_trait_js_test.py | 2 -- webtests/test_runner.py | 4 +--- 6 files changed, 2 insertions(+), 14 deletions(-) (limited to 'webtests') diff --git a/webtests/browser_run.py b/webtests/browser_run.py index 2ec299c5..7ee540b7 100644 --- a/webtests/browser_run.py +++ b/webtests/browser_run.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division, print_function - __all__ = ('sleep', 'testmod', 'test') from doctest import testmod @@ -71,4 +69,4 @@ class Test(object): -test = Test() \ No newline at end of file +test = Test() diff --git a/webtests/correlation_matrix_test.py b/webtests/correlation_matrix_test.py index 8529c265..97114890 100644 --- a/webtests/correlation_matrix_test.py +++ b/webtests/correlation_matrix_test.py @@ -65,8 +65,6 @@ text: 0.608\n71 """ -from __future__ import absolute_import, division, print_function - from browser_run import * testmod() diff --git a/webtests/correlation_test.py b/webtests/correlation_test.py index aad3a69f..311bb847 100644 --- a/webtests/correlation_test.py +++ b/webtests/correlation_test.py @@ -44,8 +44,6 @@ text: 1.000 """ -from __future__ import absolute_import, division, print_function - from browser_run import * testmod() diff --git a/webtests/marker_regression_test.py b/webtests/marker_regression_test.py index c4f76f53..9b4a4acb 100644 --- a/webtests/marker_regression_test.py +++ b/webtests/marker_regression_test.py @@ -48,8 +48,6 @@ text: 11.511 """ -from __future__ import absolute_import, division, print_function - from browser_run import * testmod() diff --git a/webtests/show_trait_js_test.py b/webtests/show_trait_js_test.py index 0fd2c16c..34ffd3b7 100644 --- a/webtests/show_trait_js_test.py +++ b/webtests/show_trait_js_test.py @@ -35,8 +35,6 @@ style: display: none; """ -from __future__ import absolute_import, division, print_function - from browser_run import * testmod() diff --git a/webtests/test_runner.py b/webtests/test_runner.py index ef6d0d69..b5b590a6 100644 --- a/webtests/test_runner.py +++ b/webtests/test_runner.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division, print_function - import unittest import doctest import glob @@ -25,4 +23,4 @@ def main(): runner.run(suite) if __name__ == '__main__': - main() \ No newline at end of file + main() -- cgit v1.2.3 From 23e8e222e8016ea8335d4850070f884ab9b043fe Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 29 Apr 2021 21:45:51 +0300 Subject: Run `sed -i 's/(object)//g'` See: https://is.gd/pL7IJF Ran: find . \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i 's/(object)//g' --- webtests/browser_run.py | 2 +- wqflask/base/data_set.py | 6 +++--- wqflask/base/mrna_assay_tissue_data.py | 2 +- wqflask/base/species.py | 6 +++--- wqflask/base/trait.py | 2 +- wqflask/maintenance/convert_geno_to_bimbam.py | 4 ++-- .../maintenance/generate_kinship_from_bimbam.py | 2 +- wqflask/maintenance/geno_to_json.py | 4 ++-- wqflask/maintenance/print_benchmark.py | 2 +- wqflask/utility/__init__.py | 4 ++-- wqflask/utility/benchmark.py | 2 +- wqflask/utility/gen_geno_ob.py | 6 +++--- wqflask/utility/genofile_parser.py | 4 ++-- wqflask/utility/temp_data.py | 2 +- .../comparison_bar_chart/comparison_bar_chart.py | 2 +- wqflask/wqflask/correlation/corr_scatter_plot.py | 2 +- wqflask/wqflask/correlation/show_corr_results.py | 2 +- .../wqflask/correlation_matrix/show_corr_matrix.py | 2 +- wqflask/wqflask/ctl/ctl_analysis.py | 2 +- wqflask/wqflask/db_info.py | 2 +- wqflask/wqflask/do_search.py | 2 +- wqflask/wqflask/docs.py | 2 +- wqflask/wqflask/external_tools/send_to_bnw.py | 2 +- .../wqflask/external_tools/send_to_geneweaver.py | 2 +- .../wqflask/external_tools/send_to_webgestalt.py | 2 +- wqflask/wqflask/gsearch.py | 2 +- wqflask/wqflask/heatmap/heatmap.py | 2 +- .../marker_regression/display_mapping_results.py | 2 +- wqflask/wqflask/marker_regression/run_mapping.py | 2 +- wqflask/wqflask/network_graph/network_graph.py | 2 +- wqflask/wqflask/news.py | 2 +- wqflask/wqflask/search_results.py | 2 +- wqflask/wqflask/server_side.py | 2 +- wqflask/wqflask/show_trait/SampleList.py | 2 +- wqflask/wqflask/show_trait/show_trait.py | 6 +++--- wqflask/wqflask/snp_browser/snp_browser.py | 2 +- wqflask/wqflask/update_search_results.py | 2 +- wqflask/wqflask/user_manager.py | 22 +++++++++++----------- wqflask/wqflask/user_session.py | 2 +- wqflask/wqflask/wgcna/wgcna_analysis.py | 2 +- 40 files changed, 62 insertions(+), 62 deletions(-) (limited to 'webtests') diff --git a/webtests/browser_run.py b/webtests/browser_run.py index 7ee540b7..6cf46de5 100644 --- a/webtests/browser_run.py +++ b/webtests/browser_run.py @@ -9,7 +9,7 @@ from selenium import webdriver from selenium.common.exceptions import NoSuchElementException, ElementNotVisibleException from selenium.webdriver.common.keys import Keys -class Test(object): +class Test: def __init__(self): #self.browser = webdriver.Chrome('/home/gn2/gn2/webtests/chromedriver') self.browser = webdriver.Firefox() diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 1ae138d2..3183363b 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -220,7 +220,7 @@ def create_datasets_list(): return datasets -class Markers(object): +class Markers: """Todo: Build in cacheing so it saves us reading the same file more than once""" def __init__(self, name): @@ -316,7 +316,7 @@ class HumanMarkers(Markers): super(HumanMarkers, self).add_pvalues(p_values) -class DatasetGroup(object): +class DatasetGroup: """ Each group has multiple datasets; each species has multiple groups. @@ -540,7 +540,7 @@ def datasets(group_name, this_group=None): return dataset_menu -class DataSet(object): +class DataSet: """ DataSet class defines a dataset in webqtl, can be either Microarray, Published phenotype, genotype, or user input dataset(temp) diff --git a/wqflask/base/mrna_assay_tissue_data.py b/wqflask/base/mrna_assay_tissue_data.py index f1929518..1f8224af 100644 --- a/wqflask/base/mrna_assay_tissue_data.py +++ b/wqflask/base/mrna_assay_tissue_data.py @@ -11,7 +11,7 @@ from utility.db_tools import escape from utility.logger import getLogger logger = getLogger(__name__ ) -class MrnaAssayTissueData(object): +class MrnaAssayTissueData: def __init__(self, gene_symbols=None): self.gene_symbols = gene_symbols diff --git a/wqflask/base/species.py b/wqflask/base/species.py index 2771d116..eae3325a 100644 --- a/wqflask/base/species.py +++ b/wqflask/base/species.py @@ -6,7 +6,7 @@ from flask import Flask, g from utility.logger import getLogger logger = getLogger(__name__ ) -class TheSpecies(object): +class TheSpecies: def __init__(self, dataset=None, species_name=None): if species_name != None: self.name = species_name @@ -15,7 +15,7 @@ class TheSpecies(object): self.dataset = dataset self.chromosomes = Chromosomes(dataset=self.dataset) -class IndChromosome(object): +class IndChromosome: def __init__(self, name, length): self.name = name self.length = length @@ -25,7 +25,7 @@ class IndChromosome(object): """Chromosome length in megabases""" return self.length / 1000000 -class Chromosomes(object): +class Chromosomes: def __init__(self, dataset=None, species=None): self.chromosomes = collections.OrderedDict() if species != None: diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index a9223a32..968b6d4b 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -51,7 +51,7 @@ def create_trait(**kw): return None -class GeneralTrait(object): +class GeneralTrait: """ Trait class defines a trait in webqtl, can be either Microarray, Published phenotype, genotype, or user input trait diff --git a/wqflask/maintenance/convert_geno_to_bimbam.py b/wqflask/maintenance/convert_geno_to_bimbam.py index d49742f2..0853b3ac 100644 --- a/wqflask/maintenance/convert_geno_to_bimbam.py +++ b/wqflask/maintenance/convert_geno_to_bimbam.py @@ -22,7 +22,7 @@ from pprint import pformat as pf class EmptyConfigurations(Exception): pass -class Marker(object): +class Marker: def __init__(self): self.name = None self.chr = None @@ -30,7 +30,7 @@ class Marker(object): self.Mb = None self.genotypes = [] -class ConvertGenoFile(object): +class ConvertGenoFile: def __init__(self, input_file, output_files): self.input_file = input_file diff --git a/wqflask/maintenance/generate_kinship_from_bimbam.py b/wqflask/maintenance/generate_kinship_from_bimbam.py index 60257b28..3e4d1741 100644 --- a/wqflask/maintenance/generate_kinship_from_bimbam.py +++ b/wqflask/maintenance/generate_kinship_from_bimbam.py @@ -13,7 +13,7 @@ sys.path.append("..") import os import glob -class GenerateKinshipMatrices(object): +class GenerateKinshipMatrices: def __init__(self, group_name, geno_file, pheno_file): self.group_name = group_name self.geno_file = geno_file diff --git a/wqflask/maintenance/geno_to_json.py b/wqflask/maintenance/geno_to_json.py index 7e7fd241..f5f7e0e7 100644 --- a/wqflask/maintenance/geno_to_json.py +++ b/wqflask/maintenance/geno_to_json.py @@ -29,7 +29,7 @@ class EmptyConfigurations(Exception): pass -class Marker(object): +class Marker: def __init__(self): self.name = None self.chr = None @@ -37,7 +37,7 @@ class Marker(object): self.Mb = None self.genotypes = [] -class ConvertGenoFile(object): +class ConvertGenoFile: def __init__(self, input_file, output_file): diff --git a/wqflask/maintenance/print_benchmark.py b/wqflask/maintenance/print_benchmark.py index b24ce4f1..a1046c86 100644 --- a/wqflask/maintenance/print_benchmark.py +++ b/wqflask/maintenance/print_benchmark.py @@ -5,7 +5,7 @@ import time from pprint import pformat as pf -class TheCounter(object): +class TheCounter: Counters = {} def __init__(self): diff --git a/wqflask/utility/__init__.py b/wqflask/utility/__init__.py index 204ff59a..df926884 100644 --- a/wqflask/utility/__init__.py +++ b/wqflask/utility/__init__.py @@ -2,7 +2,7 @@ from pprint import pformat as pf # Todo: Move these out of __init__ -class Bunch(object): +class Bunch: """Like a dictionary but using object notation""" def __init__(self, **kw): self.__dict__ = kw @@ -11,7 +11,7 @@ class Bunch(object): return pf(self.__dict__) -class Struct(object): +class Struct: '''The recursive class for building and representing objects with. From http://stackoverflow.com/a/6573827/1175849 diff --git a/wqflask/utility/benchmark.py b/wqflask/utility/benchmark.py index ea5a0ab6..91ea91e8 100644 --- a/wqflask/utility/benchmark.py +++ b/wqflask/utility/benchmark.py @@ -6,7 +6,7 @@ from utility.tools import LOG_BENCH from utility.logger import getLogger logger = getLogger(__name__ ) -class Bench(object): +class Bench: entries = collections.OrderedDict() def __init__(self, name=None, write_output=LOG_BENCH): diff --git a/wqflask/utility/gen_geno_ob.py b/wqflask/utility/gen_geno_ob.py index 81085ffe..0a381c9b 100644 --- a/wqflask/utility/gen_geno_ob.py +++ b/wqflask/utility/gen_geno_ob.py @@ -1,7 +1,7 @@ import utility.logger logger = utility.logger.getLogger(__name__ ) -class genotype(object): +class genotype: """ Replacement for reaper.Dataset so we can remove qtlreaper use while still generating mapping output figure """ @@ -119,7 +119,7 @@ class genotype(object): self.chromosomes.append(chr_ob) -class Chr(object): +class Chr: def __init__(self, name, geno_ob): self.name = name self.loci = [] @@ -140,7 +140,7 @@ class Chr(object): def add_marker(self, marker_row): self.loci.append(Locus(self.geno_ob, marker_row)) -class Locus(object): +class Locus: def __init__(self, geno_ob, marker_row = None): self.chr = None self.name = None diff --git a/wqflask/utility/genofile_parser.py b/wqflask/utility/genofile_parser.py index 0b736176..f8e96d19 100644 --- a/wqflask/utility/genofile_parser.py +++ b/wqflask/utility/genofile_parser.py @@ -12,7 +12,7 @@ import simplejson as json from pprint import pformat as pf -class Marker(object): +class Marker: def __init__(self): self.name = None self.chr = None @@ -21,7 +21,7 @@ class Marker(object): self.genotypes = [] -class ConvertGenoFile(object): +class ConvertGenoFile: def __init__(self, input_file): self.mb_exists = False diff --git a/wqflask/utility/temp_data.py b/wqflask/utility/temp_data.py index 4144ae00..b2cbd458 100644 --- a/wqflask/utility/temp_data.py +++ b/wqflask/utility/temp_data.py @@ -2,7 +2,7 @@ from redis import Redis import simplejson as json -class TempData(object): +class TempData: def __init__(self, temp_uuid): self.temp_uuid = temp_uuid diff --git a/wqflask/wqflask/comparison_bar_chart/comparison_bar_chart.py b/wqflask/wqflask/comparison_bar_chart/comparison_bar_chart.py index 92de6073..5855ccf0 100644 --- a/wqflask/wqflask/comparison_bar_chart/comparison_bar_chart.py +++ b/wqflask/wqflask/comparison_bar_chart/comparison_bar_chart.py @@ -31,7 +31,7 @@ from MySQLdb import escape_string as escape from flask import Flask, g -class ComparisonBarChart(object): +class ComparisonBarChart: def __init__(self, start_vars): trait_db_list = [trait.strip() for trait in start_vars['trait_list'].split(',')] diff --git a/wqflask/wqflask/correlation/corr_scatter_plot.py b/wqflask/wqflask/correlation/corr_scatter_plot.py index c87776bb..d5dc26f5 100644 --- a/wqflask/wqflask/correlation/corr_scatter_plot.py +++ b/wqflask/wqflask/correlation/corr_scatter_plot.py @@ -11,7 +11,7 @@ import numpy as np import utility.logger logger = utility.logger.getLogger(__name__ ) -class CorrScatterPlot(object): +class CorrScatterPlot: """Page that displays a correlation scatterplot with a line fitted to it""" def __init__(self, params): diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index fb4dc4f4..cb341e79 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -58,7 +58,7 @@ TISSUE_METHODS = [METHOD_TISSUE_PEARSON, METHOD_TISSUE_RANK] TISSUE_MOUSE_DB = 1 -class CorrelationResults(object): +class CorrelationResults: def __init__(self, start_vars): # get trait list from db (database name) # calculate correlation with Base vector and targets diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py index f77761d8..d0b4a156 100644 --- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py +++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py @@ -41,7 +41,7 @@ Redis = get_redis_conn() THIRTY_DAYS = 60 * 60 * 24 * 30 -class CorrelationMatrix(object): +class CorrelationMatrix: def __init__(self, start_vars): trait_db_list = [trait.strip() for trait in start_vars['trait_list'].split(',')] diff --git a/wqflask/wqflask/ctl/ctl_analysis.py b/wqflask/wqflask/ctl/ctl_analysis.py index 72b4f3a3..1556e370 100644 --- a/wqflask/wqflask/ctl/ctl_analysis.py +++ b/wqflask/wqflask/ctl/ctl_analysis.py @@ -39,7 +39,7 @@ r_write_table = ro.r["write.table"] # Map the write.table function r_data_frame = ro.r["data.frame"] # Map the write.table function r_as_numeric = ro.r["as.numeric"] # Map the write.table function -class CTL(object): +class CTL: def __init__(self): logger.info("Initialization of CTL") #log = r_file("/tmp/genenetwork_ctl.log", open = "wt") diff --git a/wqflask/wqflask/db_info.py b/wqflask/wqflask/db_info.py index f420b472..25e624ef 100644 --- a/wqflask/wqflask/db_info.py +++ b/wqflask/wqflask/db_info.py @@ -10,7 +10,7 @@ from utility.logger import getLogger logger = getLogger(__name__) -class InfoPage(object): +class InfoPage: def __init__(self, start_vars): self.info = None self.gn_accession_id = None diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py index 00636563..364a3eed 100644 --- a/wqflask/wqflask/do_search.py +++ b/wqflask/wqflask/do_search.py @@ -17,7 +17,7 @@ from utility.logger import getLogger logger = getLogger(__name__) -class DoSearch(object): +class DoSearch: """Parent class containing parameters/functions used for all searches""" # Used to translate search phrases into classes diff --git a/wqflask/wqflask/docs.py b/wqflask/wqflask/docs.py index 23fc3cad..207767c4 100644 --- a/wqflask/wqflask/docs.py +++ b/wqflask/wqflask/docs.py @@ -5,7 +5,7 @@ from flask import g from utility.logger import getLogger logger = getLogger(__name__) -class Docs(object): +class Docs: def __init__(self, entry, start_vars={}): sql = """ diff --git a/wqflask/wqflask/external_tools/send_to_bnw.py b/wqflask/wqflask/external_tools/send_to_bnw.py index efa17f05..c5c79e98 100644 --- a/wqflask/wqflask/external_tools/send_to_bnw.py +++ b/wqflask/wqflask/external_tools/send_to_bnw.py @@ -24,7 +24,7 @@ from utility import helper_functions, corr_result_helpers import utility.logger logger = utility.logger.getLogger(__name__ ) -class SendToBNW(object): +class SendToBNW: def __init__(self, start_vars): trait_db_list = [trait.strip() for trait in start_vars['trait_list'].split(',')] helper_functions.get_trait_db_obs(self, trait_db_list) diff --git a/wqflask/wqflask/external_tools/send_to_geneweaver.py b/wqflask/wqflask/external_tools/send_to_geneweaver.py index 4c958a88..47e4c53a 100644 --- a/wqflask/wqflask/external_tools/send_to_geneweaver.py +++ b/wqflask/wqflask/external_tools/send_to_geneweaver.py @@ -29,7 +29,7 @@ from utility import helper_functions, corr_result_helpers import utility.logger logger = utility.logger.getLogger(__name__ ) -class SendToGeneWeaver(object): +class SendToGeneWeaver: def __init__(self, start_vars): trait_db_list = [trait.strip() for trait in start_vars['trait_list'].split(',')] helper_functions.get_trait_db_obs(self, trait_db_list) diff --git a/wqflask/wqflask/external_tools/send_to_webgestalt.py b/wqflask/wqflask/external_tools/send_to_webgestalt.py index 2f068792..e1e5e655 100644 --- a/wqflask/wqflask/external_tools/send_to_webgestalt.py +++ b/wqflask/wqflask/external_tools/send_to_webgestalt.py @@ -29,7 +29,7 @@ from utility import helper_functions, corr_result_helpers import utility.logger logger = utility.logger.getLogger(__name__ ) -class SendToWebGestalt(object): +class SendToWebGestalt: def __init__(self, start_vars): trait_db_list = [trait.strip() for trait in start_vars['trait_list'].split(',')] helper_functions.get_trait_db_obs(self, trait_db_list) diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py index 907f1180..9bf23d57 100644 --- a/wqflask/wqflask/gsearch.py +++ b/wqflask/wqflask/gsearch.py @@ -18,7 +18,7 @@ from utility.type_checking import is_float, is_int, is_str, get_float, get_int, from utility.logger import getLogger logger = getLogger(__name__) -class GSearch(object): +class GSearch: def __init__(self, kw): assert('type' in kw) diff --git a/wqflask/wqflask/heatmap/heatmap.py b/wqflask/wqflask/heatmap/heatmap.py index cca5a4fc..20e3559a 100644 --- a/wqflask/wqflask/heatmap/heatmap.py +++ b/wqflask/wqflask/heatmap/heatmap.py @@ -14,7 +14,7 @@ Redis = Redis() logger = getLogger(__name__ ) -class Heatmap(object): +class Heatmap: def __init__(self, start_vars, temp_uuid): trait_db_list = [trait.strip() for trait in start_vars['trait_list'].split(',')] diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index 6a5fe2f6..4074f098 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -152,7 +152,7 @@ class HtmlGenWrapper: return map_ -class DisplayMappingResults(object): +class DisplayMappingResults: """Inteval Mapping Plot Page""" cMGraphInterval = 5 GRAPH_MIN_WIDTH = 900 diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index 8f051c14..7dd0bcb6 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -45,7 +45,7 @@ from base.webqtlConfig import TMPDIR, GENERATED_TEXT_DIR import utility.logger logger = utility.logger.getLogger(__name__ ) -class RunMapping(object): +class RunMapping: def __init__(self, start_vars, temp_uuid): helper_functions.get_species_dataset_trait(self, start_vars) diff --git a/wqflask/wqflask/network_graph/network_graph.py b/wqflask/wqflask/network_graph/network_graph.py index 1d5316a2..f5ee5303 100644 --- a/wqflask/wqflask/network_graph/network_graph.py +++ b/wqflask/wqflask/network_graph/network_graph.py @@ -28,7 +28,7 @@ from utility import corr_result_helpers from utility.tools import GN2_BRANCH_URL -class NetworkGraph(object): +class NetworkGraph: def __init__(self, start_vars): trait_db_list = [trait.strip() diff --git a/wqflask/wqflask/news.py b/wqflask/wqflask/news.py index 0675ec4b..861a93f2 100644 --- a/wqflask/wqflask/news.py +++ b/wqflask/wqflask/news.py @@ -1,6 +1,6 @@ from flask import g -class News(object): +class News: def __init__(self): sql = """ diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index f23c0582..36500a8d 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -24,7 +24,7 @@ from utility.type_checking import is_str from utility.logger import getLogger logger = getLogger(__name__ ) -class SearchResultPage(object): +class SearchResultPage: #maxReturn = 3000 def __init__(self, kw): diff --git a/wqflask/wqflask/server_side.py b/wqflask/wqflask/server_side.py index 5f764767..48761fa0 100644 --- a/wqflask/wqflask/server_side.py +++ b/wqflask/wqflask/server_side.py @@ -2,7 +2,7 @@ -class ServerSideTable(object): +class ServerSideTable: """ This class is used to do server-side processing on the DataTables table such as paginating, sorting, diff --git a/wqflask/wqflask/show_trait/SampleList.py b/wqflask/wqflask/show_trait/SampleList.py index 857e4456..f955f632 100644 --- a/wqflask/wqflask/show_trait/SampleList.py +++ b/wqflask/wqflask/show_trait/SampleList.py @@ -8,7 +8,7 @@ from pprint import pformat as pf from utility import Plot from utility import Bunch -class SampleList(object): +class SampleList: def __init__(self, dataset, sample_names, diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index e5e94c7e..f9c5fbe6 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -35,8 +35,7 @@ logger = getLogger(__name__) ############################################## -class ShowTrait(object): - +class ShowTrait: def __init__(self, kw): if 'trait_id' in kw and kw['dataset'] != "Temp": self.temp_trait = False @@ -54,7 +53,8 @@ class ShowTrait(object): self.dataset = data_set.create_dataset( dataset_name="Temp", dataset_type="Temp", group_name=self.temp_group) - # Put values in Redis so they can be looked up later if added to a collection + # Put values in Redis so they can be looked up later if + # added to a collection Redis.set(self.trait_id, kw['trait_paste'], ex=ONE_YEAR) self.trait_vals = kw['trait_paste'].split() self.this_trait = create_trait(dataset=self.dataset, diff --git a/wqflask/wqflask/snp_browser/snp_browser.py b/wqflask/wqflask/snp_browser/snp_browser.py index a52399a2..8658abf8 100644 --- a/wqflask/wqflask/snp_browser/snp_browser.py +++ b/wqflask/wqflask/snp_browser/snp_browser.py @@ -9,7 +9,7 @@ logger = getLogger(__name__) from base import species from base import webqtlConfig -class SnpBrowser(object): +class SnpBrowser: def __init__(self, start_vars): self.strain_lists = get_browser_sample_lists() diff --git a/wqflask/wqflask/update_search_results.py b/wqflask/wqflask/update_search_results.py index 672f95b1..22a46ef2 100644 --- a/wqflask/wqflask/update_search_results.py +++ b/wqflask/wqflask/update_search_results.py @@ -10,7 +10,7 @@ from utility.benchmark import Bench from utility.logger import getLogger logger = getLogger(__name__) -class GSearch(object): +class GSearch: def __init__(self, kw): self.type = kw['type'] diff --git a/wqflask/wqflask/user_manager.py b/wqflask/wqflask/user_manager.py index 7b25b68e..fcec3b67 100644 --- a/wqflask/wqflask/user_manager.py +++ b/wqflask/wqflask/user_manager.py @@ -58,7 +58,7 @@ def timestamp(): return datetime.datetime.utcnow().isoformat() -class AnonUser(object): +class AnonUser: """Anonymous user handling""" cookie_name = 'anon_user_v1' @@ -158,7 +158,7 @@ def create_signed_cookie(): logger.debug("uuid_signed:", uuid_signed) return the_uuid, uuid_signed -class UserSession(object): +class UserSession: """Logged in user handling""" cookie_name = 'session_id_v1' @@ -353,12 +353,12 @@ def set_cookie(response): response.set_cookie(g.cookie_session.cookie_name, g.cookie_session.cookie) return response -class UsersManager(object): +class UsersManager: def __init__(self): self.users = model.User.query.all() logger.debug("Users are:", self.users) -class UserManager(object): +class UserManager: def __init__(self, kw): self.user_id = kw['user_id'] logger.debug("In UserManager locals are:", pf(locals())) @@ -377,7 +377,7 @@ class UserManager(object): #logger.debug(" ---> self.datasets:", self.datasets) -class RegisterUser(object): +class RegisterUser: def __init__(self, kw): self.thank_you_mode = False self.errors = [] @@ -454,7 +454,7 @@ def set_password(password, user): ) -class VerificationEmail(object): +class VerificationEmail: template_name = "email/verification.txt" key_prefix = "verification_code" subject = "GeneNetwork email verification" @@ -511,7 +511,7 @@ class ForgotPasswordEmail(VerificationEmail): send_email(toaddr, msg.as_string()) -class Password(object): +class Password: def __init__(self, unencrypted_password, salt, iterations, keylength, hashfunc): hashfunc = getattr(hashlib, hashfunc) logger.debug("hashfunc is:", hashfunc) @@ -589,7 +589,7 @@ def password_reset_step2(): return response -class DecodeUser(object): +class DecodeUser: def __init__(self, code_prefix): verify_url_hmac(request.url) @@ -695,7 +695,7 @@ def get_github_user_details(access_token): result = requests.get(GITHUB_API_URL, params={"access_token":access_token}) return result.json() -class LoginUser(object): +class LoginUser: remember_time = 60 * 60 * 24 * 30 # One month in seconds def __init__(self): @@ -1039,12 +1039,12 @@ def send_email(toaddr, msg, fromaddr="no-reply@genenetwork.org"): server.quit() logger.info("Successfully sent email to "+toaddr) -class GroupsManager(object): +class GroupsManager: def __init__(self, kw): self.datasets = create_datasets_list() -class RolesManager(object): +class RolesManager: def __init__(self): self.roles = model.Role.query.all() logger.debug("Roles are:", self.roles) diff --git a/wqflask/wqflask/user_session.py b/wqflask/wqflask/user_session.py index c5a577df..cc0ac744 100644 --- a/wqflask/wqflask/user_session.py +++ b/wqflask/wqflask/user_session.py @@ -63,7 +63,7 @@ def manage_user(): return render_template("admin/manage_user.html", user_details = user_details) -class UserSession(object): +class UserSession: """Logged in user handling""" user_cookie_name = 'session_id_v2' diff --git a/wqflask/wqflask/wgcna/wgcna_analysis.py b/wqflask/wqflask/wgcna/wgcna_analysis.py index 6bf75216..21516b30 100644 --- a/wqflask/wqflask/wgcna/wgcna_analysis.py +++ b/wqflask/wqflask/wgcna/wgcna_analysis.py @@ -42,7 +42,7 @@ r_png = ro.r["png"] # Map the png function for plotting r_dev_off = ro.r["dev.off"] # Map the dev.off function -class WGCNA(object): +class WGCNA: def __init__(self): # To log output from stdout/stderr to a file add `r_sink(log)` print("Initialization of WGCNA") -- cgit v1.2.3 From 799b25481fffc97e2adb07004adf502096bf371c Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Fri, 30 Apr 2021 13:25:22 +0300 Subject: webtests: Delete it These are no longer used --- webtests/browser_run.py | 72 ------------------------------------ webtests/chromedriver | Bin 17741222 -> 0 bytes webtests/correlation_matrix_test.py | 70 ----------------------------------- webtests/correlation_test.py | 49 ------------------------ webtests/libpeerconnection.log | 0 webtests/marker_regression_test.py | 53 -------------------------- webtests/show_trait_js_test.py | 40 -------------------- webtests/test_runner.py | 26 ------------- 8 files changed, 310 deletions(-) delete mode 100644 webtests/browser_run.py delete mode 100644 webtests/chromedriver delete mode 100644 webtests/correlation_matrix_test.py delete mode 100644 webtests/correlation_test.py delete mode 100644 webtests/libpeerconnection.log delete mode 100644 webtests/marker_regression_test.py delete mode 100644 webtests/show_trait_js_test.py delete mode 100644 webtests/test_runner.py (limited to 'webtests') diff --git a/webtests/browser_run.py b/webtests/browser_run.py deleted file mode 100644 index 6cf46de5..00000000 --- a/webtests/browser_run.py +++ /dev/null @@ -1,72 +0,0 @@ -__all__ = ('sleep', 'testmod', 'test') - -from doctest import testmod - -from time import sleep - -import selenium -from selenium import webdriver -from selenium.common.exceptions import NoSuchElementException, ElementNotVisibleException -from selenium.webdriver.common.keys import Keys - -class Test: - def __init__(self): - #self.browser = webdriver.Chrome('/home/gn2/gn2/webtests/chromedriver') - self.browser = webdriver.Firefox() - - def get(self, url): - self.browser.get(url) - sleep(5) - self.title() - - def click(self, xpath_selector): - el = self.browser.find_element_by_xpath(xpath_selector) - if el.text: - text = el.text.strip() - elif el.get_attribute("value"): - text = el.get_attribute("value").strip() - else: - text = "Notext" - el.click() - print("clicked:", text) - sleep(2) - - def click_option(self, xpath_selector, option_text): - el = self.browser.find_element_by_xpath(xpath_selector) - for option in el.find_elements_by_tag_name('option'): - if option.text == option_text: - option.click() # select() in earlier versions of webdriver - break - sleep(2) - - def enter_text(self, xpath_selector, text): - el = self.browser.find_element_by_xpath(xpath_selector) - sleep(10) - el.send_keys(text) - sleep(5) - # Just in case things get mangled by JavaScript, etc. we print the text for testing - self.get_text(xpath_selector) - - def get_text(self, xpath_selector): - el = self.browser.find_element_by_xpath(xpath_selector) - text = el.text.strip() or el.get_attribute("value").strip() - print("text:", text) - - def get_element_style(self, xpath_selector): - el = self.browser.find_element_by_xpath(xpath_selector) - style = el.get_attribute("style").strip() - print("style:", style) - - def switch_window(self): - self.browser.switch_to_window(self.browser.window_handles[-1]) - sleep(2) - self.title() - sleep(2) - - - def title(self): - print("title:", self.browser.title) - - - -test = Test() diff --git a/webtests/chromedriver b/webtests/chromedriver deleted file mode 100644 index 754eb668..00000000 Binary files a/webtests/chromedriver and /dev/null differ diff --git a/webtests/correlation_matrix_test.py b/webtests/correlation_matrix_test.py deleted file mode 100644 index 97114890..00000000 --- a/webtests/correlation_matrix_test.py +++ /dev/null @@ -1,70 +0,0 @@ -""" - -Test Correlation matrix - ->>> test.get("http://genenetwork.org/") -title: GeneNetwork - -Choose the type ->>> test.click_option('''//*[@id="tissue"]''', 'Hippocampus mRNA') - -Enter the Get Any ->>> test.enter_text('''//*[@id="tfor"]''', 'grin2b') -text: grin2b - -Search ->>> test.click('//*[@id="btsearch"]') -clicked: Search - -Add 1430675_at ->>> test.click('''/html/body/table/tbody/tr[3]/td/table/tbody/tr/td/form/p/table/tbody/tr[3]/td/div/table/tbody/tr[2]/td/input''') -clicked: HC_M2_0606_P::1430675_at - -Add 1442370_at ->>> test.click('''/html/body/table/tbody/tr[3]/td/table/tbody/tr/td/form/p/table/tbody/tr[3]/td/div/table/tbody/tr[3]/td/input''') -clicked: HC_M2_0606_P::1442370_at - -Add 1457003_at ->>> test.click('''/html/body/table/tbody/tr[3]/td/table/tbody/tr/td/form/p/table/tbody/tr[3]/td/div/table/tbody/tr[4]/td/input''') -clicked: HC_M2_0606_P::1457003_at - -Add 1422223_at ->>> test.click('''/html/body/table/tbody/tr[3]/td/table/tbody/tr/td/form/p/table/tbody/tr[3]/td/div/table/tbody/tr[5]/td/input''') -clicked: HC_M2_0606_P::1422223_at - ->>> sleep(5) - -Add to collection page ->>> test.click('''/html/body/table/tbody/tr[3]/td/table/tbody/tr/td/form/p/table/tbody/tr[1]/td/table/tbody/tr[1]/td[4]/a''') -clicked: Notext - ->>> sleep(5) - -A new window is created, so we switch to it ->>> test.switch_window() -title: BXD Trait Collection - -Select all records ->>> test.click('''/html/body/table/tbody/tr[3]/td/table/tbody/tr/td/form/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr/td/a/img''') -clicked: Notext - -Click Matrix ->>> test.click('''/html/body/table/tbody/tr[3]/td/table/tbody/tr/td/form/table/tbody/tr/td/table/tbody/tr[2]/td/table/tbody/tr/td[2]/a/img''') -clicked: Notext - -Another new window ->>> test.switch_window() -title: Correlation Matrix - -Sleep a bunch because this can take a while ->>> sleep(10) - -Ensure that the correlation between Trait3 (HC_M2_0606_P::1457003_at) and Trait4 (HC_M2_0606_P::1422223_at) is 0.608 ->>> test.get_text('''/html/body/table/tbody/tr[3]/td/table/tbody/tr/td/form/blockquote/table/tbody/tr[5]/td[5]/a/font''') -text: 0.608\n71 - -""" - -from browser_run import * - -testmod() diff --git a/webtests/correlation_test.py b/webtests/correlation_test.py deleted file mode 100644 index 311bb847..00000000 --- a/webtests/correlation_test.py +++ /dev/null @@ -1,49 +0,0 @@ -""" -Test calculate correlations - ->>> test.get("http://genenetwork.org") -title: GeneNetwork - -Choose the type ->>> test.click_option('''//*[@id="tissue"]''', 'Hippocampus mRNA') - -Enter the Get Any ->>> test.enter_text('''//*[@id="tfor"]''', 'ssh') -text: ssh - -Search ->>> test.click('//*[@id="btsearch"]') -clicked: Search - -Choose the first result ->>> test.click('''/html/body/table/tbody/tr[3]/td/table/tbody/tr/td/form/p/table/tbody/tr[3]/td/div/table/tbody/tr[2]/td[2]/a''') -clicked: 1455854_a_at - -A new window is created, so we switch to it ->>> test.switch_window() -title: Hippocampus M430v2 BXD 06/06 PDNN : 1455854_a_at: Display Trait - -Click on Calculate Correlations ->>> test.click('''//*[@id="title3"]''') -clicked: Calculate Correlations - -Click on Compute ->>> test.click('''/html/body/table/tbody/tr[3]/td/table/tbody/tr/td/form/p[6]/table/tbody/tr/td/div/div/span/table/tbody/tr/td/input[3]''') -clicked: Compute - -Another new window ->>> test.switch_window() -title: Correlation - -Sleep a bunch because this can take a while ->>> sleep(25) - -Ensure the Sample rho is the exepcted 1.000 because it should be the same record ->>> test.get_text('''/html/body/table/tbody/tr[3]/td/table/tbody/tr/td/form/table/tbody/tr[2]/td/div/table/tbody/tr[2]/td[9]/a''') -text: 1.000 - -""" - -from browser_run import * - -testmod() diff --git a/webtests/libpeerconnection.log b/webtests/libpeerconnection.log deleted file mode 100644 index e69de29b..00000000 diff --git a/webtests/marker_regression_test.py b/webtests/marker_regression_test.py deleted file mode 100644 index 9b4a4acb..00000000 --- a/webtests/marker_regression_test.py +++ /dev/null @@ -1,53 +0,0 @@ -""" -Test calculate correlations - ->>> test.get("http://genenetwork.org") -title: GeneNetwork - -Choose the type ->>> test.click_option('''//*[@id="tissue"]''', 'Liver mRNA') - -Enter the Get Any ->>> test.enter_text('''//*[@id="tfor"]''', 'grin2b') -text: grin2b - -Search ->>> test.click('//*[@id="btsearch"]') -clicked: Search - -Choose the second result ->>> test.click('''/html/body/table/tbody/tr[3]/td/table/tbody/tr/td/form/p/table/tbody/tr[3]/td/div/table/tbody/tr[3]/td[2]/a''') -clicked: 1431700_at_A - -A new window is created, so we switch to it ->>> test.switch_window() -title: GSE16780 UCLA Hybrid MDP Liver Affy HT M430A (Sep11) RMA : 1431700_at_A: Display Trait - -Click on Mapping Tools ->>> test.click('''//*[@id="title4"]''') -clicked: Mapping Tools - -Click on Marker Regression tab ->>> test.click('''//*[@id="mapping_tabs"]/ul/li[2]/a''') -clicked: Marker Regression - -Click on Compute ->>> test.click('''//*[@id="mappingtabs-2"]/span/table/tbody/tr[1]/td/input''') -clicked: Compute - -Another new window ->>> test.switch_window() -title: Genome Association Result - -Sleep a bunch because this can take a while ->>> sleep(60) - -Ensure that the LRS of the top record is the exepcted value ->>> test.get_text('''//*[@id="1"]/td[2]''') -text: 11.511 - -""" - -from browser_run import * - -testmod() diff --git a/webtests/show_trait_js_test.py b/webtests/show_trait_js_test.py deleted file mode 100644 index 34ffd3b7..00000000 --- a/webtests/show_trait_js_test.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -Test if JS is working on the show trait page - ->>> test.get("alexandria.uthsc.edu:89") -title: GeneNetwork - -Choose the species ->>> test.click_option('''//*[@id="species"]''', 'Human') - -Choose the group ->>> test.click_option('''//*[@id="cross"]''', 'Human Brain Transcriptome (Yale/Kavli)') - -Choose the type ->>> test.click_option('''//*[@id="tissue"]''', 'Orbital Prefrontal Cortex mRNA') - -Enter the Get Any ->>> test.enter_text('''//*[@id="tfor"]''', 'shh') -text: shh - -Search ->>> test.click('//*[@id="btsearch"]') -clicked: Search - -Choose the first result ->>> test.click('''//*[@id="KIN_YSM_OFC_0711::3081205"]/td[2]/a''') -clicked: 3081205 - -A new window is created, so we switch to it ->>> test.switch_window() -title: KIN/YSM Human OFC Affy Hu-Exon 1.0 ST (Jul11) Quantile : 3081205: Display Trait - -Check that the Calculate Correlations tab is closed (if javascript isn't working, it will be open) ->>> test.get_element_style('''//*[@id="sectionbody3"]''') -style: display: none; - -""" - -from browser_run import * - -testmod() diff --git a/webtests/test_runner.py b/webtests/test_runner.py deleted file mode 100644 index b5b590a6..00000000 --- a/webtests/test_runner.py +++ /dev/null @@ -1,26 +0,0 @@ -import unittest -import doctest -import glob - -tests = ("correlation_test", - "correlation_matrix_test", - "marker_regression_test", - "show_trait_js_test") - - -def main(): - tests = glob.glob("*_test.py") - - suite = unittest.TestSuite() - - for testname in tests: - test = testname.rsplit(".", 1)[0] - print("Test is:", test) - mod = __import__(test) - suite.addTest(doctest.DocTestSuite(mod)) - - runner = unittest.TextTestRunner() - runner.run(suite) - -if __name__ == '__main__': - main() -- cgit v1.2.3