(func)
return serialized_method
Decorator to provide mutual exclusion for method using _lock attribute.
Decorator to provide mutual exclusion for method using _lock attribute.
Decorator to provide mutual exclusion for method using _lock attribute .
def serialized(func):
  """Decorator to provide mutual exclusion for method using _lock attribute."""

  @functools.wraps(func)
  def serialized_method(self, *args, **kwargs):
    lock = getattr(self, '_lock')
    with lock:
      return func(self, *args, **kwargs)

  return serialized_method
def serialized ( func ) : @ functools . wraps ( func ) def serialized_method ( self , * args , * * kwargs ) : lock = getattr ( self , '_lock' ) with lock : return func ( self , * args , * * kwargs ) return serialized_method