Skip to content

Commit 7415f28

Browse files
authored
Restrict beta param type for join_beta_program (#323)
## 📝 Description A small improvement to better restrict the `beta` param type to be one of the `Union[str, BetaProgram]` when calling `join_beta_program()`. ## ✔️ How to Test `tox`
1 parent 24dae23 commit 7415f28

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

linode_api4/groups/account.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
from typing import Union
2+
13
from linode_api4.errors import UnexpectedResponseError
24
from linode_api4.groups import Group
35
from linode_api4.objects import (
46
Account,
57
AccountBetaProgram,
68
AccountSettings,
7-
Base,
9+
BetaProgram,
810
Event,
911
Invoice,
1012
Login,
@@ -462,7 +464,7 @@ def enrolled_betas(self, *filters):
462464
"""
463465
return self.client._get_and_filter(AccountBetaProgram, *filters)
464466

465-
def join_beta_program(self, beta):
467+
def join_beta_program(self, beta: Union[str, BetaProgram]):
466468
"""
467469
Enrolls an account into a beta program.
468470
@@ -477,7 +479,7 @@ def join_beta_program(self, beta):
477479

478480
self.client.post(
479481
"/account/betas",
480-
data={"id": beta.id if issubclass(type(beta), Base) else beta},
482+
data={"id": beta.id if isinstance(beta, BetaProgram) else beta},
481483
)
482484

483485
return True

0 commit comments

Comments
 (0)