Skip to content

Commit

Permalink
DH-4724/reformat with black
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadrezaPourreza committed Sep 27, 2023
1 parent c830f97 commit 463fe71
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
4 changes: 1 addition & 3 deletions dataherald/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ def get_golden_records(self, page: int = 1, limit: int = 10) -> List[GoldenRecor
pass

@abstractmethod
def add_instruction(
self, instruction_request: InstructionRequest
) -> Instruction:
def add_instruction(self, instruction_request: InstructionRequest) -> Instruction:
pass

@abstractmethod
Expand Down
6 changes: 2 additions & 4 deletions dataherald/api/fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,7 @@ def get_golden_records(self, page: int = 1, limit: int = 10) -> List[GoldenRecor
return all_records[start_idx:end_idx]

@override
def add_instruction(
self, instruction_request: InstructionRequest
) -> Instruction:
def add_instruction(self, instruction_request: InstructionRequest) -> Instruction:
instruction_repository = InstructionRepository(self.storage)
instruction = Instruction(
instruction=instruction_request.instruction,
Expand All @@ -342,7 +340,7 @@ def get_instructions(
return instruction_repository.find_all()

@override
def delete_instruction(self,instruction_id: str) -> dict:
def delete_instruction(self, instruction_id: str) -> dict:
instruction_repository = InstructionRepository(self.storage)
deleted = instruction_repository.delete_by_id(instruction_id)
if deleted == 0:
Expand Down
12 changes: 3 additions & 9 deletions dataherald/server/fastapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,9 @@ def get_golden_records(self, page: int = 1, limit: int = 10) -> List[GoldenRecor
"""Gets golden records"""
return self._api.get_golden_records(page, limit)

def add_instruction(
self, instruction_request: InstructionRequest
) -> Instruction:
def add_instruction(self, instruction_request: InstructionRequest) -> Instruction:
"""Adds an instruction"""
created_records = self._api.add_instruction(
instruction_request
)
created_records = self._api.add_instruction(instruction_request)

# Return a JSONResponse with status code 201 and the location header.
instruction_as_dict = created_records.dict()
Expand All @@ -292,6 +288,4 @@ def update_instruction(
instruction_request: UpdateInstruction,
) -> Instruction:
"""Updates an instruction"""
return self._api.update_instruction(
instruction_id, instruction_request
)
return self._api.update_instruction(instruction_id, instruction_request)
2 changes: 2 additions & 0 deletions dataherald/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ class NLQuery(BaseModel):
question: str
db_connection_id: str


class UpdateInstruction(BaseModel):
instruction: str


class InstructionRequest(DBConnectionValidation):
instruction: str

Expand Down

0 comments on commit 463fe71

Please sign in to comment.