Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
Format: Run Black
Browse files Browse the repository at this point in the history
  • Loading branch information
jwijenbergh committed Mar 7, 2024
1 parent 89111e1 commit 47d9e99
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 13 deletions.
9 changes: 6 additions & 3 deletions genexportsdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand All @@ -26,14 +26,17 @@
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

Expand Down
8 changes: 4 additions & 4 deletions wrappers/python/docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 21 additions & 4 deletions wrappers/python/eduvpn_common/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def __str__(self) -> str:
return "Secure Internet Server"
return "Unknown Server"


class Jar(object):
"""A cookie jar"""

Expand Down Expand Up @@ -289,7 +290,9 @@ def set_secure_location(self, org_id: str, country_code: str) -> None:
: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
Expand Down Expand Up @@ -347,7 +350,14 @@ def start_failover(
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,
Expand All @@ -367,7 +377,9 @@ def cancel(self):


@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
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion wrappers/python/example/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion wrappers/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ def run(self):
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)

Expand Down

0 comments on commit 47d9e99

Please sign in to comment.