From c20b4b279adf1d8e4660ed09e2fec7105d2380bb Mon Sep 17 00:00:00 2001 From: FZill <florian.zill@ufz.de> Date: Thu, 8 Feb 2024 08:36:09 +0100 Subject: [PATCH] Optional instead of Opt --- ogstools/meshplotlib/animation.py | 7 +++---- ogstools/meshplotlib/core.py | 7 +++---- ogstools/physics/nuclearwasteheat/nuclearwaste.py | 7 +++---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/ogstools/meshplotlib/animation.py b/ogstools/meshplotlib/animation.py index 0df18f1cc..295d97e42 100644 --- a/ogstools/meshplotlib/animation.py +++ b/ogstools/meshplotlib/animation.py @@ -1,8 +1,7 @@ import warnings from collections.abc import Sequence from functools import partial -from typing import Optional as Opt -from typing import Union +from typing import Optional, Union import matplotlib as mpl import numpy as np @@ -20,8 +19,8 @@ from .core import _plot_on_figure, plot def animate( mesh_series: MeshSeries, property: Property, - timesteps: Opt[Sequence] = None, - titles: Opt[list[str]] = None, + timesteps: Optional[Sequence] = None, + titles: Optional[list[str]] = None, ) -> FuncAnimation: """ Create an animation for a property of a mesh series with given timesteps. diff --git a/ogstools/meshplotlib/core.py b/ogstools/meshplotlib/core.py index f8567270f..682f24fdc 100644 --- a/ogstools/meshplotlib/core.py +++ b/ogstools/meshplotlib/core.py @@ -2,8 +2,7 @@ import types from copy import deepcopy -from typing import Literal, Union -from typing import Optional as Opt +from typing import Literal, Optional, Union import numpy as np import pyvista as pv @@ -115,7 +114,7 @@ def add_colorbars( property: Property, levels: np.ndarray, pad: float = 0.05, - labelsize: Opt[float] = None, + labelsize: Optional[float] = None, ) -> None: """Add a colorbar to the matplotlib figure.""" cmap, norm = get_cmap_norm(levels, property) @@ -178,7 +177,7 @@ def subplot( mesh: pv.UnstructuredGrid, property: Union[Property, str], ax: plt.Axes, - levels: Opt[np.ndarray] = None, + levels: Optional[np.ndarray] = None, ) -> None: """ Plot the property field of a mesh on a matplotlib.axis. diff --git a/ogstools/physics/nuclearwasteheat/nuclearwaste.py b/ogstools/physics/nuclearwasteheat/nuclearwaste.py index 337755684..86f417d35 100644 --- a/ogstools/physics/nuclearwasteheat/nuclearwaste.py +++ b/ogstools/physics/nuclearwasteheat/nuclearwaste.py @@ -1,6 +1,5 @@ from dataclasses import dataclass -from typing import Optional as Opt -from typing import Union +from typing import Optional, Union import numpy as np from pint.facets.plain import PlainQuantity @@ -31,7 +30,7 @@ class NuclearWaste: self, t: Union[PlainQuantity, float, np.ndarray], baseline: bool = False, - ncl_id: Opt[int] = None, + ncl_id: Optional[int] = None, time_unit: str = "s", power_unit: str = "W", ) -> Union[float, np.ndarray]: @@ -84,7 +83,7 @@ class Repository: self, t: Union[PlainQuantity, float, np.ndarray], baseline: bool = False, - ncl_id: Opt[int] = None, + ncl_id: Optional[int] = None, time_unit: str = "s", power_unit: str = "W", ) -> Union[float, np.ndarray]: -- GitLab