mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 09:01:54 +08:00
new typing style
This commit is contained in:
@@ -26,7 +26,6 @@ import tempfile
|
||||
import builtins
|
||||
import getpass
|
||||
|
||||
from typing import List
|
||||
from typing import Generator
|
||||
from typing import Any
|
||||
|
||||
@@ -54,7 +53,7 @@ def _htpasswd_fixture(request) -> Generator[passlib.apache.HtpasswdFile, None, N
|
||||
os.remove(path)
|
||||
|
||||
|
||||
def _run_htpasswd(cmd: List[str], htpasswd_path: str, internal_type: str="htpasswd") -> None:
|
||||
def _run_htpasswd(cmd: list[str], htpasswd_path: str, internal_type: str="htpasswd") -> None:
|
||||
cmd = ["kvmd-htpasswd", *cmd, "--set-options"]
|
||||
if internal_type != "htpasswd": # By default
|
||||
cmd.append("kvmd/auth/internal/type=" + internal_type)
|
||||
|
||||
@@ -23,10 +23,7 @@
|
||||
import os
|
||||
import contextlib
|
||||
|
||||
from typing import List
|
||||
from typing import Dict
|
||||
from typing import AsyncGenerator
|
||||
from typing import Optional
|
||||
|
||||
import passlib.apache
|
||||
|
||||
@@ -40,7 +37,7 @@ from kvmd.plugins.auth import get_auth_service_class
|
||||
|
||||
|
||||
# =====
|
||||
def _make_service_kwargs(path: str) -> Dict:
|
||||
def _make_service_kwargs(path: str) -> dict:
|
||||
cls = get_auth_service_class("htpasswd")
|
||||
scheme = cls.get_plugin_options()
|
||||
return make_config({"file": path}, scheme)._unpack()
|
||||
@@ -50,7 +47,7 @@ def _make_service_kwargs(path: str) -> Dict:
|
||||
async def _get_configured_manager(
|
||||
internal_path: str,
|
||||
external_path: str="",
|
||||
force_internal_users: Optional[List[str]]=None,
|
||||
force_internal_users: (list[str] | None)=None,
|
||||
) -> AsyncGenerator[AuthManager, None]:
|
||||
|
||||
manager = AuthManager(
|
||||
|
||||
Reference in New Issue
Block a user