diff options
author | BonfaceKilz | 2020-07-27 21:00:24 +0300 |
---|---|---|
committer | BonfaceKilz | 2020-07-27 21:00:24 +0300 |
commit | c1e22edf5f08b6d9c79a6608b8faf434578e246d (patch) | |
tree | d1ba4c6a62023259679682f33e20bbc307955ab2 /wqflask/base/webqtlCaseData.py | |
parent | 7732204662bf395eb8ed55b6d26fd208998c1067 (diff) | |
download | genenetwork2-c1e22edf5f08b6d9c79a6608b8faf434578e246d.tar.gz |
Clean up webqtlCaseData class
* wqflask/base/webqtlCaseData.py (webqtlCaseData):
- Remove obsolete 'Object' from Class inheritance
- Replace 'str' with 'case_data_string' variable- it collides with python in-builts
- Use pythonic 'is Not None' form
- Remove redundancy in 'if' forms
- Update copyright header
Diffstat (limited to 'wqflask/base/webqtlCaseData.py')
-rw-r--r-- | wqflask/base/webqtlCaseData.py | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/wqflask/base/webqtlCaseData.py b/wqflask/base/webqtlCaseData.py index d8487f01..2844cedd 100644 --- a/wqflask/base/webqtlCaseData.py +++ b/wqflask/base/webqtlCaseData.py @@ -19,8 +19,7 @@ # This module is used by GeneNetwork project (www.genenetwork.org) # # Created by GeneNetwork Core Team 2010/08/10 -# -# Last updated by GeneNetwork Core Team 2010/10/20 + from utility.logger import getLogger logger = getLogger(__name__) @@ -29,7 +28,7 @@ import utility.tools utility.tools.show_settings() -class webqtlCaseData(object): +class webqtlCaseData: """one case data in one trait""" def __init__(self, name, value=None, variance=None, num_cases=None, name2=None): @@ -43,44 +42,40 @@ class webqtlCaseData(object): self.outlier = None # Not set to True/False until later def __repr__(self): - str = "<webqtlCaseData> " - if self.value != None: - str += "value=%2.3f" % self.value - if self.variance != None: - str += " variance=%2.3f" % self.variance + case_data_string = "<webqtlCaseData> " + if self.value is not None: + case_data_string += "value=%2.3f" % self.value + if self.variance is not None: + case_data_string += " variance=%2.3f" % self.variance if self.num_cases: - str += " ndata=%s" % self.num_cases + case_data_string += " ndata=%s" % self.num_cases if self.name: - str += " name=%s" % self.name + case_data_string += " name=%s" % self.name if self.name2: - str += " name2=%s" % self.name2 - return str + case_data_string += " name2=%s" % self.name2 + return case_data_string @property def class_outlier(self): """Template helper""" if self.outlier: return "outlier" - else: - return "" + return "" @property def display_value(self): - if self.value != None: + if self.value is not None: return "%2.3f" % self.value - else: - return "x" + return "x" @property def display_variance(self): - if self.variance != None: + if self.variance is not None: return "%2.3f" % self.variance - else: - return "x" + return "x" @property def display_num_cases(self): - if self.num_cases != None: + if self.num_cases is not None: return "%s" % self.num_cases - else: - return "x" + return "x" |