from threading import Thread
from _typeshed import Incomplete

GLOBAL_CONFIG: Incomplete
CPYTHON_ENVIRONMENT: Incomplete
JYTHON_ENVIRONMENT: Incomplete
IRON_PYTHON_ENVIRONMENT: Incomplete
DEFAULT_LOGGER: str
DEFAULT_LOGGING_LEVEL: Incomplete
DEFAULT_LOGGING_FORMAT: str
DEFAULT_LOGGING_FILE_NAME_PREFIX: str
DEFAULT_LOGGING_FILE_NAME_SEPARATOR: str
DEFAULT_LOGGING_FILE_NAME_EXTENSION: str
DEFAULT_LOGGING_ERR_FILE_NAME_EXTENSION: str
DEFAULT_LOGGING_FILE_MODE: str
DEFAULT_LOGGING_FILE_SIZE: int
DEFAULT_LOGGING_FILE_BACKUP_COUNT: int
DEFAULT_CONTAINERS_PATH: str
DEFAULT_LIBRARIES_PATH: str
DEFAULT_TEMPORARY_PATH: str
DEFAULT_VARIABLE_PATH: str
DEFAULT_PLUGIN_PATH: str
DEFAULT_CONFIGURATION_PATH: str
DEFAULT_PLUGIN_PATHS_FILE_PATH: str
DEFAULT_WORKSPACE_PATH: str
DEFAULT_UNLOAD_SYSTEM_TIMEOUT: float
EAGER_LOADING_TYPE: str
LAZY_LOADING_TYPE: str
PLUGIN_MANAGER_EXTENSION_TYPE: str
MAIN_TYPE: str
STARTUP_TYPE: str
THREAD_TYPE: str
FULL_LOAD_TYPE: str
DEPENDENCY_TYPE: str
ALLOWED_TYPE: str
SINGLETON_DIFFUSION_SCOPE: int
SAME_DIFFUSION_SCOPE: int
NEW_DIFFUSION_SCOPE: int
FILE_REMOVED_TYPE: str
SPECIAL_VALUE_REGEX_VALUE: str
SPECIAL_VALUE_REGEX: Incomplete
ALIAS_MAP: Incomplete

class System:
    plugin: Plugin | None

    def __init__(self, plugin) -> None: ...
    def get_manager(self): ...
    def debug(self, *args, **kwargs): ...
    def info(self, *args, **kwargs): ...
    def warning(self, *args, **kwargs): ...
    def error(self, *args, **kwargs): ...
    def critical(self, *args, **kwargs): ...

class Plugin:
    id: Incomplete
    name: Incomplete
    description: Incomplete
    version: Incomplete
    author: Incomplete
    loading_type = EAGER_LOADING_TYPE
    platforms: Incomplete
    attributes: Incomplete
    capabilities: Incomplete
    capabilities_allowed: Incomplete
    dependencies: Incomplete
    events_fired: Incomplete
    events_handled: Incomplete
    main_modules: Incomplete
    valid: bool
    logger: Incomplete
    timestamp: Incomplete
    dependencies_loaded: Incomplete
    allowed_loaded_capability: Incomplete
    event_plugins_fired_loaded_map: Incomplete
    event_plugins_registered_loaded_map: Incomplete
    event_plugin_manager_registered_loaded_list: Incomplete
    configuration_map: Incomplete
    loaded: bool
    lazy_loaded: bool
    error_state: bool
    exception: Incomplete
    ready_semaphore: Incomplete
    ready_semaphore_lock: Incomplete
    ready_semaphore_release_count: int
    original_id: Incomplete
    diffusion_scope_id: Incomplete
    manager: Incomplete

    def __init__(self, manager: Incomplete | None = ...): ...
    def __repr__(self) -> str: ...
    def load_plugin(self) -> None: ...
    def lazy_load_plugin(self) -> None: ...
    def end_load_plugin(self) -> None: ...
    def unload_plugin(self) -> None: ...
    def end_unload_plugin(self) -> None: ...
    def load_allowed(self, plugin, capability) -> None: ...
    def unload_allowed(self, plugin, capability) -> None: ...
    def dependency_injected(self, plugin) -> None: ...
    def init_complete(self) -> None: ...
    def register_all_handled_events_plugin(self, plugin) -> None: ...
    def unregister_all_handled_events_plugin(self, plugin) -> None: ...
    def register_all_plugin_manager_events(self) -> None: ...
    def unregister_all_plugin_manager_events(self) -> None: ...
    def register_for_plugin_event(self, plugin, event_name) -> None: ...
    def unregister_for_plugin_event(self, plugin, event_name) -> None: ...
    def register_for_plugin_manager_event(self, event_name) -> None: ...
    def unregister_for_plugin_manager_event(self, event_name) -> None: ...
    def unregister_all_for_plugin_event(self, event_name) -> None: ...
    def unregister_all_for_plugin(self) -> None: ...
    def register_plugin_event(self, plugin, event_name) -> None: ...
    def unregister_plugin_event(self, plugin, event_name) -> None: ...
    def notify_handlers(self, event_name, event_args) -> None: ...
    def generate_event(self, event_name, event_args) -> None: ...
    def event_handler(self, event_name, *event_args) -> None: ...
    def reload_main_modules(self): ...
    def get_configuration_property(self, property_name): ...
    def set_configuration_property(self, property_name, property) -> None: ...
    def unset_configuration_property(self, property_name) -> None: ...
    def ensure(self) -> None: ...
    def is_loaded(self): ...
    def is_lazy_loaded(self): ...
    def is_loaded_or_lazy_loaded(self): ...
    def is_replica(self): ...
    def get_attribute(self, attribute_name, default: Incomplete | None = None): ...
    def has_capability(self, capability): ...
    def contains_metadata(self): ...
    def contains_metadata_key(self, metadata_key): ...
    def get_metadata(self): ...
    def get_metadata_key(self, metadata_key): ...
    def treat_exception(self, exception) -> None: ...
    def acquire_ready_semaphore(self) -> None: ...
    def release_ready_semaphore(self) -> None: ...
    def ready_semaphore_status(self): ...
    def get_all_plugin_dependencies(self): ...
    def get_all_package_dependencies(self): ...
    def get_tuple(self): ...
    def get_author_name(self): ...
    def get_uptime(self): ...
    def log_stack_trace(self, level=...) -> None: ...
    def debug(self, message) -> None: ...
    def info(self, message) -> None: ...
    def warning(self, message) -> None: ...
    def error(self, message) -> None: ...
    def critical(self, message) -> None: ...
    def format_logger_message(self, message): ...
    def _get_capabilities_allowed_names(self): ...

class PluginManagerPlugin(Plugin):
    valid: bool
    def __init__(self, manager: Incomplete | None = None) -> None: ...

class PluginManager:
    uid: Incomplete
    logger: Incomplete
    logger_handlers: Incomplete
    platform: Incomplete
    condition: Incomplete
    init_complete: bool
    blacklist: Incomplete
    blacktest: Incomplete
    init_complete_handlers: Incomplete
    main_loop_active: bool
    auto_unload: bool
    allow_threads: bool
    install_signals: bool
    layout_mode: str
    run_mode: str
    container: str
    daemon_pid: Incomplete
    daemon_file_path: Incomplete
    prefix_paths: Incomplete
    configuration_path = DEFAULT_CONFIGURATION_PATH
    workspace_path = DEFAULT_WORKSPACE_PATH
    timestamp: int
    plugin_manager_plugins_loaded: bool
    plugins: Incomplete
    retrieve_lock: Incomplete
    current_id: int
    replica_id: int
    diffusion_scope_id: int
    return_code: int
    event_queue: Incomplete
    manager_path: Incomplete
    logger_path: Incomplete
    library_paths: Incomplete
    plugin_paths: Incomplete
    kill_system_timer: Incomplete
    referred_modules: Incomplete
    loaded_plugins: Incomplete
    loaded_plugins_map: Incomplete
    loaded_plugins_id_map: Incomplete
    id_loaded_plugins_map: Incomplete
    loaded_plugins_descriptions: Incomplete
    plugin_classes: Incomplete
    plugin_classes_map: Incomplete
    plugin_instances: Incomplete
    plugin_instances_map: Incomplete
    plugin_names_map: Incomplete
    plugin_dirs_map: Incomplete
    capabilities_plugin_instances_map: Incomplete
    capabilities_sub_capabilities_map: Incomplete
    plugin_threads: Incomplete
    plugin_threads_map: Incomplete
    plugin_dependent_plugins_map: Incomplete
    plugin_allowed_plugins_map: Incomplete
    capabilities_plugins_map: Incomplete
    diffusion_scope_loaded_plugins_map: Incomplete
    deleted_plugin_classes: Incomplete
    event_plugins_fired_loaded_map: Incomplete
    meta_paths: Incomplete
    stop_on_cycle_error: Incomplete
    whitetest: Incomplete
    exec_delay: Incomplete

    def __init__(
        self,
        manager_path: str = "",
        logger_path: str = "log",
        library_paths=[],
        meta_paths=[],
        plugin_paths=[],
        platform=...,
        init_complete_handlers=[],
        stop_on_cycle_error: bool = True,
        loop: bool = True,
        threads: bool = True,
        signals: bool = True,
        layout_mode: str = "default",
        run_mode: str = "default",
        container: str = "default",
        prefix_paths=[],
        daemon_pid: Incomplete | None = None,
        daemon_file_path: Incomplete | None = None,
    ) -> None: ...
    def create_plugin(self, plugin_id, plugin_version): ...
    def _create_plugin(self, plugin_id, plugin_version, diffusion_scope_id): ...
    def generate_replica_id(self): ...
    def generate_diffusion_scope_id(self): ...
    def start_logger(self, log_level=...) -> None: ...
    def load_system(
        self,
        mode: Incomplete | None = None,
        args: Incomplete | None = None,
        callback: Incomplete | None = None,
    ): ...
    def unload_system(self, thread_safe: bool = True) -> None: ...
    def reload_system(self, thread_safe: bool = True) -> None: ...
    def main_loop(self, timeout: float = 1.0) -> None: ...
    def add_event(self, event) -> None: ...
    def expand_workspace_path(self) -> None: ...
    def create_workspace_path(self) -> None: ...
    def update_workspace_path(self) -> None: ...
    def check_standard_input(self) -> None: ...
    def apply_fixes(self) -> None: ...
    def get_all_modules(self, path, suffix: Incomplete | None = None): ...
    def init_plugin_system(self, configuration) -> None: ...
    def set_python_path(self, library_paths, plugin_paths) -> None: ...
    def load_plugins(self, plugins) -> None: ...
    def start_plugin_manager_plugins(self) -> None: ...
    def start_plugins(self) -> None: ...
    def start_plugin(self, plugin, use_path: bool = True) -> None: ...
    def stop_plugin_complete_by_id(self, plugin_id) -> None: ...
    def stop_module(self, module) -> None: ...
    def stop_plugin(self, plugin) -> None: ...
    def add_plugin_path(self, plugin_path, persist: bool = False) -> None: ...
    def remove_plugin_path(self, plugin_path) -> None: ...
    def persist_plugin_path(self, plugin_path) -> None: ...
    def get_all_plugin_classes(self, base_plugin_class=...): ...
    def get_plugin_sub_classes(self, plugin, plugin_classes) -> None: ...
    def register_plugin_capabilities(self, plugin) -> None: ...
    def unregister_plugin_capabilities(self, plugin) -> None: ...
    def load_plugin_manager_plugins(self) -> None: ...
    def load_startup_plugins(self) -> None: ...
    def load_main_plugins(self) -> None: ...
    def install_signal_handlers(self) -> None: ...
    def notify_load_complete_loaded_plugins(self) -> None: ...
    def notify_load_complete_handlers(self) -> None: ...
    def notify_daemon_file(self) -> None: ...
    def exec_mode(self, mode, args: Incomplete | None = None) -> None: ...
    def run_dry(self, args=[]) -> None: ...
    def run_test(self, verbosity: int = 2, raise_e: bool = True, args=[]): ...
    def __load_plugin(
        self,
        plugin,
        type: Incomplete | None = None,
        loading_type: Incomplete | None = None,
    ): ...
    def _load_plugin(
        self,
        plugin,
        type: Incomplete | None = None,
        loading_type: Incomplete | None = None,
    ): ...
    def _unload_plugin(
        self,
        plugin,
        type: Incomplete | None = None,
        unloading_type: Incomplete | None = None,
    ): ...
    def _unload_thread_plugins(self) -> None: ...
    def test_plugin_load(self, plugin): ...
    def test_dependencies(self, plugin): ...
    def test_platform(self, plugin): ...
    def test_threads(self, plugin): ...
    def test_blacklist(self, plugin): ...
    def resolve_capabilities(self, plugin): ...
    def inject_dependencies(self, plugin): ...
    def inject_allowed(self, plugin): ...
    def _inject_allowed(self, plugin, allowed_plugin, capability) -> None: ...
    def inject_all_allowed(self, plugin) -> None: ...
    def set_plugin_instance_diffusion_scope_loaded_plugins_map(
        self, diffusion_scope_id, plugin_id, plugin_instance
    ) -> None: ...
    def unset_plugin_instance_diffusion_scope_loaded_plugins_map(
        self, diffusion_scope_id, plugin_id
    ) -> None: ...
    def add_plugin_dependent_plugins_map(
        self, plugin_id, dependency_plugin_instance
    ) -> None: ...
    def get_plugin_dependent_plugins_map(self, plugin_id): ...
    def clear_plugin_dependent_plugins_map(self, plugin_id) -> None: ...
    def add_plugin_allowed_plugins_map(
        self, plugin_id, allowed_plugin_info_list
    ) -> None: ...
    def get_plugin_allowed_plugins_map(self, plugin_id): ...
    def clear_plugin_allowed_plugins_map(self, plugin_id) -> None: ...
    def add_capabilities_plugins_map(self, capability, plugin) -> None: ...
    def get_capabilities_plugins_map(self, capability): ...
    def clear_capabilities_plugins_map(self, capability) -> None: ...
    def clear_capabilities_plugins_map_for_plugin(self, plugin_id) -> None: ...
    def load_plugin(self, plugin_id, type: Incomplete | None = None): ...
    def unload_plugin(self, plugin_id, type: Incomplete | None = None): ...
    def get_all_plugins(self): ...
    def get_all_loaded_plugins(self): ...
    def ensure(self, plugin) -> None: ...
    def assert_plugin(self, plugin): ...
    def get_plugin(self, plugin_id, plugin_version: Incomplete | None = None): ...
    def _get_plugin(self, plugin_id, plugin_version: Incomplete | None = None): ...
    def get_plugin_by_id(self, plugin_id): ...
    def _get_plugin_by_id(self, plugin_id) -> Plugin | None: ...
    def get_plugin_by_id_and_version(self, plugin_id, plugin_version): ...
    def _get_plugin_by_id_and_version(
        self, plugin_id, plugin_version
    ) -> Plugin | None: ...
    def get_plugins_by_capability(self, capability): ...
    def _get_plugins_by_capability_cache(self, capability): ...
    def _get_plugins_by_capability(self, capability): ...
    def __get_plugins_by_capability(self, capability): ...
    def get_plugins_by_capability_allowed(self, capability_allowed): ...
    def _get_plugins_by_capability_allowed(self, capability_allowed): ...
    def get_plugins_by_event_fired(self, event_fired): ...
    def _get_plugins_by_event_fired(self, event_fired): ...
    def get_plugins_by_event_handled(self, event_handled): ...
    def _get_plugins_by_event_handled(self, event_handled): ...
    def get_plugins_by_dependency(self, plugin_id): ...
    def _get_plugins_by_dependency(self, plugin_id): ...
    def get_plugins_allow_capability(self, capability): ...
    def _get_plugins_allow_capability(self, capability): ...
    def resolve_file_path(
        self, file_path, not_found_valid: bool = False, create_path: bool = False
    ): ...
    def resolve_string_value(self, string_value): ...
    def get_plugin_path_by_id(self, plugin_id): ...
    def get_temporary_plugin_path_by_id(self, plugin_id, extra_path: str = ""): ...
    def get_temporary_plugin_generated_path_by_id(self, plugin_id): ...
    def get_plugin_configuration_paths_by_id(
        self, plugin_id, extra_paths: bool = False
    ): ...
    def get_plugin_configuration_file_by_id(
        self, plugin_id, configuration_file_path
    ): ...
    def get_plugin_module_name_by_id(self, plugin_id): ...
    def get_plugin_by_module_name(self, module): ...
    def get_loaded_plugin_by_module_name(self, module): ...
    def get_plugin_class_by_module_name(self, module): ...
    def register_plugin_manager_event(self, plugin, event_name) -> None: ...
    def unregister_plugin_manager_event(self, plugin, event_name) -> None: ...
    def notify_handlers(self, event_name, event_args) -> None: ...
    def generate_event(self, event_name, event_args) -> None: ...
    def plugin_manager_plugin_execute(self, execution_type, arguments): ...
    def plugin_manager_plugin_execute_conditional(self, execution_type, arguments): ...
    def exists_plugin_manager_plugin_execute_conditional(
        self, execution_type, arguments
    ): ...
    system_information_map: Incomplete
    def generate_system_information_map(self) -> None: ...
    def get_log_handler(self, name): ...
    def log_stack_trace(self, level=...) -> None: ...
    def debug(self, message) -> None: ...
    def info(self, message) -> None: ...
    def warning(self, message) -> None: ...
    def error(self, message) -> None: ...
    def critical(self, message) -> None: ...
    def format_logger_message(self, message): ...
    def print_all_plugins(self) -> None: ...
    def get_prefix_paths(self): ...
    def get_environment_variable(self, environment_variable_name): ...
    def get_configuration_path(self): ...
    def get_meta_paths(self): ...
    def get_workspace_path(self): ...
    def set_workspace_path(self, workspace_path) -> None: ...
    def set_timestamp(self, timestamp: Incomplete | None = None) -> None: ...
    def set_plugin_manager_plugins_loaded(self, value: bool = True) -> None: ...
    def get_plugin_manager_plugins_loaded(self): ...
    def set_init_complete(self, value: bool = True) -> None: ...
    def get_init_complete(self): ...
    def get_manager_path(self): ...
    def get_plugin_paths(self): ...
    def get_main_plugin_path(self): ...
    def get_containers_path(self): ...
    def get_libraries_path(self): ...
    def get_temporary_path(self): ...
    def get_variable_path(self): ...
    def get_plugin_paths_file_path(self): ...
    def get_layout_mode(self): ...
    def get_run_mode(self): ...
    def get_timestamp(self): ...
    def get_version(self): ...
    def get_release(self): ...
    def get_build(self): ...
    def get_release_date(self): ...
    def get_release_date_time(self): ...
    def get_environment(self): ...
    def get_system_information_map(self): ...
    def get_uptime(self): ...
    def is_development(self): ...
    def is_production(self): ...
    def echo(self, value: str = "echo"): ...
    def process_command_manager_path(self, arguments): ...
    def process_command_plugin_path(self, arguments): ...
    def process_command_configuration(self, arguments): ...
    def process_command_environment(self, arguments): ...
    def process_command_prefix(self, arguments): ...
    def _relaunch_system(self) -> None: ...
    def _kill_system_signal_handler(self, signum, frame) -> None: ...
    def _stop_blocking_system_structures(self) -> None: ...
    def _stop_kill_system_timer(self) -> None: ...
    def _kill_system_timeout(self) -> None: ...
    def _handle_system_exception(self, exception) -> None: ...
    def _get_best_plugin_path(self, plugin_path): ...

class Dependency:
    mandatory: bool
    conditions_list: bool

    def __init__(self, mandatory: bool = True, conditions_list=[]) -> None: ...
    def test_dependency(self, manager): ...
    def test_conditions(self): ...
    def get_tuple(self): ...

class PluginDependency(Dependency):
    id: Incomplete
    version: Incomplete
    diffusion_policy = SINGLETON_DIFFUSION_SCOPE

    def __init__(
        self,
        id,
        version: str = "x.x.x",
        diffusion_policy=...,
        mandatory: bool = True,
        conditions_list=[],
    ) -> None: ...
    def __repr__(self) -> str: ...
    def test_dependency(self, manager): ...
    def get_tuple(self): ...
    def get_map(self): ...

class PackageDependency(Dependency):
    name: Incomplete
    import_name: Incomplete
    version: str
    url: Incomplete

    def __init__(
        self,
        name,
        import_name,
        version: str = "1.0.0",
        url: Incomplete | None = None,
        mandatory: bool = True,
        conditions_list=[],
    ) -> None: ...
    def __repr__(self) -> str: ...
    def test_dependency(self, manager): ...
    def get_tuple(self): ...
    def get_map(self): ...

class Condition:
    def __init__(self) -> None: ...
    def test_condition(self): ...

class OperativeSystemCondition(Condition):
    operative_system_name: Incomplete
    def __init__(self, operative_system_name: Incomplete | None = None) -> None: ...
    def test_condition(self): ...

class Capability:
    list_value: Incomplete
    def __init__(self, string_value: Incomplete | None = None) -> None: ...
    def __eq__(self, capability): ...
    def __ne__(self, capability): ...
    def capability_and_super_capabilites(self): ...
    def is_sub_capability(self, capability): ...
    def is_capability_or_sub_capability(self, capability): ...

class Event:
    list_value: Incomplete
    def __init__(self, string_value: Incomplete | None = None) -> None: ...
    def __eq__(self, event): ...
    def __ne__(self, event): ...
    def is_sub_event(self, event): ...
    def is_event_or_sub_event(self, event): ...

def capability_and_super_capabilites(capability): ...
def is_capability_or_sub_capability(base_capability, capability): ...
def is_capability_or_sub_capability_in_list(base_capability, capability_list): ...
def convert_to_capability_list(capability_list): ...
def is_event_or_sub_event(base_event, event): ...
def is_event_or_super_event(base_event, event): ...
def is_event_or_sub_event_in_list(base_event, event_list): ...
def is_event_or_super_event_in_list(base_event, event_list): ...
def get_all_events_or_super_events_in_list(base_event, event_list): ...
def convert_to_event_list(event_list): ...

class PluginThread(Thread):
    plugin: Incomplete
    load_complete: bool
    end_load_complete: bool
    unload_complete: bool
    end_unload_complete: bool
    load_plugin_thread: Incomplete
    end_load_plugin_thread: Incomplete
    unload_plugin_thread: Incomplete
    end_unload_plugin_thread: Incomplete
    event_queue: Incomplete
    condition: Incomplete
    daemon: bool

    def __init__(self, plugin) -> None: ...
    def set_load_complete(self, value) -> None: ...
    def set_end_load_complete(self, value) -> None: ...
    def set_unload_complete(self, value) -> None: ...
    def set_end_unload_complete(self, value) -> None: ...
    def add_event(self, event) -> None: ...
    lazy_load_plugin_thread: Incomplete
    def process_event(self, event): ...
    def run(self) -> None: ...

class PluginEventThread(Thread):
    plugin: Incomplete
    method: Incomplete
    daemon: bool

    def __init__(self, plugin, method): ...
    def run(self) -> None: ...
