Skip to content

Commit

Permalink
Typehint (#632)
Browse files Browse the repository at this point in the history
* Fix broken type hints

* Remove sections which define default behavior

This is legacy from when they were first all `false` to
incrementally turn on errors.
  • Loading branch information
PGijsbers authored Aug 29, 2024
1 parent 1a04502 commit e0b89e3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 32 deletions.
4 changes: 2 additions & 2 deletions amlb/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import os
import re
import statistics
from typing import Union
from typing import Union, cast

import numpy as np
from numpy import nan, sort
Expand Down Expand Up @@ -297,7 +297,7 @@ def save_predictions(dataset: Dataset, output_file: str,
if isinstance(predictions, S):
predictions = predictions.values
if scipy.sparse.issparse(truth) and truth.shape[1] == 1:
truth = pd.DataFrame(truth.todense())
truth = pd.DataFrame(cast(scipy.sparse.sparray, truth).todense())
if isinstance(truth, DF):
truth = truth.squeeze()
if isinstance(truth, S):
Expand Down
2 changes: 1 addition & 1 deletion amlb/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def yaml_load(file, as_namespace=False):
yaml = YAML(typ='safe')
return yaml.load(file)
else:
def yaml_load(*_, **__):
def yaml_load(*_, **__): # type: ignore[misc]
raise ImportError("ruamel.yaml package is required to load `yaml` config files.")


Expand Down
29 changes: 0 additions & 29 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,6 @@ module=[
]
ignore_missing_imports=true

[[tool.mypy.overrides]]
ignore_errors = false
module = "amlb.utils.*"


[[tool.mypy.overrides]]
ignore_errors = false
module = "amlb.benchmarks.*"


[[tool.mypy.overrides]]
ignore_errors = false
module = "amlb.datasets.*"


[[tool.mypy.overrides]]
ignore_errors = false
module = "amlb.frameworks.*"


[[tool.mypy.overrides]]
ignore_errors = false
module = "amlb.runners.*"


[[tool.mypy.overrides]]
ignore_errors = false
module = "amlb.*"

[[tool.mypy.overrides]]
module = "amlb.benchmark"
disable_error_code = "union-attr"
Expand Down

0 comments on commit e0b89e3

Please sign in to comment.