Skip to content

Commit 17e657a

Browse files
Merge pull request #5195 from yt-project/dependabot/pip/requirements/actions-d4e780ad0b
2 parents b1c25c0 + fab7039 commit 17e657a

File tree

5 files changed

+37
-25
lines changed

5 files changed

+37
-25
lines changed

requirements/typecheck.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
mypy==1.15.0
2-
types-PyYAML==6.0.12.20250402
1+
mypy==1.16.1
2+
types-PyYAML==6.0.12.20250516
33
types-chardet==5.0.4.6
4-
types-requests==2.32.0.20250328
5-
typing-extensions==4.13.2; python_version < '3.12'
4+
types-requests==2.32.4.20250611
5+
typing-extensions==4.14.0; python_version < '3.12'

yt/_maintenance/numpy2_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# np.trapz is deprecated in numpy 2.0 in favor of np.trapezoid
77
trapezoid = np.trapezoid
88
else:
9-
trapezoid = np.trapz # type: ignore[assignment] # noqa: NPY201
9+
trapezoid = np.trapz # type: ignore # noqa: NPY201

yt/frontends/ramses/io.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from unyt import unyt_array
77

88
from yt._maintenance.deprecation import issue_deprecation_warning
9+
from yt._typing import FieldKey
910
from yt.frontends.ramses.definitions import VAR_DESC_RE, VERSION_RE
1011
from yt.utilities.cython_fortran_utils import FortranFile
1112
from yt.utilities.exceptions import (
@@ -19,6 +20,9 @@
1920
if TYPE_CHECKING:
2021
import os
2122

23+
from yt.frontends.ramses.data_structures import RAMSESDomainSubset
24+
from yt.frontends.ramses.particle_handlers import ParticleFileHandler
25+
2226

2327
def convert_ramses_ages(ds, conformal_ages):
2428
issue_deprecation_warning(
@@ -73,7 +77,12 @@ def convert_ramses_conformal_time_to_physical_time(
7377
)
7478

7579

76-
def _ramses_particle_binary_file_handler(particle_handler, subset, fields, count):
80+
def _ramses_particle_binary_file_handler(
81+
particle_handler: "ParticleFileHandler",
82+
subset: "RAMSESDomainSubset",
83+
fields: list[FieldKey],
84+
count: int,
85+
) -> dict[FieldKey, np.ndarray]:
7786
"""General file handler for binary file, called by _read_particle_subset
7887
7988
Parameters
@@ -116,7 +125,12 @@ def _ramses_particle_binary_file_handler(particle_handler, subset, fields, count
116125
return tr
117126

118127

119-
def _ramses_particle_csv_file_handler(particle_handler, subset, fields, count):
128+
def _ramses_particle_csv_file_handler(
129+
particle_handler: "ParticleFileHandler",
130+
subset: "RAMSESDomainSubset",
131+
fields: list[FieldKey],
132+
count: int,
133+
) -> dict[FieldKey, np.ndarray]:
120134
"""General file handler for csv file, called by _read_particle_subset
121135
122136
Parameters

yt/frontends/ramses/particle_handlers.py

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
if TYPE_CHECKING:
2626
from yt.frontends.ramses.data_structures import RAMSESDomainSubset
2727

28+
2829
PARTICLE_HANDLERS: set[type["ParticleFileHandler"]] = set()
2930

3031

@@ -65,20 +66,23 @@ class ParticleFileHandler(abc.ABC, HandlerMixin):
6566
known_fields: list[FieldKey]
6667

6768
# The function to employ to read the file
69+
# NOTE: We omit the `ParticleFileHandler` argument since
70+
# it is accessed as a method (so the first argument is
71+
# assumed to be `self`).
6872
reader: Callable[
69-
["ParticleFileHandler", "RAMSESDomainSubset", list[tuple[str, str]], int],
70-
dict[tuple[str, str], np.ndarray],
73+
["RAMSESDomainSubset", list[FieldKey], int],
74+
dict[FieldKey, np.ndarray],
7175
]
7276

7377
# Name of the config section (if any)
7478
config_field: str | None = None
7579

7680
## These properties are computed dynamically
7781
# Mapping from field to offset in file
78-
_field_offsets: dict[tuple[str, str], int]
82+
_field_offsets: dict[FieldKey, int]
7983

8084
# Mapping from field to the type of the data (float, integer, ...)
81-
_field_types: dict[tuple[str, str], str]
85+
_field_types: dict[FieldKey, str]
8286

8387
# Number of particle in the domain
8488
_local_particle_count: int
@@ -131,14 +135,14 @@ def read_header(self):
131135
pass
132136

133137
@property
134-
def field_offsets(self) -> dict[tuple[str, str], int]:
138+
def field_offsets(self) -> dict[FieldKey, int]:
135139
if hasattr(self, "_field_offsets"):
136140
return self._field_offsets
137141
self.read_header()
138142
return self._field_offsets
139143

140144
@property
141-
def field_types(self) -> dict[tuple[str, str], str]:
145+
def field_types(self) -> dict[FieldKey, str]:
142146
if hasattr(self, "_field_types"):
143147
return self._field_types
144148
self.read_header()
@@ -158,9 +162,7 @@ def header(self) -> dict[str, Any]:
158162
self.read_header()
159163
return self._header
160164

161-
def handle_field(
162-
self, field: tuple[str, str], data_dict: dict[tuple[str, str], np.ndarray]
163-
):
165+
def handle_field(self, field: FieldKey, data_dict: dict[FieldKey, np.ndarray]):
164166
"""
165167
This function allows custom code to be called to handle special cases,
166168
such as the particle birth time.
@@ -169,9 +171,9 @@ def handle_field(
169171
170172
Parameters
171173
----------
172-
field : tuple[str, str]
174+
field : FieldKey
173175
The field name.
174-
data_dict : dict[tuple[str, str], np.ndarray]
176+
data_dict : dict[FieldKey, np.ndarray]
175177
A dictionary containing the data.
176178
177179
By default, this function does nothing.
@@ -344,9 +346,7 @@ def birth_file_fname(self):
344346
def has_birth_file(self):
345347
return os.path.exists(self.birth_file_fname)
346348

347-
def handle_field(
348-
self, field: tuple[str, str], data_dict: dict[tuple[str, str], np.ndarray]
349-
):
349+
def handle_field(self, field: FieldKey, data_dict: dict[FieldKey, np.ndarray]):
350350
_ptype, fname = field
351351
if not (fname == "particle_birth_time" and self.ds.cosmological_simulation):
352352
return
@@ -492,9 +492,7 @@ def read_header(self):
492492
self._field_offsets = field_offsets
493493
self._field_types = _pfields
494494

495-
def handle_field(
496-
self, field: tuple[str, str], data_dict: dict[tuple[str, str], np.ndarray]
497-
):
495+
def handle_field(self, field: FieldKey, data_dict: dict[FieldKey, np.ndarray]):
498496
_ptype, fname = field
499497
if not (fname == "particle_birth_time" and self.ds.cosmological_simulation):
500498
return

yt/visualization/profile_plotter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def save(
319319
names = []
320320
for uid, plot in iters:
321321
if isinstance(uid, tuple):
322-
uid = uid[1] # type: ignore
322+
uid = uid[1]
323323
uid_name = f"{prefix}_1d-Profile_{xfn}_{uid}{suffix}"
324324
names.append(uid_name)
325325
with matplotlib_style_context():

0 commit comments

Comments
 (0)