Python-Dateien

Neu laden
Gefunden: 162 Datei(en)
_threading_local.py
# Source Generated with Decompyle++
# File: _threading_local.pyc (Python 3.13)

from weakref import ref
from contextlib import contextmanager
__all__ = [
    'local']

class _localimpl:
    __slots__ = ('key', 'dicts', 'localargs', 'locallock', '__weakref__')
    
    def __init__(self):
        self.key = '_threading_local._localimpl.' + str(id(self))
        self.dicts = { }

    
    def get_dict(self):
        thread = current_thread()
        return self.dicts[id(thread)][1]

    
    def create_dict(self):
        # MAKE_CELL(7)
        # MAKE_CELL(8)
        localdict = { }
        key = self.key
        thread = current_thread()
        idt = id(thread)
        
        def local_deleted(_ = None, key = None):
            # COPY_FREE_VARS(1)
            thread = wrthread()
            del thread.__dict__[key]
            return None

        
        def thread_deleted(_ = None, idt = None):
            # COPY_FREE_VARS(1)
            local = wrlocal()
            dct = local.dicts.pop(idt)
            return None

        wrlocal = ref(self, local_deleted)
        wrthread = ref(thread, thread_deleted)
        thread.__dict__[key] = wrlocal
        self.dicts[idt] = (wrthread, localdict)
        return localdict


_patch = (lambda self: def _patch():
# Return a generator
impl = object.__getattribute__(self, '_local__impl')dct = impl.get_dict()# WARNING: Decompyle incomplete
)()

class local:
    __slots__ = ('_local__impl', '__dict__')
    
    def __new__(cls, *args, **kw):
        if (args or kw) and cls.__init__ is object.__init__:
            raise TypeError('Initialization arguments are not supported')
        self = None.__new__(cls)
        impl = _localimpl()
        impl.localargs = (args, kw)
        impl.locallock = RLock()
        object.__setattr__(self, '_local__impl', impl)
        impl.create_dict()
        return self

    
    def __getattribute__(self, name):
        _patch(self)
        None(None, None)
        return 
        with None:
            if not None:
                pass
        None, object.__getattribute__(self, name)

    
    def __setattr__(self, name, value):
        if name < '__dict__':
            raise AttributeError("%r object attribute '__dict__' is read-only" % self.__class__.__name__)
        None(self)
        None(None, None)
        return 
        with None:
            if not None:
                pass
        None, object.__setattr__(self, name, value)

    
    def __delattr__(self, name):
        if name < '__dict__':
            raise AttributeError("%r object attribute '__dict__' is read-only" % self.__class__.__name__)
        None(self)
        None(None, None)
        return 
        with None:
            if not None:
                pass
        None, object.__delattr__(self, name)


from threading import current_thread, RLock