Skip to content

Commit

Permalink
add: typing
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetcanay committed Oct 23, 2024
1 parent 6229a90 commit bfb6404
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions datastew/repository/model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
from typing import Optional

import numpy as np
from sqlalchemy import Column, ForeignKey, Integer, String, Text
Expand All @@ -12,7 +13,7 @@ class Terminology(Base):
id = Column(String, primary_key=True)
name = Column(String)

def __init__(self, name: str, id: str) -> object:
def __init__(self, name: str, id: str):
self.name = name
self.id = id

Expand All @@ -25,7 +26,7 @@ class Concept(Base):
terminology = relationship("Terminology")
uuid = Column(String)

def __init__(self, terminology: Terminology, pref_label: str, concept_identifier: str, id: str = None) -> object:
def __init__(self, terminology: Terminology, pref_label: str, concept_identifier: str, id: Optional[str] = None):
self.terminology = terminology
self.pref_label = pref_label
# should be unique
Expand All @@ -43,7 +44,7 @@ class Mapping(Base):
embedding_json = Column(Text)
sentence_embedder = Column(Text)

def __init__(self, concept: Concept, text: str, embedding: list, sentence_embedder: str) -> object:
def __init__(self, concept: Concept, text: str, embedding: list, sentence_embedder: str):
self.concept = concept
self.text = text
if isinstance(embedding, np.ndarray):
Expand All @@ -56,4 +57,4 @@ def __str__(self):

@property
def embedding(self):
return json.loads(self.embedding_json)
return json.loads(str(self.embedding_json))

0 comments on commit bfb6404

Please sign in to comment.