Skip to content

Commit

Permalink
Remove unused local variable and imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ahdamin committed Oct 9, 2024
1 parent 0f66501 commit 6fa777f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions genotype_api/database/crud/create.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import logging

from sqlalchemy.future import select
from sqlalchemy.orm import Query

from genotype_api.database.base_handler import BaseHandler
from genotype_api.database.models import SNP, Analysis, Genotype, Plate, Sample, User
from genotype_api.dto.user import UserRequest
from genotype_api.exceptions import SampleExistsError

LOG = logging.getLogger(__name__)
Expand All @@ -27,9 +26,9 @@ async def create_plate(self, plate: Plate) -> Plate:

async def create_sample(self, sample: Sample) -> Sample:
"""Creates a sample in the database."""
sample_in_db_query = self._get_query(Analysis).filter(Sample.id == sample.id)
result = await self.session.execute(sample_in_db_query)
if sample_in_db := result.one_or_none():
sample_in_db: Query = self._get_query(Analysis).filter(Sample.id == sample.id)
result = await self.session.execute(sample_in_db)
if result.one_or_none():
raise SampleExistsError
self.session.add(sample)
await self.session.commit()
Expand Down
2 changes: 1 addition & 1 deletion genotype_api/database/crud/read.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from datetime import date, timedelta
from datetime import date

from sqlalchemy import asc, desc, func
from sqlalchemy.future import select
Expand Down

0 comments on commit 6fa777f

Please sign in to comment.