Python _dummy_thread.allocate_lock() Examples

The following are 30 code examples of _dummy_thread.allocate_lock(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module _dummy_thread , or try the search function .
Example #1
Source File: _dummy_thread.py    From scylla with Apache License 2.0 5 votes vote down vote up
def allocate_lock():
    """Dummy implementation of _thread.allocate_lock()."""
    return LockType() 
Example #2
Source File: _dummy_thread.py    From android_universal with MIT License 5 votes vote down vote up
def allocate_lock():
    """Dummy implementation of _thread.allocate_lock()."""
    return LockType() 
Example #3
Source File: _dummy_thread32.py    From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
def allocate_lock():
    """Dummy implementation of _thread.allocate_lock()."""
    return LockType() 
Example #4
Source File: _dummy_thread32.py    From Cloudmare with GNU General Public License v3.0 5 votes vote down vote up
def allocate_lock():
    """Dummy implementation of _thread.allocate_lock()."""
    return LockType() 
Example #5
Source File: test_dummy_thread.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_LockType(self):
        self.assertIsInstance(_thread.allocate_lock(), _thread.LockType,
                              "_thread.LockType is not an instance of what "
                              "is returned by _thread.allocate_lock()") 
Example #6
Source File: test_dummy_thread.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def setUp(self):
        # Create a lock
        self.lock = _thread.allocate_lock() 
Example #7
Source File: _pyio.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE):
        if not raw.writable():
            raise OSError('"raw" argument must be writable.')

        _BufferedIOMixin.__init__(self, raw)
        if buffer_size <= 0:
            raise ValueError("invalid buffer size")
        self.buffer_size = buffer_size
        self._write_buf = bytearray()
        self._write_lock = Lock() 
Example #8
Source File: _pyio.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE):
        """Create a new buffered reader using the given readable raw IO object.
        """
        if not raw.readable():
            raise OSError('"raw" argument must be readable.')

        _BufferedIOMixin.__init__(self, raw)
        if buffer_size <= 0:
            raise ValueError("invalid buffer size")
        self.buffer_size = buffer_size
        self._reset_read_buf()
        self._read_lock = Lock() 
Example #9
Source File: _dummy_thread.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def allocate_lock():
    """Dummy implementation of _thread.allocate_lock()."""
    return LockType() 
Example #10
Source File: _dummy_thread32.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def allocate_lock():
    """Dummy implementation of _thread.allocate_lock()."""
    return LockType() 
Example #11
Source File: test_dummy_thread.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_LockType(self):
        #Make sure _thread.LockType is the same type as _thread.allocate_locke()
        self.assertIsInstance(_thread.allocate_lock(), _thread.LockType,
                              "_thread.LockType is not an instance of what "
                              "is returned by _thread.allocate_lock()") 
Example #12
Source File: test_dummy_thread.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def setUp(self):
        # Create a lock
        self.lock = _thread.allocate_lock() 
Example #13
Source File: _pyio.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE):
        if not raw.writable():
            raise OSError('"raw" argument must be writable.')

        _BufferedIOMixin.__init__(self, raw)
        if buffer_size <= 0:
            raise ValueError("invalid buffer size")
        self.buffer_size = buffer_size
        self._write_buf = bytearray()
        self._write_lock = Lock() 
Example #14
Source File: _pyio.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE):
        """Create a new buffered reader using the given readable raw IO object.
        """
        if not raw.readable():
            raise OSError('"raw" argument must be readable.')

        _BufferedIOMixin.__init__(self, raw)
        if buffer_size <= 0:
            raise ValueError("invalid buffer size")
        self.buffer_size = buffer_size
        self._reset_read_buf()
        self._read_lock = Lock() 
Example #15
Source File: _dummy_thread.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def allocate_lock():
    """Dummy implementation of _thread.allocate_lock()."""
    return LockType() 
Example #16
Source File: _dummy_thread.py    From jawfish with MIT License 5 votes vote down vote up
def allocate_lock():
    """Dummy implementation of _thread.allocate_lock()."""
    return LockType() 
Example #17
Source File: test.py    From python-aspectlib with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def __init__(self, play, proxy=True, strict=True, dump=True, recurse_lock=False, **options):
        super(Replay, self).__init__(play._target, **options)
        self._calls, self._expected, self._actual = ChainMap(self._calls, play._calls), play._calls, self._calls

        self._proxy = proxy
        self._strict = strict
        self._dump = dump
        self._context = play._context
        self._recurse_lock = allocate_lock() if recurse_lock is True else (recurse_lock and recurse_lock()) 
Example #18
Source File: _dummy_thread.py    From Imogen with MIT License 5 votes vote down vote up
def allocate_lock():
    """Dummy implementation of _thread.allocate_lock()."""
    return LockType() 
Example #19
Source File: test_dummy_thread.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_LockType(self):
        #Make sure _thread.LockType is the same type as _thread.allocate_locke()
        self.assertIsInstance(_thread.allocate_lock(), _thread.LockType,
                              "_thread.LockType is not an instance of what "
                              "is returned by _thread.allocate_lock()") 
Example #20
Source File: test_dummy_thread.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def setUp(self):
        # Create a lock
        self.lock = _thread.allocate_lock() 
Example #21
Source File: _pyio.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE):
        if not raw.writable():
            raise OSError('"raw" argument must be writable.')

        _BufferedIOMixin.__init__(self, raw)
        if buffer_size <= 0:
            raise ValueError("invalid buffer size")
        self.buffer_size = buffer_size
        self._write_buf = bytearray()
        self._write_lock = Lock() 
Example #22
Source File: _pyio.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE):
        """Create a new buffered reader using the given readable raw IO object.
        """
        if not raw.readable():
            raise OSError('"raw" argument must be readable.')

        _BufferedIOMixin.__init__(self, raw)
        if buffer_size <= 0:
            raise ValueError("invalid buffer size")
        self.buffer_size = buffer_size
        self._reset_read_buf()
        self._read_lock = Lock() 
Example #23
Source File: _dummy_thread.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def allocate_lock():
    """Dummy implementation of _thread.allocate_lock()."""
    return LockType() 
Example #24
Source File: _dummy_thread.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def allocate_lock():
    """Dummy implementation of _thread.allocate_lock()."""
    return LockType() 
Example #25
Source File: _dummy_thread.py    From kobo-predict with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def allocate_lock():
    """Dummy implementation of _thread.allocate_lock()."""
    return LockType() 
Example #26
Source File: _dummy_thread32.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def allocate_lock():
    """Dummy implementation of _thread.allocate_lock()."""
    return LockType() 
Example #27
Source File: _io.py    From jawfish with MIT License 5 votes vote down vote up
def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE):
        if not raw.writable():
            raise IOError('"raw" argument must be writable.')

        _BufferedIOMixin.__init__(self, raw)
        if buffer_size <= 0:
            raise ValueError("invalid buffer size")
        self.buffer_size = buffer_size
        self._write_buf = bytearray()
        self._write_lock = Lock() 
Example #28
Source File: _io.py    From jawfish with MIT License 5 votes vote down vote up
def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE):
        """Create a new buffered reader using the given readable raw IO object.
        """
        if not raw.readable():
            raise IOError('"raw" argument must be readable.')

        _BufferedIOMixin.__init__(self, raw)
        if buffer_size <= 0:
            raise ValueError("invalid buffer size")
        self.buffer_size = buffer_size
        self._reset_read_buf()
        self._read_lock = Lock() 
Example #29
Source File: _thread.py    From jawfish with MIT License 5 votes vote down vote up
def allocate_lock():
    """Dummy implementation of _thread.allocate_lock()."""
    return LockType() 
Example #30
Source File: test.py    From python-aspectlib with BSD 2-Clause "Simplified" License 4 votes vote down vote up
def record(func=None, recurse_lock_factory=allocate_lock, **options):
    """
    Factory or decorator (depending if `func` is initially given).

    Args:
        callback (list):
            An a callable that is to be called with ``instance, function, args, kwargs``.
        calls (list):
            An object where the `Call` objects are appended. If not given and ``callback`` is not specified then a new list
            object will be created.
        iscalled (bool):
            If ``True`` the `func` will be called. (default: ``False``)
        extended (bool):
            If ``True`` the `func`'s ``__name__`` will also be included in the call list. (default: ``False``)
        results (bool):
            If ``True`` the results (and exceptions) will also be included in the call list. (default: ``False``)

    Returns:
        A wrapper that records all calls made to `func`. The history is available as a ``call``
        property. If access to the function is too hard then you need to specify the history manually.

    Example:

        >>> @record
        ... def a(x, y, a, b):
        ...     pass
        >>> a(1, 2, 3, b='c')
        >>> a.calls
        [Call(self=None, args=(1, 2, 3), kwargs={'b': 'c'})]


    Or, with your own history list::

        >>> calls = []
        >>> @record(calls=calls)
        ... def a(x, y, a, b):
        ...     pass
        >>> a(1, 2, 3, b='c')
        >>> a.calls
        [Call(self=None, args=(1, 2, 3), kwargs={'b': 'c'})]
        >>> calls is a.calls
        True


    .. versionchanged:: 0.9.0

        Renamed `history` option to `calls`.
        Renamed `call` option to `iscalled`.
        Added `callback` option.
        Added `extended` option.
    """
    if func:
        return _RecordingFunctionWrapper(
            func,
            recurse_lock=recurse_lock_factory(),
            **options
        )
    else:
        return partial(record, **options)