WordPress

Briefly unavailable for scheduled maintenance.
Check back in a some hours.
403WebShell
403Webshell
Server IP : 18.193.92.211  /  Your IP : 216.73.216.86
Web Server : Apache/2.4.63 (Ubuntu)
System : Linux ip-10-0-0-90 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 06:59:36 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.2.28
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /snap/certbot/current/lib/python3.12/site-packages/setuptools/_distutils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /snap/certbot/current/lib/python3.12/site-packages/setuptools/_distutils/_dataclass.py
# This is a private module, but setuptools has the explicit permission to use it.
from __future__ import annotations

import warnings
from dataclasses import dataclass, fields
from functools import wraps
from typing import TypeVar

from .compat.py310 import dataclass_transform

_T = TypeVar("_T", bound=type)


@dataclass_transform()
def lenient_dataclass(**dc_kwargs):
    """
    Build a dataclass whose ``__init__`` ignores unknown keyword arguments.

    Customize ``__init__`` to preserve backwards compatibility and keep
    tolerating arbitrary keywords, but keep the dataclass-generated
    ``__init__`` to avoid redefining the typing for all the arguments.

    Drop this customization once lenient behaviour and backward
    compatibility are no longer needed and use a regular ``dataclass``
    instead.
    """

    @wraps(dataclass)
    def _wrap(cls: _T) -> _T:  # type: ignore[var-annotated]
        cls = dataclass(**dc_kwargs)(cls)
        # Allowed field names in order
        safe = tuple(f.name for f in fields(cls))
        orig_init = cls.__init__

        @wraps(orig_init)
        def _wrapped_init(self, *args, **kwargs):
            extra = {repr(k): kwargs.pop(k) for k in tuple(kwargs) if k not in safe}
            if extra:
                msg = f"""
                Please remove unknown `{cls.__name__}` options: {','.join(extra)}
                this kind of usage is deprecated and may cause errors in the future.
                """
                warnings.warn(msg)

            # Ensure default values (e.g. []) are used instead of None:
            positional = {
                k: v for k, v in zip(safe, args, strict=False) if v is not None
            }
            keywords = {k: v for k, v in kwargs.items() if v is not None}
            return orig_init(self, **positional, **keywords)

        cls.__init__ = _wrapped_init
        return cls

    return _wrap

Youez - 2016 - github.com/yon3zu
LinuXploit