Skip to content

Commit 6e3948b

Browse files
refine type hint and docstring
1 parent e541fc2 commit 6e3948b

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

ppsci/constraint/boundary_constraint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class BoundaryConstraint(base.Constraint):
4747
Defaults to None.
4848
evenly (bool, optional): Whether to use evenly distribution sampling.
4949
Defaults to False.
50-
weight_dict (Optional[Dict[str, Callable]]): Define the weight of each
50+
weight_dict (Optional[Dict[str, Union[float, Callable]]]): Define the weight of each
5151
constraint variable. Defaults to None.
5252
name (str, optional): Name of constraint object. Defaults to "BC".
5353
@@ -78,7 +78,7 @@ def __init__(
7878
random: Literal["pseudo", "LHS"] = "pseudo",
7979
criteria: Optional[Callable] = None,
8080
evenly: bool = False,
81-
weight_dict: Optional[Dict[str, Callable]] = None,
81+
weight_dict: Optional[Dict[str, Union[float, Callable]]] = None,
8282
name: str = "BC",
8383
):
8484
self.output_expr = output_expr

ppsci/data/dataset/array_dataset.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ def __init__(
4949
super().__init__()
5050
self.input = input
5151
self.label = label
52+
self.input_keys = tuple(input.keys())
53+
self.label_keys = tuple(label.keys())
5254
self.weight = weight
5355
self.transforms = transforms
5456
self._len = len(next(iter(input.values())))

ppsci/data/dataset/csv_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def __init__(
178178
label_keys: Tuple[str, ...],
179179
alias_dict: Optional[Dict[str, str]] = None,
180180
weight_dict: Optional[Dict[str, Union[Callable, float]]] = None,
181-
timestamps: Optional[Tuple[Union[int, float], ...]] = None,
181+
timestamps: Optional[Tuple[float, ...]] = None,
182182
transforms: Optional[vision.Compose] = None,
183183
):
184184
super().__init__()

ppsci/data/dataset/mat_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def __init__(
178178
label_keys: Tuple[str, ...] = (),
179179
alias_dict: Optional[Dict[str, str]] = None,
180180
weight_dict: Optional[Dict[str, Union[Callable, float]]] = None,
181-
timestamps: Optional[Tuple[Union[int, float], ...]] = None,
181+
timestamps: Optional[Tuple[float, ...]] = None,
182182
transforms: Optional[vision.Compose] = None,
183183
):
184184
super().__init__()

ppsci/data/process/transform/preprocess.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Translate:
3131
>>> translate = ppsci.data.transform.Translate({"x": 1.0, "y": -1.0})
3232
"""
3333

34-
def __init__(self, offset: Dict[str, Union[int, float]]):
34+
def __init__(self, offset: Dict[str, float]):
3535
self.offset = offset
3636

3737
def __call__(self, data_dict):
@@ -53,7 +53,7 @@ class Scale:
5353
>>> translate = ppsci.data.transform.Scale({"x": 1.5, "y": 2.0})
5454
"""
5555

56-
def __init__(self, scale: Dict[str, Union[int, float]]):
56+
def __init__(self, scale: Dict[str, float]):
5757
self.scale = scale
5858

5959
def __call__(self, data_dict):

0 commit comments

Comments
 (0)