diff --git a/yt/visualization/plot_modifications.py b/yt/visualization/plot_modifications.py index 62750332929..2e0b302f0bc 100644 --- a/yt/visualization/plot_modifications.py +++ b/yt/visualization/plot_modifications.py @@ -2,7 +2,7 @@ import warnings from functools import wraps from numbers import Integral, Number -from typing import Optional, Tuple, Union +from typing import Any, Dict, Optional, Tuple, Union import matplotlib import numpy as np @@ -47,9 +47,7 @@ def _check_geometry(self, plot): return _check_geometry -def _validate_factor_tuple( - factor: Union[Tuple[Integral, Integral], Integral] -) -> Tuple[int, int]: +def _validate_factor_tuple(factor) -> Tuple[int, int]: if ( is_sequence(factor) and len(factor) == 2 @@ -58,7 +56,7 @@ def _validate_factor_tuple( # - checking for "is_sequence" allows lists, numpy arrays and other containers # - checking for Integral type allows numpy integer types # in any case we return a with strict typing - return tuple(int(_) for _ in factor) + return (int(factor[0]), int(factor[1])) elif isinstance(factor, Integral): return (int(factor), int(factor)) else: @@ -945,7 +943,7 @@ def __init__( plot_args=None, ): PlotCallback.__init__(self) - def_plot_args = {} + def_plot_args: Optional[Dict[str, Any]] = {} self.field_x = field_x self.field_y = field_y self.field_color = field_color