Skip to content

Commit 9ab515f

Browse files
committed
Update mypy to v2.1
1 parent 2068a7d commit 9ab515f

6 files changed

Lines changed: 205 additions & 128 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ notebook = [
245245
# https://github.com/python/typeshed?tab=readme-ov-file#package-versioning-for-third-party-stubs
246246
pre-commit = [
247247
'aiida-core[tests]',
248-
'mypy~=1.19.0',
248+
'mypy~=2.1.0',
249249
'packaging~=23.0',
250250
'pre-commit~=3.5',
251251
'sqlalchemy[mypy]~=2.0',

src/aiida/orm/nodes/data/array/trajectory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ def collapse_into_unit_cell(point, cell):
826826
xmin, ymin, zmin = _x.min(), _y.min(), _z.min()
827827
xmax, ymax, zmax = _x.max(), _y.max(), _z.max()
828828

829-
_xi, _yi, _zi = np.mgrid[xmin:xmax:60j, ymin:ymax:30j, zmin:zmax:30j] # type: ignore[misc]
829+
_xi, _yi, _zi = np.mgrid[xmin:xmax:60j, ymin:ymax:30j, zmin:zmax:30j]
830830
coords = np.vstack([item.ravel() for item in [_xi, _yi, _zi]])
831831
density = kde(coords).reshape(_xi.shape)
832832

src/aiida/orm/utils/links.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ def validate_link(
176176

177177
type_source, type_target, outdegree, indegree = link_mapping[link_type]
178178

179-
if not isinstance(source, type_source) or not isinstance(target, type_target):
179+
if not isinstance(source, type_source) or not isinstance(target, type_target): # type: ignore[unreachable]
180180
raise ValueError(f'cannot add a {link_type} link from {type(source)} to {type(target)}')
181181

182-
if outdegree == 'unique_triple' or indegree == 'unique_triple':
182+
if outdegree == 'unique_triple' or indegree == 'unique_triple': # type: ignore[unreachable]
183183
# For a `unique_triple` degree we just have to check if an identical triple already exist, either in the cache
184184
# or stored, in which case, the new proposed link is a duplicate and thus illegal
185185
duplicate_link_triple = link_triple_exists(source, target, link_type, link_label, backend)

src/aiida/tools/archive/create.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def querybuilder():
239239
elif isinstance(entry, orm.Computer):
240240
starting_uuids[EntityTypes.COMPUTER].add(entry.uuid)
241241
entity_ids[EntityTypes.COMPUTER].add(entry.pk)
242-
elif isinstance(entry, orm.User):
242+
elif isinstance(entry, orm.User): # type: ignore[unreachable]
243243
starting_uuids[EntityTypes.USER].add(entry.email)
244244
entity_ids[EntityTypes.USER].add(entry.pk)
245245
else:

src/aiida/tools/graph/age_entities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def _check_self_and_other(self, other: Self) -> None:
202202

203203
def _check_input_for_set(self, input_for_set: _NodeOrGroupCls | int) -> Any:
204204
if isinstance(input_for_set, self._aiida_cls):
205-
return getattr(input_for_set, self._identifier)
205+
return getattr(input_for_set, self._identifier) # type: ignore[unreachable]
206206

207207
if isinstance(input_for_set, self._identifier_type):
208208
return input_for_set

0 commit comments

Comments
 (0)