Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
JochenSiegWork committed Nov 20, 2024
1 parent d5705e4 commit c4c9904
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
3 changes: 1 addition & 2 deletions molpipeline/mol2any/mol2concatinated_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@

import numpy as np
import numpy.typing as npt
from sklearn.base import clone

from loguru import logger
from sklearn.base import clone

from molpipeline.abstract_pipeline_elements.core import (
InvalidInstance,
Expand Down
13 changes: 11 additions & 2 deletions tests/utils/logging.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
"""Test utils for logging."""

from contextlib import contextmanager
from typing import Generator

from loguru import logger


@contextmanager
def capture_logs(level="INFO", format="{level}:{name}:{message}") -> Generator[list[str], None, None]:
def capture_logs(
level="INFO", format="{level}:{name}:{message}"
) -> Generator[list[str], None, None]:
"""Capture loguru-based logs.
Custom context manager to test loguru-based logs. For details and usage examples,
Expand All @@ -17,8 +21,13 @@ def capture_logs(level="INFO", format="{level}:{name}:{message}") -> Generator[l
Log level, by default "INFO"
format : str, optional
Log format, by default "{level}:{name}:{message}"
Yields
-------
list[str]
List of log messages
"""
output: list[str] = []
handler_id = logger.add(output.append, level=level, format=format)
yield output
logger.remove(handler_id)
logger.remove(handler_id)

0 comments on commit c4c9904

Please sign in to comment.