Commit bb4ddf40 authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

black reformats

parent ab08df6c
Pipeline #37280 passed with stages
in 14 minutes and 6 seconds
......@@ -1495,21 +1495,14 @@ class ContributionManager(models.Manager):
if current_user.is_anonymous:
qs = qs.exclude(validated=False)
elif not current_user.is_superuser:
qs = qs.exclude(
Q(validated=False),
~Q(contributor=current_user),
)
qs = qs.exclude(Q(validated=False), ~Q(contributor=current_user),)
return qs
def validated(self):
"""
Get validated contributions
"""
return (
super()
.get_queryset()
.exclude(validated=False)
)
return super().get_queryset().exclude(validated=False)
class Contribution(models.Model):
......@@ -1814,9 +1807,7 @@ def update_compound_cached_properties(compounds_queryset=None):
)
.values("_bindtest_av")[:1]
),
pktest_av=Exists(
CompoundPKResult.objects.filter(id=OuterRef("id"))
),
pktest_av=Exists(CompoundPKResult.objects.filter(id=OuterRef("id"))),
cytoxtest_av=Exists(
CompoundCytotoxicityResult.objects.filter(id=OuterRef("id"))
),
......
......@@ -625,7 +625,7 @@ def launch_validate_contributions(contribution_ids: List[int]):
run_update_compound_cached_properties.s(),
run_compute_drugbank_similarity.s(),
run_validate.s(),
)
),
)
contribution_jobs.append(compounds_properties_computation_group)
# compounds_properties_computation_group.delay()
......
......@@ -6,7 +6,14 @@ import re
from django.test import TestCase
from openbabel import vectorUnsignedInt, OBFingerprint
from ippidb.utils import FingerPrinter, mol2smi, smi2mol, smi2inchi, smi2inchikey, smi2sdf
from ippidb.utils import (
FingerPrinter,
mol2smi,
smi2mol,
smi2inchi,
smi2inchikey,
smi2sdf,
)
class MolSmiTestCase(TestCase):
......
......@@ -106,7 +106,10 @@ def about_pharmacology(request):
drugbank_compounds_per_ppi_family = convert_to_bar_chart_data(
drugbank_compounds_per_ppi_family_raw
)
ppi_family_labels = {entry['name']: entry['id'] for entry in PpiFamily.objects.values(*['id', 'name'])}
ppi_family_labels = {
entry["name"]: entry["id"]
for entry in PpiFamily.objects.values(*["id", "name"])
}
context = {
"biochemical_tests_count_by_name": biochemical_tests_count_by_name,
"cellular_tests_count_by_name": cellular_tests_count_by_name,
......
......@@ -561,9 +561,7 @@ class IppiWizard(
f"Congratulations! Dear {contribution.contributor.username},"
f" thank you for your contribution.",
)
return redirect(
reverse("contribution-detail", kwargs={"pk": contribution.pk})
)
return redirect(reverse("contribution-detail", kwargs={"pk": contribution.pk}))
def get(self, *args, **kwargs):
"""
......
......@@ -397,7 +397,7 @@ def get_pdb_pfam_mapping(pdb_id: str) -> dict:
resp = requests.get(
"https://www.ebi.ac.uk/pdbe/api/mappings/pfam/{}".format(pdb_id.lower())
)
if "application/json" not in resp.headers.get('content-type'):
if "application/json" not in resp.headers.get("content-type"):
raise EntryNotFoundError(pdb_id, resp.status_code)
all_pfam = resp.json()[pdb_id]["Pfam"]
for pfam in all_pfam.values():
......
......@@ -21,7 +21,8 @@ class MonitorTask(Task):
tasks = TaskResult.objects.filter(
task_name=self.request.task,
status__in=[states.STARTED, states.PENDING, states.RETRY, states.RECEIVED],
task_args=str(args), task_kwargs=str(kwargs)
task_args=str(args),
task_kwargs=str(kwargs),
)
count_tasks = tasks.count()
if not count_tasks:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment