summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-03-07 15:09:22 +0100
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2024-03-07 15:19:43 +0100
commit47d9e993ce43c4238810a2533a81a24ee701f155 (patch)
tree88932810d6c13eb3d8be05c48fe756159377d45e
parent89111e1aef8a5bfbaa3b196b5cf27e768d225728 (diff)
Format: Run Black
-rwxr-xr-xgenexportsdoc.py9
-rw-r--r--wrappers/python/docs/source/conf.py8
-rw-r--r--wrappers/python/eduvpn_common/main.py25
-rw-r--r--wrappers/python/example/main.py4
-rwxr-xr-xwrappers/python/setup.py4
5 files changed, 37 insertions, 13 deletions
diff --git a/genexportsdoc.py b/genexportsdoc.py
index ed538b2..dc32182 100755
--- a/genexportsdoc.py
+++ b/genexportsdoc.py
@@ -2,9 +2,9 @@
import subprocess
-cmd=["go", "doc", "--all", "exports"]
+cmd = ["go", "doc", "--all", "exports"]
-output=subprocess.check_output(cmd).decode("utf-8")
+output = subprocess.check_output(cmd).decode("utf-8")
section = [""]
package_doc = ""
@@ -26,14 +26,17 @@ for out in output.splitlines():
if in_section:
section[num] += line
+
def func_name(signature: str) -> str:
idx = signature.index("(")
- return signature[len("func "):idx]
+ return signature[len("func ") : idx]
+
def gen_toc(title: str) -> str:
id = "-".join(title.lower().split(" "))
return f"[{title}](#{id})"
+
toc = ""
first = True
diff --git a/wrappers/python/docs/source/conf.py b/wrappers/python/docs/source/conf.py
index 57638c5..1a2ab32 100644
--- a/wrappers/python/docs/source/conf.py
+++ b/wrappers/python/docs/source/conf.py
@@ -7,10 +7,10 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import sphinx_rtd_theme
-project = 'python-eduvpn-common'
-copyright = '2023, Jeroen Wijenbergh'
-author = 'Jeroen Wijenbergh'
-release = '1.1.2'
+project = "python-eduvpn-common"
+copyright = "2023, Jeroen Wijenbergh"
+author = "Jeroen Wijenbergh"
+release = "1.1.2"
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
diff --git a/wrappers/python/eduvpn_common/main.py b/wrappers/python/eduvpn_common/main.py
index e96f7e2..2b60bce 100644
--- a/wrappers/python/eduvpn_common/main.py
+++ b/wrappers/python/eduvpn_common/main.py
@@ -49,6 +49,7 @@ class ServerType(IntEnum):
return "Secure Internet Server"
return "Unknown Server"
+
class Jar(object):
"""A cookie jar"""
@@ -289,7 +290,9 @@ class EduVPN(object):
:raises WrappedError: An error by the Go library
"""
# Set the location by country code
- location_err = self.go_function(self.lib.SetSecureLocation, org_id, country_code)
+ location_err = self.go_function(
+ self.lib.SetSecureLocation, org_id, country_code
+ )
# If there is a location event, set it so that the wait callback finishes
# And so that the Go code can move to the next state
@@ -347,7 +350,14 @@ class EduVPN(object):
forwardError(dropped_err)
return dropped
- def start_proxyguard(self, listen: str, source_port: int, peer: str, setup: ProxySetup, ready: ProxyReady):
+ def start_proxyguard(
+ self,
+ listen: str,
+ source_port: int,
+ peer: str,
+ setup: ProxySetup,
+ ready: ProxyReady,
+ ):
proxy_err = self.go_cookie_function(
self.lib.StartProxyguard,
listen,
@@ -367,7 +377,9 @@ global_object: Optional[EduVPN] = None
@TokenSetter
-def token_setter(server_id: ctypes.c_char_p, server_type: ctypes.c_int, tokens: ctypes.c_char_p):
+def token_setter(
+ server_id: ctypes.c_char_p, server_type: ctypes.c_int, tokens: ctypes.c_char_p
+):
global global_object
if global_object is None:
return
@@ -377,7 +389,12 @@ def token_setter(server_id: ctypes.c_char_p, server_type: ctypes.c_int, tokens:
@TokenGetter
-def token_getter(server_id: ctypes.c_char_p, server_type: ctypes.c_int, buf: ctypes.c_char_p, size: ctypes.c_size_t):
+def token_getter(
+ server_id: ctypes.c_char_p,
+ server_type: ctypes.c_int,
+ buf: ctypes.c_char_p,
+ size: ctypes.c_size_t,
+):
global global_object
if global_object is None:
return
diff --git a/wrappers/python/example/main.py b/wrappers/python/example/main.py
index 92472d2..68e1286 100644
--- a/wrappers/python/example/main.py
+++ b/wrappers/python/example/main.py
@@ -99,7 +99,9 @@ def do_secure_internet(edu: eduvpn.EduVPN) -> Optional[Config]:
# The main entry point
if __name__ == "__main__":
- _eduvpn = eduvpn.EduVPN("org.eduvpn.app.linux", f"{commonver}-cli-py", "configs", "en")
+ _eduvpn = eduvpn.EduVPN(
+ "org.eduvpn.app.linux", f"{commonver}-cli-py", "configs", "en"
+ )
setup_callbacks(_eduvpn)
# Register with the eduVPN-common library
diff --git a/wrappers/python/setup.py b/wrappers/python/setup.py
index f19be57..143b6a5 100755
--- a/wrappers/python/setup.py
+++ b/wrappers/python/setup.py
@@ -106,7 +106,9 @@ class bdist_wheel(_bdist_wheel):
if os.path.isdir(p):
shutil.rmtree(p)
os.makedirs(p)
- shutil.copyfile(self.exports_lib_path + "/" + libpath, p+"/"+libpath.split("/")[-1])
+ shutil.copyfile(
+ self.exports_lib_path + "/" + libpath, p + "/" + libpath.split("/")[-1]
+ )
_bdist_wheel.run(self)
shutil.rmtree(p)