Skip to content

Commit

Permalink
💬 add type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
arafune committed Nov 22, 2023
1 parent 566b27f commit b0caf44
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion arpes/endstations/plugin/ANTARES.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def parse_axis_name_from_long_name(name, keep_segments=1, separator="_"):
return separator.join(segments)


def infer_scan_type_from_data(group):
def infer_scan_type_from_data(group) -> str:
"""Determines the scan type for NeXuS format data.
Because ANTARES stores every possible data type in the NeXuS file format, zeroing information
Expand Down
4 changes: 2 additions & 2 deletions arpes/models/band.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ def fermi_velocity(self) -> xr.DataArray:
return self.velocity.sel(eV=0, method="nearest")

@property
def band_width(self):
def band_width(self) -> None:
"""The width along the band."""
return

def band_energy(self, coordinates):
"""The energy coordinate along the band."""

@property
def self_energy(self):
def self_energy(self) -> None:
"""Calculates the self energy along the band."""
return

Expand Down
2 changes: 1 addition & 1 deletion arpes/utilities/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ def translate_from_field(x):

# close over the translation function
def build_setter(translate, name):
def setter(value):
def setter(value) -> None:
try:
value = translate(value)
except ValueError:
Expand Down
7 changes: 6 additions & 1 deletion arpes/xarray_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2329,7 +2329,12 @@ def correct_angle_by(
class GenericAccessorTools:
_obj: xr.DataArray | xr.Dataset | None = None

def round_coordinates(self, coords, *, as_indices: bool = False) -> dict:
def round_coordinates(
self,
coords: dict[str, list[float] | NDArray[np.float_]],
*,
as_indices: bool = False,
) -> dict:
assert isinstance(self._obj, xr.DataArray | xr.Dataset)
data = self._obj
rounded = {
Expand Down

0 comments on commit b0caf44

Please sign in to comment.