Skip to content

Commit 2ed259e

Browse files
committed
feature/python-sdk-refactor Generated better docstrings and type annotations for bunq_context.
1 parent 2064d20 commit 2ed259e

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

bunq/sdk/context/bunq_context.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import bunq
12
from bunq.sdk.context.api_context import ApiContext
23
from bunq.sdk.context.user_context import UserContext
34
from bunq.sdk.exception.bunq_exception import BunqException
@@ -19,30 +20,34 @@ def __init__(self):
1920
raise TypeError(self._ERROR_CLASS_SHOULD_NOT_BE_INITIALIZED)
2021

2122
@classmethod
22-
def load_api_context(cls, api_context):
23-
"""
24-
:type api_context: ApiContext
23+
def load_api_context(cls, api_context: bunq.sdk.context.api_context.ApiContext) -> None:
2524
"""
2625
26+
:param api_context:
27+
:type api_context: bunq.sdk.context.api_context.ApiContext
28+
"""
2729
cls._api_context = api_context
2830
cls._user_context = UserContext(api_context.session_context.user_id)
2931
cls._user_context.init_main_monetary_account()
3032

3133
@classmethod
32-
def api_context(cls):
33-
"""
34-
:rtype: ApiContext
34+
def api_context(cls) -> bunq.sdk.context.api_context.ApiContext:
3535
"""
3636
37+
:return:
38+
:rtype: bunq.sdk.context.api_context.ApiContext
39+
"""
3740
if cls._api_context is not None:
3841
return cls._api_context
3942

4043
raise BunqException(cls._ERROR_API_CONTEXT_HAS_NOT_BEEN_LOADED)
4144

4245
@classmethod
43-
def user_context(cls):
46+
def user_context(cls) -> bunq.sdk.context.user_context.UserContext:
4447
"""
45-
:rtype: UserContext
48+
49+
:return:
50+
:rtype: bunq.sdk.context.user_context.UserContext
4651
"""
4752

4853
if cls._user_context is not None:
@@ -51,9 +56,11 @@ def user_context(cls):
5156
raise BunqException(cls._ERROR_USER_CONTEXT_HAS_NOT_BEEN_LOADED)
5257

5358
@classmethod
54-
def update_api_context(cls, api_context: ApiContext):
59+
def update_api_context(cls, api_context: bunq.sdk.context.api_context.ApiContext) -> None:
5560
"""
56-
:type api_context: ApiContext
61+
62+
:param api_context:
63+
:type api_context: bunq.sdk.context.api_context.ApiContext
5764
"""
5865

5966
cls._api_context = api_context

0 commit comments

Comments
 (0)