Skip to content

Commit

Permalink
Linted, Formatted and fixed some function names.
Browse files Browse the repository at this point in the history
  • Loading branch information
fatimarabab committed Apr 24, 2024
1 parent 6c26e7f commit 2e3ceb8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
16 changes: 9 additions & 7 deletions backend/src/core/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,17 @@ def process_tasks(annotation_queue, genomic_unit_collection): # pylint: disable
# check if the version is latest
latest = False
if annotation_unit.version is latest:
logger.info('%s Annotation Exists with Latest Version...', format_annotation_logging(annotation_unit))
logger.info(
'%s Annotation Exists with Latest Version...', format_annotation_logging(annotation_unit)
)
ready = True
else:
# determine as version_annotation_type
# create version_annotation_task
# send version-url and attribute
# put this in background task

# determine as version_annotation_type
# create version_annotation_task
# send version-url and attribute
# put this in background task

ready = False
continue

Expand Down
26 changes: 14 additions & 12 deletions backend/src/core/annotation_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,38 +186,43 @@ def build_url(self):
Builds the URL from the base_url and then appends the list of query parameters for the list of datasets.
"""
return self.aggregate_string_replacements(self.dataset['url'])



class VersionAnnotationTask(AnnotationTaskInterface):
"""An annotation task that gets the version of the annotation"""

def __init__(self, genomic_unit_json: dict):
def __init__(self, genomic_unit_json):
"""initializes the task with the genomic_unit"""
AnnotationTaskInterface.__init__(genomic_unit_json)
AnnotationTaskInterface.__init__(self, genomic_unit_json)

def annotate(self):
"""placeholder for annotating a genomic unit with version"""
return "not-implemented"

def versioning_by_method(self, versioning_type):
"""Gets version by versioning type and returns the version data to the annotation unit"""
version = ""

if versioning_type == "rest":
version = self.get_version_from_rest()
version = self.get_annotation_version_from_rest()
elif versioning_type == "rosalution":
version = self.get_version_from_rosalution()
version = self.get_annotation_version_from_rosalution()
elif versioning_type == "date":
version = self.get_version_from_date()
version = self.get_annotation_version_from_date()
return version

def get_annotation_version_from_rest(self):
"""Gets version for rest type and returns the version data"""
version_from_rest = ""
# getting version from rest
return version_from_rest

def get_annotation_version_from_rosalution(self):
"""Gets version for rosalution type and returns the version data"""
version_from_rosalution = ""
# getting version from rosalution
return version_from_rosalution

def get_annotation_version_from_date(self):
"""Gets version for date type and returns the version data"""
version_from_date = ""
Expand All @@ -232,10 +237,7 @@ class AnnotationTaskFactory:
"""

tasks = {
"http": HttpAnnotationTask,
"csv": CsvAnnotationTask,
"none": NoneAnnotationTask,
"forge": ForgeAnnotationTask,
"http": HttpAnnotationTask, "csv": CsvAnnotationTask, "none": NoneAnnotationTask, "forge": ForgeAnnotationTask,
"version": VersionAnnotationTask
}

Expand Down
10 changes: 5 additions & 5 deletions backend/src/core/annotation_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ def to_name_string(self):
"""
return f"{self.get_genomic_unit} for {self.get_dataset}"

def set_latest_version(self, version_info):
self.version = version_info
def set_latest_version(self, version_details):
"""Sets the Annotation Unit with the version details"""
self.version = version_details

def version_exists(self):
"""Checks if the Annotation Unit is versioned or not"""
if self.version == "":
return True
else:
return False

return False

0 comments on commit 2e3ceb8

Please sign in to comment.