當前位置: 首頁>>代碼示例>>Python>>正文


Python _dummy_thread.allocate_lock方法代碼示例

本文整理匯總了Python中_dummy_thread.allocate_lock方法的典型用法代碼示例。如果您正苦於以下問題:Python _dummy_thread.allocate_lock方法的具體用法?Python _dummy_thread.allocate_lock怎麽用?Python _dummy_thread.allocate_lock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在_dummy_thread的用法示例。


在下文中一共展示了_dummy_thread.allocate_lock方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: allocate_lock

# 需要導入模塊: import _dummy_thread [as 別名]
# 或者: from _dummy_thread import allocate_lock [as 別名]
def allocate_lock():
    """Dummy implementation of _thread.allocate_lock()."""
    return LockType() 
開發者ID:war-and-code,項目名稱:jawfish,代碼行數:5,代碼來源:_dummy_thread.py

示例2: __init__

# 需要導入模塊: import _dummy_thread [as 別名]
# 或者: from _dummy_thread import allocate_lock [as 別名]
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() 
開發者ID:war-and-code,項目名稱:jawfish,代碼行數:14,代碼來源:_io.py

示例3: __init__

# 需要導入模塊: import _dummy_thread [as 別名]
# 或者: from _dummy_thread import allocate_lock [as 別名]
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() 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:14,代碼來源:_pyio.py

示例4: setUp

# 需要導入模塊: import _dummy_thread [as 別名]
# 或者: from _dummy_thread import allocate_lock [as 別名]
def setUp(self):
        # Create a lock
        self.lock = _thread.allocate_lock() 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:5,代碼來源:test_dummy_thread.py

示例5: test_LockType

# 需要導入模塊: import _dummy_thread [as 別名]
# 或者: from _dummy_thread import allocate_lock [as 別名]
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()") 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:7,代碼來源:test_dummy_thread.py

示例6: __init__

# 需要導入模塊: import _dummy_thread [as 別名]
# 或者: from _dummy_thread import allocate_lock [as 別名]
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()) 
開發者ID:ionelmc,項目名稱:python-aspectlib,代碼行數:11,代碼來源:test.py

示例7: test_LockType

# 需要導入模塊: import _dummy_thread [as 別名]
# 或者: from _dummy_thread import allocate_lock [as 別名]
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()") 
開發者ID:ShikyoKira,項目名稱:Project-New-Reign---Nemesis-Main,代碼行數:6,代碼來源:test_dummy_thread.py

示例8: record

# 需要導入模塊: import _dummy_thread [as 別名]
# 或者: from _dummy_thread import allocate_lock [as 別名]
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) 
開發者ID:ionelmc,項目名稱:python-aspectlib,代碼行數:61,代碼來源:test.py


注:本文中的_dummy_thread.allocate_lock方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。