Skip to content

Commit a09a5b9

Browse files
committed
ruff fixes
1 parent 5f24d04 commit a09a5b9

67 files changed

Lines changed: 373 additions & 294 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.flake8

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
11
[flake8]
22
max-line-length = 100
3+
ignore =
4+
# Allow star imports in __init__.py files
5+
F403,
6+
F405,
7+
# Allow unused imports in __init__.py files (they're for public API)
8+
F401,
9+
# Scientific naming conventions
10+
N803,
11+
N806,
12+
exclude =
13+
.git,
14+
__pycache__,
15+
build,
16+
dist,
17+
.eggs,
18+
docs/_build,
19+
per-file-ignores =
20+
__init__.py:F401,F403,F405
21+
# Allow long lines in mathematical formula files
22+
*/individual/_tptn_solutions.py:E501
23+
# Allow long lines in docstring score lists
24+
*/check/bundles/*:E501
25+
*/check/multiclass/*:E501

.github/workflows/build.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,18 @@ jobs:
2626
- name: Install dependencies
2727
run: |
2828
python -m pip install --upgrade pip
29-
pip install flake8
29+
pip install flake8 ruff pylint mypy
3030
3131
- name: Lint with flake8
3232
run: |
3333
# stop the build if there are Python syntax errors or undefined names
3434
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
3535
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
36+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics
37+
38+
- name: Lint with ruff
39+
run: |
40+
ruff check --output-format=github .
3741
3842
test:
3943
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}

mlscorecheck/__init__.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,5 @@
22
This module brings together all functionalities.
33
"""
44

5-
from . import check
6-
from . import core
7-
from . import experiments
8-
from . import symbolic
9-
from . import individual
10-
from . import aggregated
5+
from . import aggregated, check, core, experiments, individual, symbolic
116
from ._version import *

mlscorecheck/aggregated/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
This module brings together all the logic related to aggregated figures
33
"""
44

5-
from ._folding import *
6-
from ._fold import *
7-
from ._fold_enumeration import *
5+
from ._check_aggregated_scores import *
86
from ._dataset import *
97
from ._evaluation import *
108
from ._experiment import *
9+
from ._fold import *
10+
from ._fold_enumeration import *
11+
from ._folding import *
12+
from ._folding_utils import *
13+
from ._generate_problems import *
1114
from ._linear_programming import *
1215
from ._utils import *
13-
from ._check_aggregated_scores import *
14-
from ._generate_problems import *
15-
from ._folding_utils import *

mlscorecheck/aggregated/_check_aggregated_scores.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@
66
import pulp as pl
77

88
from ..core import (
9-
logger,
109
NUMERICAL_TOLERANCE,
1110
check_uncertainty_and_tolerance,
11+
logger,
1212
update_uncertainty,
1313
)
1414
from ..individual import resolve_aliases_and_complements
15-
1615
from ._experiment import Experiment
1716
from ._linear_programming import solve
18-
from ._utils import compare_scores, aggregated_scores
17+
from ._utils import aggregated_scores, compare_scores
1918

2019
__all__ = ["check_aggregated_scores"]
2120

mlscorecheck/aggregated/_dataset.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
# disabling pylint false positives
55
# pylint: disable=no-member
66

7-
from ._utils import random_identifier
8-
97
from ..experiments import dataset_statistics
8+
from ._utils import random_identifier
109

1110
__all__ = ["Dataset"]
1211

mlscorecheck/aggregated/_evaluation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
import pulp as pl
66

7+
from ..core import NUMERICAL_TOLERANCE, dict_mean, init_random_state, round_scores
8+
from ..scores import calculate_scores_for_lp
79
from ._dataset import Dataset
810
from ._folding import Folding
9-
from ..core import init_random_state, dict_mean, round_scores, NUMERICAL_TOLERANCE
10-
from ..scores import calculate_scores_for_lp
11-
from ._utils import check_bounds, aggregated_scores
1211
from ._linear_programming import add_bounds
12+
from ._utils import aggregated_scores, check_bounds
1313

1414

1515
class Evaluation:

mlscorecheck/aggregated/_experiment.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44

55
import pulp as pl
66

7-
from ..core import init_random_state, dict_mean, round_scores, NUMERICAL_TOLERANCE
7+
from ..core import NUMERICAL_TOLERANCE, dict_mean, init_random_state, round_scores
88
from ..scores import calculate_scores_for_lp
9-
109
from ._evaluation import Evaluation
11-
12-
from ._utils import check_bounds, aggregated_scores
1310
from ._linear_programming import add_bounds
11+
from ._utils import aggregated_scores, check_bounds
1412

1513
__all__ = ["Experiment"]
1614

mlscorecheck/aggregated/_fold.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
from ..core import init_random_state, round_scores
1313
from ..scores import calculate_scores_for_lp
14-
15-
from ._utils import random_identifier, aggregated_scores
14+
from ._utils import aggregated_scores, random_identifier
1615

1716
__all__ = ["Fold"]
1817

mlscorecheck/aggregated/_fold_enumeration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def kfolds_generator(evaluation: dict, available_scores: list, repeat_idx=0):
302302
"n": n_,
303303
"identifier": f"{evaluation['dataset']['identifier']}_f{idx}_k{jdx}_r{repeat_idx}",
304304
}
305-
for idx, (p_, n_) in enumerate(zip(p_vals, n_vals))
305+
for idx, (p_, n_) in enumerate(zip(p_vals, n_vals, strict=False))
306306
]
307307

308308

0 commit comments

Comments
 (0)