Skip to content

Commit

Permalink
Fix Python<3.10 incompatible syntax (thanks @patel-zeel)
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-andersson committed Sep 26, 2023
1 parent 9be6721 commit 7793a71
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions deepsensor/data/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TaskLoader:

def __init__(
self,
task_loader_ID: str | None = None,
task_loader_ID: Union[str, None] = None,
context: Union[
xr.DataArray,
xr.Dataset,
Expand All @@ -35,7 +35,7 @@ def __init__(
] = None,
aux_at_contexts: Union[xr.DataArray, xr.Dataset, str] = None,
aux_at_targets: Union[xr.DataArray, xr.Dataset, str] = None,
links: List[Tuple[int, int]] | None = None,
links: Union[List[Tuple[int, int]], None] = None,
context_delta_t: Union[int, List[int]] = 0,
target_delta_t: Union[int, List[int]] = 0,
time_freq: str = "D",
Expand Down
6 changes: 3 additions & 3 deletions deepsensor/data/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ class DataProcessor:

def __init__(
self,
folder: str | None = None,
folder: Union[str, None] = None,
time_name: str = "time",
x1_name: str = "x1",
x2_name: str = "x2",
x1_map: tuple | None = None,
x2_map: tuple | None = None,
x1_map: Union[tuple, None] = None,
x2_map: Union[tuple, None] = None,
deepcopy: bool = True,
verbose: bool = False,
):
Expand Down
4 changes: 3 additions & 1 deletion deepsensor/model/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
compute_pandas_data_resolution,
)

from typing import List


def gen_ppu(task_loader: TaskLoader) -> int:
"""Computes data-informed settings for the model's internal grid density (ppu, points per unit)
Expand Down Expand Up @@ -55,7 +57,7 @@ def gen_decoder_scale(model_ppu: int) -> float:
return 1 / model_ppu


def gen_encoder_scales(model_ppu: int, task_loader: TaskLoader) -> list[float]:
def gen_encoder_scales(model_ppu: int, task_loader: TaskLoader) -> List[float]:
"""Computes data-informed settings for the encoder SetConv scale for each context set
This sets the length scale of the Gaussian basis functions used to encode the context sets.
Expand Down

0 comments on commit 7793a71

Please sign in to comment.