MCPcopy Create free account
hub / github.com/ShivaBhattacharjee/KeyZen / __enter__

Method __enter__

data/python/08_context_managers.py:5–8  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3 self.db_name = db_name
4
5 def __enter__(self):
6 print(f"Connecting to database '{self.db_name}'...")
7 self.connected = True
8 return self
9
10 def __exit__(self, exc_type, exc_val, exc_tb):
11 print(f"Closing connection to '{self.db_name}'...")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected