403Webshell
Server IP : 68.178.202.69  /  Your IP : 216.73.216.143
Web Server : Apache
System : Linux 69.202.178.68.host.secureserver.net 3.10.0-1160.139.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Nov 3 13:30:41 UTC 2025 x86_64
User : ikioworld ( 1005)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/opt/nydus/ops/customer_local_ops/util/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/opt/nydus/ops/customer_local_ops/util/compat.py
# -*- coding: utf-8 -*-
"""
Compatibility utilities for supporting multiple Python versions.

This module provides utilities and workarounds to ensure compatibility
across Python 3.5 through Python 3.12, with special attention to
Windows-specific issues.
"""

import sys
import platform
import asyncio

# Python version checks
PY35 = sys.version_info[:2] == (3, 5)
PY36 = sys.version_info[:2] == (3, 6)
PY37 = sys.version_info[:2] == (3, 7)
PY38 = sys.version_info[:2] == (3, 8)
PY38_PLUS = sys.version_info[:2] >= (3, 8)

# Platform checks
IS_WINDOWS = platform.system() == 'Windows'


def setup_windows_event_loop():
    """
    Set up the appropriate event loop for Windows in Python 3.8+.

    Python 3.8 changed the default event loop on Windows from
    SelectorEventLoop to ProactorEventLoop. This can cause compatibility
    issues with some libraries. This function ensures we use the
    SelectorEventLoop for consistency.
    """
    if IS_WINDOWS and PY38_PLUS:
        # Set Windows event loop policy to use SelectorEventLoop
        asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())


def format_string(template, *args, **kwargs):
    """
    Provide a consistent string formatting method across Python versions.

    This is a wrapper around str.format() to ensure consistent behavior
    and provide a migration path from f-strings for Python 3.5 compatibility.

    Args:
        template: The string template with {} placeholders
        *args: Positional arguments for formatting
        **kwargs: Keyword arguments for formatting

    Returns:
        Formatted string
    """
    return template.format(*args, **kwargs)

Youez - 2016 - github.com/yon3zu
LinuXploit