Skip to content

Commit

Permalink
TYP: fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Nov 24, 2021
1 parent f7fc618 commit 172d892
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions yt/visualization/plot_modifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 172d892

Please sign in to comment.