Skip to content

Commit

Permalink
Update to mypy 0.9 (#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
ascillitoe authored Apr 26, 2022
1 parent 6a2a710 commit 7effb5f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ repos:
- id: nbqa-pyupgrade
args: [--py37-plus]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.812
rev: v0.942
hooks:
- id: mypy
additional_dependencies: [
types-requests>=2.25.0,
]
2 changes: 1 addition & 1 deletion alibi/explainers/anchor_tabular.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ def fit(self, # type: ignore[override]
d_samplers = []
for sampler in samplers:
d_samplers.append(
DistributedAnchorTabular.ray.remote(RemoteSampler).remote(
DistributedAnchorTabular.ray.remote(RemoteSampler).remote( # type: ignore[call-overload]
*(train_data_id, d_train_data_id, sampler)
)
)
Expand Down
4 changes: 2 additions & 2 deletions alibi/explainers/cfproto.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def __init__(self,
self.map_cat_to_num = tf.ragged.constant([np.zeros(v) for _, v in cat_vars.items()])

# define placeholder for mapping which can be fed after the fit step
max_key = max(cat_vars, key=cat_vars.get) # type: ignore[type-var] # feature with the most categories
max_key = max(cat_vars, key=cat_vars.get) # type: ignore[arg-type] # feature with the most categories
self.max_cat = cat_vars[max_key]
cat_keys = list(cat_vars.keys())
n_cat = len(cat_keys)
Expand Down Expand Up @@ -1059,7 +1059,7 @@ def compare(x: Union[float, int, np.ndarray], y: int) -> bool:
self.class_proto[c] = self.X_by_class[c][idx_c[0][-1]].reshape(1, -1)

if self.enc_or_kdtree:
self.id_proto = min(dist_proto, key=dist_proto.get) # type: ignore[type-var]
self.id_proto = min(dist_proto, key=dist_proto.get) # type: ignore[arg-type]
proto_val = self.class_proto[self.id_proto]
if verbose:
print('Prototype class: {}'.format(self.id_proto))
Expand Down
3 changes: 2 additions & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# development dependencies (see docs.txt for documentation building dependencies)
# linting and static type-checking
flake8>=3.7.7, <5.0.0
mypy>=0.670, <0.900
mypy~= 0.900
types-requests>=2.25.0, <3.0.0
# testing
pytest>=5.3.5, <7.0.0
pytest-cov>=2.6.1, <4.0.0
Expand Down

0 comments on commit 7effb5f

Please sign in to comment.