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: fcgi.py    From termite-visualizations with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def __init__(self, application, environ=None,
                 multithreaded=True, **kw):
        """
        environ, if present, must be a dictionary-like object. Its
        contents will be copied into application's environ. Useful
        for passing application-specific variables.

        Set multithreaded to False if your application is not MT-safe.
        """
        if kw.has_key('handler'):
            del kw['handler'] # Doesn't make sense to let this through
        super(WSGIServer, self).__init__(**kw)

        if environ is None:
            environ = {}

        self.application = application
        self.environ = environ
        self.multithreaded = multithreaded

        # Used to force single-threadedness
        self._app_lock = thread.allocate_lock() 
Example #2
Source File: dummy_thread.py    From CTFCrackTools-V2 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 #3
Source File: remote_socket_service_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    if _extension_runtime:
      self._extension_fields = {}
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #4
Source File: test_dummy_thread.py    From CTFCrackTools-V2 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 #5
Source File: _io.py    From CTFCrackTools-V2 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 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()
        self._ok = True     # Jython: to enable use now in a valid state 
Example #6
Source File: test_dummy_thread.py    From CTFCrackTools-V2 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: _io.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, raw,
                 buffer_size=DEFAULT_BUFFER_SIZE, max_buffer_size=None):
        if not raw.writable():
            raise IOError('"raw" argument must be writable.')

        _BufferedIOMixin.__init__(self, raw)
        if buffer_size <= 0:
            raise ValueError("invalid buffer size")
        if max_buffer_size is not None:
            warnings.warn("max_buffer_size is deprecated", DeprecationWarning,
                          self._warning_stack_offset)
        self.buffer_size = buffer_size
        self._write_buf = bytearray()
        self._write_lock = Lock()
        self._ok = True     # Jython: to enable use now in a valid state 
Example #8
Source File: _io.py    From CTFCrackTools-V2 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 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()
        self._ok = True     # Jython: to enable use now in a valid state 
Example #9
Source File: _pyio.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, raw,
                 buffer_size=DEFAULT_BUFFER_SIZE, max_buffer_size=None):
        if not raw.writable():
            raise IOError('"raw" argument must be writable.')

        _BufferedIOMixin.__init__(self, raw)
        if buffer_size <= 0:
            raise ValueError("invalid buffer size")
        if max_buffer_size is not None:
            warnings.warn("max_buffer_size is deprecated", DeprecationWarning,
                          self._warning_stack_offset)
        self.buffer_size = buffer_size
        self._write_buf = bytearray()
        self._write_lock = Lock() 
Example #10
Source File: _pyio.py    From CTFCrackTools-V2 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 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 #11
Source File: _pyio.py    From CTFCrackTools-V2 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 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 #12
Source File: entity_v4_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    self.property_ = []
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #13
Source File: entity_v4_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    self.deprecated_value_ = []
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #14
Source File: entity_v4_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    self.list_value_ = []
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #15
Source File: entity_v4_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    self.path_element_ = []
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #16
Source File: entity_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    self.key_ = Reference()
    self.entity_group_ = Path()
    self.property_ = []
    self.raw_property_ = []
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #17
Source File: entity_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #18
Source File: acl_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #19
Source File: system_service_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #20
Source File: log_service_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    self.usage_ = []
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #21
Source File: log_service_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    self.version_id_ = []
    self.module_version_ = []
    self.request_id_ = []
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #22
Source File: log_service_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    self.line_ = []
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #23
Source File: log_service_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #24
Source File: log_service_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #25
Source File: remote_socket_service_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    if _extension_runtime:
      self._extension_fields = {}
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #26
Source File: remote_socket_service_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    if _extension_runtime:
      self._extension_fields = {}
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #27
Source File: remote_socket_service_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    if _extension_runtime:
      self._extension_fields = {}
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #28
Source File: remote_socket_service_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    if _extension_runtime:
      self._extension_fields = {}
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #29
Source File: remote_socket_service_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    if _extension_runtime:
      self._extension_fields = {}
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents) 
Example #30
Source File: remote_socket_service_pb.py    From python-compat-runtime with Apache License 2.0 5 votes vote down vote up
def __init__(self, contents=None):
    self.socket_options_ = []
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents)