Skip to content

Commit

Permalink
Suppress spurious AIF360 warnings. (#1301)
Browse files Browse the repository at this point in the history
  • Loading branch information
hirzel committed Feb 27, 2023
1 parent 923b148 commit 73390e1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lale/lib/aif360/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019-2022 IBM Corporation
# Copyright 2019-2023 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -190,6 +190,7 @@
# this ensures that pyright considers them to be publicly available
# and not private imports (this affects lale users that use pyright)

from ._suppress_aif360_warnings import dummy as _dummy_from_suppress_warnings
from .adversarial_debiasing import AdversarialDebiasing as AdversarialDebiasing
from .calibrated_eq_odds_postprocessing import (
CalibratedEqOddsPostprocessing as CalibratedEqOddsPostprocessing,
Expand Down
29 changes: 29 additions & 0 deletions lale/lib/aif360/_suppress_aif360_warnings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2019-2023 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import logging

_logger = logging.getLogger()
_old_log_level = _logger.getEffectiveLevel()
_logger.setLevel(level=logging.ERROR)

# the following triggers spurious AIF360 warning "No module named 'fairlearn'":
import aif360.algorithms.inprocessing # isort:skip # noqa:E402,F401 # pylint:disable=wrong-import-position,wrong-import-order

# the following triggers spurious AIF360 warning "No module named 'tempeh'":
import aif360.datasets # isort:skip # noqa:E402,F401 # pylint:disable=wrong-import-position,wrong-import-order

_logger.setLevel(_old_log_level)

dummy = "dummy"
1 change: 0 additions & 1 deletion lale/lib/aif360/disparate_impact_remover.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import typing

import aif360.algorithms.preprocessing
import aif360.datasets
import numpy as np
import pandas as pd

Expand Down
1 change: 0 additions & 1 deletion lale/lib/aif360/lfr.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import aif360.algorithms.preprocessing
import aif360.datasets
import pandas as pd

import lale.docstrings
Expand Down

0 comments on commit 73390e1

Please sign in to comment.