From 93c2545b0cff7d45b6e6ea4bc320696e01c5f0c0 Mon Sep 17 00:00:00 2001 From: esteinig Date: Sat, 10 Feb 2024 11:14:12 +1100 Subject: [PATCH] chore(brick): fix generator annotation --- brick/api/client.py | 2 +- brick/api/core/config.py | 6 ++++-- brick/api/main.py | 4 ++-- brick/api/tasks.py | 2 +- brick/rings.py | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/brick/api/client.py b/brick/api/client.py index 00379d5..a4c1a1e 100644 --- a/brick/api/client.py +++ b/brick/api/client.py @@ -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") diff --git a/brick/api/core/config.py b/brick/api/core/config.py index ac23910..6afc7af 100644 --- a/brick/api/core/config.py +++ b/brick/api/core/config.py @@ -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 diff --git a/brick/api/main.py b/brick/api/main.py index 20a4556..4a583be 100644 --- a/brick/api/main.py +++ b/brick/api/main.py @@ -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..." ) diff --git a/brick/api/tasks.py b/brick/api/tasks.py index 19785a8..f005d39 100644 --- a/brick/api/tasks.py +++ b/brick/api/tasks.py @@ -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) diff --git a/brick/rings.py b/brick/rings.py index f612407..caade2d 100644 --- a/brick/rings.py +++ b/brick/rings.py @@ -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 """ @@ -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 = []