Skip to content

Commit

Permalink
Fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinfriede committed Dec 15, 2024
1 parent 361aa82 commit 6321427
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ repos:
--min-py-version,
"3.8",
--max-py-version,
"3.11",
"3.12",
]

- repo: https://github.com/asottile/pyupgrade
Expand All @@ -60,10 +60,14 @@ repos:
- id: black
stages: [pre-commit]

- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v0.9.2
hooks:
- id: zizmor

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
hooks:
- id: mypy
additional_dependencies: [types-all]
pass_filenames: false
args: [--config-file=pyproject.toml, --ignore-missing-imports, src]
4 changes: 2 additions & 2 deletions src/tad_dftd3/data/radii.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from tad_mctc._version import __tversion__
from tad_mctc.data.radii import COV_D3

from ..typing import Tensor
from ..typing import Any, Tensor

__all__ = ["COV_D3", "VDW_D3"]

Expand All @@ -52,7 +52,7 @@ def _load_vdw_rad_d3(
Tensor
VDW radii.
"""
kwargs: dict = {"map_location": device}
kwargs: dict[str, Any] = {"map_location": device}
if __tversion__ > (1, 12, 1): # pragma: no cover
kwargs["weights_only"] = True

Expand Down
6 changes: 4 additions & 2 deletions src/tad_dftd3/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
C6 dispersion coefficients.
"""
import os.path as op
from typing import Optional
from typing import Optional, Union

Check notice

Code scanning / CodeQL

Unused import Note

Import of 'Union' is not used.

import torch
from tad_mctc._version import __tversion__
Expand Down Expand Up @@ -48,6 +48,7 @@ def _load_cn(
Tensor
Reference coordination numbers.
"""
# fmt: off
return torch.tensor(
[
[-1.0000, -1.0000, -1.0000, -1.0000, -1.0000, -1.0000, -1.0000], # None
Expand Down Expand Up @@ -158,6 +159,7 @@ def _load_cn(
device=device,
dtype=dtype,
)
# fmt: on


def _load_c6(
Expand All @@ -178,7 +180,7 @@ def _load_c6(
Tensor
Reference C6 coefficients.
"""
kwargs: dict = {"map_location": device}
kwargs: dict[str, Any] = {"map_location": device}
if __tversion__ > (1, 12, 1): # pragma: no cover
kwargs["weights_only"] = True

Expand Down

0 comments on commit 6321427

Please sign in to comment.