Skip to content

Commit

Permalink
chore(brick): fix generator annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
esteinig committed Feb 10, 2024
1 parent 7835a38 commit 93c2545
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion brick/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async def close(self):

async def fetch_sessions_generator(
api_client: ApiClient, logger: logging.Logger | None = None
) -> AsyncGenerator[Session]:
) -> AsyncGenerator[Session, None, None]:
if logger:
logger.info(f"Requesting session identifiers from API")

Expand Down
6 changes: 4 additions & 2 deletions brick/api/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ def get_mongodb_secret_pwd(cls, v: str):
@field_validator("GENOMAD_DATABASE", mode="after")
def check_genomad_database(cls, v: Path):
if v and not v.exists():
logging.warn(f"geNomad database directory not found! ({v})")
logging.warn(
logging.warning(
f"geNomad database directory not found! ({v})"
) # tests run on action runner must avoid pulling database
logging.warning(
f"Attempts to execute `genomad` will fail in the `process_genomad_ring` worker!"
)
return v
Expand Down
4 changes: 2 additions & 2 deletions brick/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def init_working_directory(settings: Settings):

# Create working directory
if not settings.WORK_DIRECTORY.exists():
logging.warn(f"Working directory does not exist: {settings.WORK_DIRECTORY}")
logging.warn(
logging.warning(f"Working directory does not exist: {settings.WORK_DIRECTORY}")
logging.warning(
f"Attempting to create working directory path for server operations..."
)

Expand Down
2 changes: 1 addition & 1 deletion brick/api/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,6 @@ def check_or_update_label_ring(


@contextlib.contextmanager
def create_tmp_directory(root_dir: str = None) -> Generator[Path]:
def create_tmp_directory(root_dir: str = None) -> Generator[Path, None, None]:
with tempfile.TemporaryDirectory(dir=root_dir) as temp_dir:
yield Path(temp_dir)
4 changes: 2 additions & 2 deletions brick/rings.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def parse_blastn_output(


# Generator function
def parse_aggregated_genomad_output(file: Path) -> Generator[GenomadEntry]:
def parse_aggregated_genomad_output(file: Path) -> Generator[GenomadEntry, None, None]:
"""
Parses the aggregated_classification output from a sliced genome file
"""
Expand All @@ -306,7 +306,7 @@ def extract_genomad_contiguous_segments(
min_segment_length: int, # should be a multiple of slice length
prediction_classes: List[GenomadPredictionClass],
segment_type: RingSegmentType,
) -> Generator[RingSegment] | Generator[LabelSegment]:
) -> Generator[RingSegment, None, None] | Generator[LabelSegment, None, None]:
"""Extracts segments of high probabilty for each prediction class with a minimum total length for label or annotation rings"""

segments = []
Expand Down

0 comments on commit 93c2545

Please sign in to comment.