Exemplo n.º 1
0
def config_wrapper(ret: Any) -> None:
    if ret.name == "DOWNLOAD_DELEGATE" and ret.value is not None:
        try:
            driver_cls: Type[BaseDownloadService] = stevedore.DriverManager(
                namespace=namespace.DOWNLOAD_DELEGATE,
                name=ret.value,
                invoke_on_load=False,
            ).driver

            driver_cls.check_dep()

        except NoMatches:
            entry_points = importlib_metadata.entry_points(
                group=namespace.DOWNLOAD_DELEGATE)
            available = ", ".join([f"'{x.name}'" for x in entry_points])
            print_error(f"{ret.value} if not a registered download delegate\n"
                        f"available download delegate are {available}")

    result = config(ret.name, ret.value)
    if (not ret.name) and (not ret.value):
        print(result["message"])
    else:
        globals()["print_{}".format(result["status"])](result["message"])
Exemplo n.º 2
0
Arquivo: cli.py Projeto: canbion/BGmi
def config_wrapper(ret):
    result = config(ret.name, ret.value)
    if (not ret.name) and (not ret.value):
        print(result['message'])
    else:
        globals()["print_{}".format(result['status'])](result['message'])
Exemplo n.º 3
0
Arquivo: cli.py Projeto: RicterZ/BGmi
def config_wrapper(ret):
    result = config(ret.name, ret.value)
    if (not ret.name) and (not ret.value):
        print(result['message'])
    else:
        globals()["print_{}".format(result['status'])](result['message'])
Exemplo n.º 4
0
def config_wrapper(ret: Any) -> None:
    result = config(ret.name, ret.value)
    if (not ret.name) and (not ret.value):
        print(result["message"])
    else:
        globals()["print_{}".format(result["status"])](result["message"])