Skip to content

Commit

Permalink
💬 Update Type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
arafune committed Mar 14, 2024
1 parent 1056050 commit de57db4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/arpes/plotting/dynamic_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from _typeshed import Incomplete
from PySide6.QtWidgets import QGridLayout, QWidget

from arpes._typing import DataType
from arpes._typing import XrTypes

LOGLEVELS = (DEBUG, INFO)
LOGLEVEL = LOGLEVELS[1]
Expand Down Expand Up @@ -63,7 +63,7 @@ class DynamicTool(SimpleApp):

def __init__(
self,
function: Callable[..., DataType],
function: Callable[..., XrTypes],
meta: dict[str, float] | None = None,
) -> None:
self._function = function
Expand Down Expand Up @@ -190,7 +190,7 @@ def set_data(self, data: xr.DataArray) -> None:
self.data = data if isinstance(data, xr.DataArray) else normalize_to_spectrum(data)


def make_dynamic(fn: Callable[..., Any], data: DataType) -> None:
def make_dynamic(fn: Callable[..., Any], data: XrTypes) -> None:
"""Starts a tool which makes any analysis function dynamic."""
tool = DynamicTool(fn)
tool.set_data(data)
Expand Down
4 changes: 2 additions & 2 deletions src/arpes/plotting/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ def plot_arr(
arr: XrTypes,
ax: Axes | None = None,
over: AxesImage | None = None,
mask: DataType | None = None,
mask: XrTypes | None = None,
**kwargs: Incomplete,
) -> Axes | None:
"""Convenience method to plot an array with a mask over some other data."""
Expand Down Expand Up @@ -1323,7 +1323,7 @@ def savefig(
"name": "savefig",
}

def extract(for_data: DataType) -> dict[str, Any]:
def extract(for_data: XrTypes) -> dict[str, Any]:
return for_data.attrs.get("provenance", {})

if data is not None:
Expand Down
8 changes: 4 additions & 4 deletions src/arpes/utilities/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from rx.subject import BehaviorSubject, Subject

if TYPE_CHECKING:
from PySide6.QtCore.Qt import CheckState, Orientation, WindowType
from PySide6.QtCore import Qt
from PySide6.QtGui import QIcon, QPixmap

from arpes._typing import QPushButtonARGS, QSliderARGS
Expand Down Expand Up @@ -98,7 +98,7 @@ class SubjectiveSlider(QSlider):

def __init__(
self,
*args: Orientation | QWidget | None,
*args: Qt.Orientation | QWidget | None,
**kwargs: Unpack[QSliderARGS],
) -> None:
"""Wrap signals in ``rx.BehaviorSubject``s."""
Expand Down Expand Up @@ -148,7 +148,7 @@ class SubjectiveFileDialog(QWidget):

def __init__(
self,
*args: QWidget | WindowType | None,
*args: QWidget | Qt.WindowType | None,
single: bool = True,
dialog_root: Path | None = None,
) -> None:
Expand Down Expand Up @@ -218,6 +218,6 @@ def __init__(self, *args: QWidget, **kwargs: QWidget) -> None:
self.stateChanged.connect(self.subject.on_next)
self.subject.subscribe(self.update_ui)

def update_ui(self, value: CheckState) -> None:
def update_ui(self, value: Qt.CheckState) -> None:
"""Forwards value change to the UI."""
self.setCheckState(value)

0 comments on commit de57db4

Please sign in to comment.