diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-03-23 12:35:46 +0100 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2023-09-25 09:43:37 +0200 |
| commit | 32e734b4f53595bc0d4fdea4206e852d0848c399 (patch) | |
| tree | e63a123a0b005535735586da4578d77324e17cf4 /wrappers/python/eduvpn_common/main.py | |
| parent | 498b747669e97e8af414a369433c04371396f08c (diff) | |
Wrappers Python: Separate BoolError data type to get rid of decode_func
Diffstat (limited to 'wrappers/python/eduvpn_common/main.py')
| -rw-r--r-- | wrappers/python/eduvpn_common/main.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/wrappers/python/eduvpn_common/main.py b/wrappers/python/eduvpn_common/main.py index 2c5c71e..d8e35f9 100644 --- a/wrappers/python/eduvpn_common/main.py +++ b/wrappers/python/eduvpn_common/main.py @@ -44,24 +44,20 @@ class EduVPN(object): initialize_functions(self.lib) def go_function( - self, func: Any, *args: Iterator, decode_func: Optional[Callable] = None + self, func: Any, *args: Iterator ) -> Any: """Call an internal go function and properly forward the arguments. Also handles decoding the result :param func: Any: The Go function to call from the shared library :param \*args: Iterator: The arguments to call the function with - :param decode_func: Optional[Callable]: (Default value = None): The function to decode the result into a Python type :meta private: """ # The functions all have at least one arg type which is the name of the client args_gen = encode_args(list(args), func.argtypes) res = func(*(args_gen)) - if decode_func is None: - return decode_res(func.restype)(self.lib, res) - else: - return decode_func(self.lib, res) + return decode_res(func.restype)(self.lib, res) def cancel_oauth(self) -> None: """Cancel the OAuth process""" @@ -272,7 +268,6 @@ class EduVPN(object): gateway, wg_mtu, readrxbytes, - decode_func=lambda lib, x: get_data_error(lib, x, get_bool), ) if dropped_err: forwardError(dropped_err) |
