diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-04-24 11:08:09 +0200 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2023-09-25 09:43:37 +0200 |
| commit | 6e12ee1b85c861ea9ed8edabee2f351a76a148c1 (patch) | |
| tree | 20f263eb4feeb157ae55050e5b9db1a8b470de07 /wrappers | |
| parent | 924dd1fdec6cf4d1d5a304e2f5a1a1d7662372bb (diff) | |
Wrappers Python: Get rid of optional as return
If an error is non-nil, the data is guaranteed to contain a value
For discovery we do not explicitly forward errors (TODO, log in
the wrapper?). However, when building in release mode, we have embedded
disco so even if we get an error we should have guaranteed that it contains a value
Diffstat (limited to 'wrappers')
| -rw-r--r-- | wrappers/python/eduvpn_common/main.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/wrappers/python/eduvpn_common/main.py b/wrappers/python/eduvpn_common/main.py index 5d08ba9..5608562 100644 --- a/wrappers/python/eduvpn_common/main.py +++ b/wrappers/python/eduvpn_common/main.py @@ -134,29 +134,29 @@ class EduVPN(object): if add_err: forwardError(add_err) - def get_expiry_times(self) -> Optional[str]: + def get_expiry_times(self) -> str: expiry, expiry_err = self.go_function(self.lib.ExpiryTimes) if expiry_err: forwardError(expiry_err) return expiry - def get_current_server(self) -> Optional[str]: + def get_current_server(self) -> str: server, server_err = self.go_function(self.lib.CurrentServer) if server_err: forwardError(server_err) return server - def get_disco_organizations(self) -> Optional[str]: + def get_disco_organizations(self) -> str: orgs, _ = self.go_cookie_function(self.lib.DiscoOrganizations) # TODO: Log error return orgs - def get_disco_servers(self) -> Optional[str]: + def get_disco_servers(self) -> str: servers, _ = self.go_cookie_function(self.lib.DiscoServers) # TODO: Log error return servers - def get_servers(self) -> Optional[str]: + def get_servers(self) -> str: servers, servers_err = self.go_function(self.lib.ServerList) if servers_err: forwardError(servers_err) @@ -177,7 +177,7 @@ class EduVPN(object): def get_config( self, _type: ServerType, identifier: str, prefer_tcp: bool = False - ) -> Optional[str]: + ) -> str: """Get an OpenVPN/WireGuard configuration from the server :param _type: ServerType: The type of server e.g. SERVER.INSTITUTE_ACCESS |
