Skip to content

Commit

Permalink
MNT update linter versions (fairlearn#1293)
Browse files Browse the repository at this point in the history
Updating linter versions, and flake8 has moved to github. Will do another PR to move to `ruff` instead for `isort` and `flake8`.
Signed-off-by: adrinjalali <[email protected]>
  • Loading branch information
adrinjalali authored Sep 26, 2023
1 parent 7f9921a commit 0656fd0
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v3
- uses: psf/black@23.3.0
- uses: psf/black@23.9.1
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ repos:
# requirements-dev.txt
# linting.yml
# .pre-commit-config.yaml
rev: 23.3.0
rev: 23.9.1
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 4.0.1
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
types: [file, python]
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
24 changes: 10 additions & 14 deletions fairlearn/metrics/_metric_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

from ._annotated_metric_function import AnnotatedMetricFunction
from ._disaggregated_result import (
DisaggregatedResult,
_VALID_ERROR_STRING,
_INVALID_ERRORS_VALUE_ERROR_MESSAGE,
_VALID_ERROR_STRING,
DisaggregatedResult,
)
from ._group_feature import GroupFeature

Expand Down Expand Up @@ -75,12 +75,10 @@ def compatible_metric_frame_init(self, *args, metric=None, **kwargs):
if len(args) > 0:
args_msg = ", ".join([f"'{name}'" for name in positional_dict.keys()])
warnings.warn(
(
f"You have provided {args_msg} as positional arguments. "
"Please pass them as keyword arguments. From version "
f"{version} passing them as positional arguments "
"will result in an error."
),
f"You have provided {args_msg} as positional arguments. "
"Please pass them as keyword arguments. From version "
f"{version} passing them as positional arguments "
"will result in an error.",
FutureWarning,
)

Expand All @@ -89,12 +87,10 @@ def compatible_metric_frame_init(self, *args, metric=None, **kwargs):
if metric is not None:
metric_arg_dict = {"metrics": metric}
warnings.warn(
(
"The positional argument 'metric' has been replaced "
"by a keyword argument 'metrics'. "
f"From version {version} passing it as a positional argument "
"or as a keyword argument 'metric' will result in an error"
),
"The positional argument 'metric' has been replaced "
"by a keyword argument 'metrics'. "
f"From version {version} passing it as a positional argument "
"or as a keyword argument 'metric' will result in an error",
FutureWarning,
)

Expand Down
10 changes: 4 additions & 6 deletions fairlearn/postprocessing/_interpolated_thresholder.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,10 @@ def fit(self, X, y, **kwargs):

if self.predict_method == "deprecated":
warn(
(
"'predict_method' default value is changed from 'predict' to "
"'auto'. Explicitly pass `predict_method='predict' to "
"replicate the old behavior, or pass `predict_method='auto' "
"or other valid values to silence this warning."
),
"'predict_method' default value is changed from 'predict' to "
"'auto'. Explicitly pass `predict_method='predict' to "
"replicate the old behavior, or pass `predict_method='auto' "
"or other valid values to silence this warning.",
FutureWarning,
)
self._predict_method = "predict"
Expand Down
28 changes: 13 additions & 15 deletions fairlearn/postprocessing/_threshold_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,21 +178,21 @@ class ThresholdOptimizer(BaseEstimator, MetaEstimatorMixin):
values.
'auto'
use one of :code:`predict_proba`, :code:`decision_function`, or
use one of :code:`predict_proba`, :code:`decision_function`, or
:code:`predict`, in that order.
'predict_proba'
use the second column from the output of :code:`predict_proba`.
It is assumed that the second column represents the positive
use the second column from the output of :code:`predict_proba`.
It is assumed that the second column represents the positive
outcome.
'decision_function'
use the raw values given by the :code:`decision_function`.
'predict'
use the hard values reported by the :code:`predict` method if
estimator is a classifier, and the regression values if
estimator is a regressor. This is equivalent to what
use the hard values reported by the :code:`predict` method if
estimator is a classifier, and the regression values if
estimator is a regressor. This is equivalent to what
is done in [1]_.
.. versionadded:: 0.7
Expand Down Expand Up @@ -290,12 +290,10 @@ def fit(self, X, y, *, sensitive_features, **kwargs):

if self.predict_method == "deprecated":
warn(
(
"'predict_method' default value is changed from 'predict' to "
"'auto'. Explicitly pass `predict_method='predict' to "
"replicate the old behavior, or pass `predict_method='auto' "
"or other valid values to silence this warning."
),
"'predict_method' default value is changed from 'predict' to "
"'auto'. Explicitly pass `predict_method='predict' to "
"replicate the old behavior, or pass `predict_method='auto' "
"or other valid values to silence this warning.",
FutureWarning,
)
self._predict_method = "predict"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,8 @@ def fit(self, X, y, **kwargs):
gaps.append(gap_LP)

logger.debug(
(
"%seta=%.6f, L_low=%.3f, L=%.3f, L_high=%.3f, gap=%.6f, disp=%.3f, "
"err=%.3f, gap_LP=%.6f"
),
"%seta=%.6f, L_low=%.3f, L=%.3f, L_high=%.3f, gap=%.6f, disp=%.3f, "
"err=%.3f, gap_LP=%.6f",
_INDENTATION,
eta,
result_EG.L_low,
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ requirements-parser
# requirements-dev.txt
# linting.yml
# .pre-commit-config.yaml
black==23.3.0
black==23.9.1

# Required for test
pytest==7.2.0
Expand Down

0 comments on commit 0656fd0

Please sign in to comment.