Skip to content

Commit acceafd

Browse files
committed
Refactor type hints to use Optional and set default values
Updated type hints in events.py and shellusers.py to use Optional for nullable fields. Set default values for optional parameters in ShellUsers methods to improve clarity and type safety.
1 parent 8d22bda commit acceafd

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/webdock/webdock/events.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import List, Literal, TypedDict
3+
from typing import List, Literal, Optional, TypedDict
44

55

66

@@ -41,7 +41,7 @@
4141
class EventsType(TypedDict):
4242
id: int
4343
startTime: str
44-
endTime: str | None
44+
endTime: Optional[str | None]
4545
callbackId: str
4646
serverSlug: str
4747
eventType: EventType

src/webdock/webdock/shellusers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import List, TypedDict
3+
from typing import List, Optional, TypedDict
44

55

66

@@ -70,9 +70,9 @@ def create(
7070
serverSlug: str,
7171
username: str,
7272
password: str,
73-
group: str | None = None,
74-
shell: str | None = None,
75-
publicKeys: List[int] | None = None,
73+
group: Optional[str] = None,
74+
shell: Optional[str] = None,
75+
publicKeys: Optional[List[int]] = [],
7676
) -> CreateShellUserResponseType:
7777
return req(
7878
RequestOptions(
@@ -112,7 +112,7 @@ def list(self, *, serverSlug: str) -> ListShellUsersResponseType:
112112

113113
)
114114

115-
def edit(self, *, slug: str, id: int, keys: List[int]) -> CreateShellUserResponseType:
115+
def edit(self, *, slug: str, id: int, keys: List[int] = []) -> CreateShellUserResponseType:
116116
return req(
117117
RequestOptions(
118118
endpoint=f"servers/{slug}/shellUsers/{id}",

0 commit comments

Comments
 (0)