Skip to content

Commit 57f7b5f

Browse files
cphycneutrinoceros
andauthored
More extensive typing
Co-authored-by: Clément Robert <cr52@protonmail.com>
1 parent ded6e1c commit 57f7b5f

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

yt/data_objects/time_series.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -443,11 +443,9 @@ def particle_trajectories(
443443
def _get_by_attribute(
444444
self,
445445
attribute: str,
446-
value: Union[unyt_quantity, tuple[float, str]],
447-
tolerance: Union[None, unyt_quantity, tuple[float, str]] = None,
448-
side: Union[
449-
Literal["nearest"], Literal["smaller"], Literal["larger"]
450-
] = "nearest",
446+
value: Union[unyt_quantity, tuple[float, Union[Unit, str]]],
447+
tolerance: Union[None, unyt_quantity, tuple[float, Union[Unit, str]]] = None,
448+
side: Literal["nearest", "smaller", "larger"] = "nearest",
451449
) -> "Dataset":
452450
r"""
453451
Get a dataset at or near to a given value.
@@ -549,12 +547,10 @@ def _get_by_attribute(
549547

550548
def get_by_time(
551549
self,
552-
time: Union[unyt_quantity, tuple],
553-
tolerance: Union[None, unyt_quantity, tuple] = None,
554-
side: Union[
555-
Literal["nearest"], Literal["smaller"], Literal["larger"]
556-
] = "nearest",
557-
):
550+
time: Union[unyt_quantity, tuple[float, Union[Unit, str]]],
551+
tolerance: Union[None, unyt_quantity, tuple[float, Union[Unit, str]]] = None,
552+
side: Literal["nearest", "smaller", "larger"] = "nearest",
553+
) -> Dataset:
558554
"""
559555
Get a dataset at or near to a given time.
560556
@@ -585,10 +581,8 @@ def get_by_redshift(
585581
self,
586582
redshift: float,
587583
tolerance: Optional[float] = None,
588-
side: Union[
589-
Literal["nearest"], Literal["smaller"], Literal["larger"]
590-
] = "nearest",
591-
):
584+
side: Literal["nearest", "smaller", "larger"] = "nearest",
585+
) -> Dataset:
592586
"""
593587
Get a dataset at or near to a given time.
594588

0 commit comments

Comments
 (0)