Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions neural_lam/custom_loggers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Standard library
import sys
from typing import Optional, Dict, Any
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only Optional is actually used in this file now. Dict and Any are unused imports.

Copy link
Copy Markdown
Collaborator

@sadamov sadamov Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dict and Any are imported but never used, will fail the linter as mentioned by @kshirajahere

Suggested change
from typing import Optional, Dict, Any
from typing import Optional


# Third-party
import mlflow
Expand All @@ -15,7 +16,9 @@ class CustomMLFlowLogger(pl.loggers.MLFlowLogger):
of version `2.0.3` at least.
"""

def __init__(self, experiment_name, tracking_uri, run_name):
def __init__(
self, experiment_name: str, tracking_uri: str, run_name: str
) -> None:
super().__init__(
experiment_name=experiment_name, tracking_uri=tracking_uri
)
Expand All @@ -25,7 +28,7 @@ def __init__(self, experiment_name, tracking_uri, run_name):
mlflow.log_param("run_id", self.run_id)

@property
def save_dir(self):
def save_dir(self) -> str:
"""
Returns the directory where the MLFlow artifacts are saved.
Used to define the path to save output when using the logger.
Expand All @@ -37,7 +40,9 @@ def save_dir(self):
"""
return "mlruns"

def log_image(self, key, images, step=None):
def log_image(
self, key: str, images: list, step: Optional[int] = None
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list is vague here, the docstring even calls these matplotlib figures. At minimum tighten the docstring, or use a more specific type.

Suggested change
self, key: str, images: list, step: Optional[int] = None
self, key: str, images: "list[plt.Figure]", step: Optional[int] = None

) -> None:
"""
Log a matplotlib figure as an image to MLFlow

Expand Down
Loading