-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtype_defs.py
54 lines (37 loc) · 1.16 KB
/
type_defs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import typing as t
if t.TYPE_CHECKING:
from zndraw.base import Extension
class RegisterModifier(t.TypedDict):
cls: t.Type["Extension"]
run_kwargs: dict
public: bool
class TimeoutConfig(t.TypedDict):
"""Timeout configuration for the ZnDraw client."""
connection: int
modifier: float
between_calls: float
emit_retries: int
call_retries: int
connect_retries: int
class JupyterConfig(t.TypedDict):
width: str | int
height: str | int
class CameraData(t.TypedDict):
position: list[float]
target: list[float]
class ASEDict(t.TypedDict):
numbers: list[int]
positions: list[list[float]]
connectivity: list[tuple[int, int, int]]
arrays: dict[str, list[float | int | list[float | int]]]
info: dict[str, float | int]
# calc: dict[str, float|int|np.ndarray] # should this be split into arrays and info?
pbc: list[bool]
cell: list[list[float]]
vectors: list[list[list[float]]]
constraints: list[dict]
class ASEJson(t.TypedDict):
_type: t.Literal["ase.Atoms"]
value: ASEDict
# Type hint is string, but correctly it is 'json.dumps(ASEJson)'
ATOMS_LIKE = t.Union[ASEDict, str]