Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 18.119.124.24
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/2/task/2/cwd/usr/lib/python3/dist-packages/ansible_test/_internal/cli/parsers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/2/task/2/cwd/usr/lib/python3/dist-packages/ansible_test/_internal/cli/parsers/helpers.py
"""Helper functions for composite parsers."""
from __future__ import annotations

from ...constants import (
    CONTROLLER_PYTHON_VERSIONS,
    SUPPORTED_PYTHON_VERSIONS,
)

from ...completion import (
    docker_completion,
    remote_completion,
    filter_completion,
)

from ...host_configs import (
    DockerConfig,
    HostConfig,
    PosixRemoteConfig,
)


def get_docker_pythons(name: str, controller: bool, strict: bool) -> list[str]:
    """Return a list of docker instance Python versions supported by the specified host config."""
    image_config = filter_completion(docker_completion()).get(name)
    available_pythons = CONTROLLER_PYTHON_VERSIONS if controller else SUPPORTED_PYTHON_VERSIONS

    if not image_config:
        return [] if strict else list(available_pythons)

    supported_pythons = [python for python in image_config.supported_pythons if python in available_pythons]

    return supported_pythons


def get_remote_pythons(name: str, controller: bool, strict: bool) -> list[str]:
    """Return a list of remote instance Python versions supported by the specified host config."""
    platform_config = filter_completion(remote_completion()).get(name)
    available_pythons = CONTROLLER_PYTHON_VERSIONS if controller else SUPPORTED_PYTHON_VERSIONS

    if not platform_config:
        return [] if strict else list(available_pythons)

    supported_pythons = [python for python in platform_config.supported_pythons if python in available_pythons]

    return supported_pythons


def get_controller_pythons(controller_config: HostConfig, strict: bool) -> list[str]:
    """Return a list of controller Python versions supported by the specified host config."""
    if isinstance(controller_config, DockerConfig):
        pythons = get_docker_pythons(controller_config.name, False, strict)
    elif isinstance(controller_config, PosixRemoteConfig):
        pythons = get_remote_pythons(controller_config.name, False, strict)
    else:
        pythons = list(SUPPORTED_PYTHON_VERSIONS)

    return pythons

Anon7 - 2022
AnonSec Team