MCPcopy Create free account
hub / github.com/ActiveState/code / __enter__

Method __enter__

recipes/Python/577524_Python_Sessions/recipe-577524.py:271–277  ·  view source on GitHub ↗

Activated when used in the with statement. Should automatically acquire a lock to be used in the with block.

(self)

Source from the content-addressed store, hash-verified

269 self.is_locked = False
270
271 def __enter__(self):
272 """ Activated when used in the with statement.
273 Should automatically acquire a lock to be used in the with block.
274 """
275 if not self.is_locked:
276 self.acquire()
277 return self
278
279 def __exit__(self, type, value, traceback):
280 """ Activated at the end of the with statement.

Callers

nothing calls this directly

Calls 1

acquireMethod · 0.95

Tested by

no test coverage detected