Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use warnings.warn instead of logging.warn when loading Problem from H… #1253

Merged
merged 2 commits into from
Jan 18, 2024
Merged
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
8 changes: 4 additions & 4 deletions pypesto/store/read_from_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import ast
import logging
import warnings
from pathlib import Path
from typing import Union

Expand Down Expand Up @@ -120,10 +121,9 @@ def read(self, objective: ObjectiveBase = None) -> Problem:
if objective is None:
objective = Objective()
# raise warning that objective is not loaded.
logger.info(
'WARNING: You are loading a problem.\nThis problem'
' is not to be used without a separately created'
' objective.'
warnings.warn(
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not logger.warn? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Because then I can't easily silence just this warning

'You are loading a problem. This problem is not to be used '
'without a separately created objective.'
)
problem = Problem(objective, [], [])

Expand Down