diff options
Diffstat (limited to 'gn3')
-rw-r--r-- | gn3/api/search.py | 6 | ||||
-rw-r--r-- | gn3/auth/authentication/oauth2/endpoints/utilities.py | 3 | ||||
-rw-r--r-- | gn3/auth/authentication/oauth2/models/oauth2token.py | 3 | ||||
-rw-r--r-- | gn3/computations/partial_correlations.py | 6 | ||||
-rw-r--r-- | gn3/db/partial_correlations.py | 3 |
5 files changed, 11 insertions, 10 deletions
diff --git a/gn3/api/search.py b/gn3/api/search.py index aa844ee..c741b15 100644 --- a/gn3/api/search.py +++ b/gn3/api/search.py @@ -152,7 +152,8 @@ def parse_position_field(location_slot: int, query: bytes) -> xapian.Query: """Parse position and return a xapian query.""" start, end = parse_position(query.decode("utf-8")) # TODO: Convert the xapian index to use bases instead of megabases. - to_megabases = lambda x: str(Decimal(x)/10**6) + def to_megabases(val): + return str(Decimal(val)/10**6) return (xapian.NumberRangeProcessor(location_slot) (start.maybe("", to_megabases), end.maybe("", to_megabases))) # type: ignore @@ -176,7 +177,8 @@ def parse_location_field(species_query: xapian.Query, def make_query(interval: ChromosomalInterval) -> xapian.Query: # TODO: Convert the xapian index to use bases instead of megabases. - to_megabases = lambda x: str(Decimal(x)/10**6) + def to_megabases(val): + return str(Decimal(val)/10**6) return combine_queries(xapian.Query.OP_AND, species_query, xapian.Query(chromosome_prefix + interval.chromosome), diff --git a/gn3/auth/authentication/oauth2/endpoints/utilities.py b/gn3/auth/authentication/oauth2/endpoints/utilities.py index 299f151..e13784e 100644 --- a/gn3/auth/authentication/oauth2/endpoints/utilities.py +++ b/gn3/auth/authentication/oauth2/endpoints/utilities.py @@ -12,7 +12,8 @@ def query_token(# pylint: disable=[unused-argument] endpoint_object: Any, token_str: str, token_type_hint) -> Optional[ OAuth2Token]: """Retrieve the token from the database.""" - __identity__ = lambda val: val + def __identity__(val): + return val token = Nothing with db.connection(current_app.config["AUTH_DB"]) as conn: if token_type_hint == "access_token": diff --git a/gn3/auth/authentication/oauth2/models/oauth2token.py b/gn3/auth/authentication/oauth2/models/oauth2token.py index 72e20cc..bfe4aaf 100644 --- a/gn3/auth/authentication/oauth2/models/oauth2token.py +++ b/gn3/auth/authentication/oauth2/models/oauth2token.py @@ -51,7 +51,8 @@ class OAuth2Token(NamedTuple): return self.revoked def __token_from_resultset__(conn: db.DbConnection, rset) -> Maybe: - __identity__ = lambda val: val + def __identity__(val): + return val try: the_user = user_by_id(conn, uuid.UUID(rset["user_id"])) except NotFoundError as _nfe: diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 9f02ad2..6eee299 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -421,9 +421,7 @@ def literature_correlation_by_list( `web.webqtl.correlation.CorrelationPage.getLiteratureCorrelationByList` function in GeneNetwork1. """ - if any((lambda t: ( - bool(t.get("tissue_corr")) and - bool(t.get("tissue_p_value"))))(trait) + if any(bool(trait.get("tissue_corr")) and bool(trait.get("tissue_p_value")) for trait in trait_list): temporary_table_name = f"LITERATURE{random_string(8)}" query1 = ( @@ -491,7 +489,7 @@ def tissue_correlation_by_list( "tissue_p_value": result["p-val"] } - if any((lambda t: bool(t.get("l_corr")))(trait) for trait in trait_list): + if any(bool(trait.get("l_corr")) for trait in trait_list): prim_trait_symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( (primary_trait_symbol,), tissue_probeset_freeze_id, conn) if primary_trait_symbol.lower() in prim_trait_symbol_value_dict: diff --git a/gn3/db/partial_correlations.py b/gn3/db/partial_correlations.py index e8466f6..1368da0 100644 --- a/gn3/db/partial_correlations.py +++ b/gn3/db/partial_correlations.py @@ -422,8 +422,7 @@ def set_bxd(group_info): return { **group_info, "group": ( - "BXD" if group_info.get("Name") == "BXD300" - else group_info.get("Name", "")), + "BXD" if group_info.get("Name") == "BXD300" else group_info.get("Name", "")), "groupid": group_info["Id"] } |