Skip to content

Commit 62623d5

Browse files
fix docstr / type hinting
1 parent caca6d8 commit 62623d5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

mp_api/client/routes/materials/grain_boundaries.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def search(
2020
gb_plane: list[str] | None = None,
2121
gb_energy: tuple[float, float] | None = None,
2222
pretty_formula: str | None = None,
23-
rotation_axis: tuple[str | float, str | float, str | float] | None = None,
23+
rotation_axis: tuple[int, int, int] | tuple[int, int, int, int] | None = None,
2424
rotation_angle: tuple[float, float] | None = None,
2525
separation_energy: tuple[float, float] | None = None,
2626
sigma: int | None = None,
@@ -40,9 +40,9 @@ def search(
4040
material_ids (List[str]): List of Materials Project IDs to query with.
4141
pretty_formula (str): Formula of the material.
4242
rotation_angle (Tuple[float,float]): Minimum and maximum rotation angle in degrees to consider.
43-
rotation_axis(List[str]): The Miller index of rotation axis.
44-
A three-tuple of either int or str: e.g.,
45-
[1, 0, 0], [1, 1, 0], ["1", "1", "1"]
43+
rotation_axis (tuple of 3 int or of 4 int): The Miller index of rotation axis.
44+
A 3- or 4-tuple of int or str: e.g.,
45+
(0, 0, 0, 1), (1, 0, 0), (1, 1, 0), or (1, 1, 1)
4646
sigma (int): Sigma value of grain boundary.
4747
separation_energy (Tuple[float,float]): Minimum and maximum work of separation energy in J/m³ to consider.
4848
sigma (int): Sigma value of the boundary.
@@ -86,9 +86,10 @@ def search(
8686
)
8787

8888
if rotation_axis:
89-
if len(rotation_axis) != 3:
89+
if len(rotation_axis) not in {3, 4}:
9090
raise ValueError(
91-
'`rotation_axis` should be a three-tuple of either int or str, ex: (1,1,0), ("0","0","1")'
91+
"`rotation_axis` should be a tuple of either "
92+
"3 or 4 int values, ex: (0, 0, 0, 1) or (1, 0, 0)"
9293
)
9394
query_params.update(
9495
{"rotation_axis": ",".join([str(n) for n in rotation_axis])}

0 commit comments

Comments
 (0)