MCPcopy
hub / github.com/SwanHubX/SwanLab / list_users

Function list_users

swanlab/cli/api/self_hosted.py:70–84  ·  view source on GitHub ↗

List users in the self-hosted instance.

(page_num: int, page_size: int, fetch_all: bool, save_name: str, api: Api)

Source from the content-addressed store, hash-verified

68)
69@with_custom_host
70def list_users(page_num: int, page_size: int, fetch_all: bool, save_name: str, api: Api):
71 """List users in the self-hosted instance."""
72 sh = api.self_hosted()
73 try:
74 users = list(sh.get_users(page=page_num, size=page_size, all=fetch_all))
75 except ValueError as e:
76 payload = format_output(ApiResponseType(ok=False, errmsg=str(e)))
77 else:
78 if sh._errors:
79 payload = format_output(ApiResponseType(ok=False, errmsg="; ".join(sh._errors)))
80 else:
81 resp = ApiResponseType(ok=True, data={"list": users})
82 payload = format_output(resp)
83 if save_name is not None:
84 save_output(orjson.dumps(payload, option=orjson.OPT_INDENT_2), name=save_name)
85
86
87@selfhosted_cli.command("list-projects")

Callers

nothing calls this directly

Calls 6

format_outputFunction · 0.90
ApiResponseTypeClass · 0.90
save_outputFunction · 0.90
self_hostedMethod · 0.80
get_usersMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…