Skip to content

Commit

Permalink
update docstrings and static typings
Browse files Browse the repository at this point in the history
  • Loading branch information
CunliangGeng committed Apr 17, 2024
1 parent 745733a commit 62178f1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/nplinker/scoring/metcalf_scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def setup(npl: NPLinker):

# TODO CG: is it needed? remove it if not
@property
def datalinks(self) -> DataLinks:
def datalinks(self) -> DataLinks | None:
"""Get the DataLinks object used for scoring."""
return MetcalfScoring.DATALINKS

def get_links(
Expand Down Expand Up @@ -311,10 +312,12 @@ def _calc_standardised_score_gen(

# TODO CG: refactor this method
def format_data(self, data):
"""Format the data for display."""
# for metcalf the data will just be a floating point value (i.e. the score)
return f"{data:.4f}"

# TODO CG: refactor this method
def sort(self, objects, reverse=True):
"""Sort the objects based on the score."""
# sort based on score
return sorted(objects, key=lambda objlink: objlink[self], reverse=reverse)

0 comments on commit 62178f1

Please sign in to comment.