MCPcopy Create free account
hub / github.com/bpython/bpython / __exit__

Method __exit__

bpython/inspection.py:115–130  ·  view source on GitHub ↗

Restore an object's magic methods.

(
        self,
        exc_type: type[BaseException] | None,
        exc_val: BaseException | None,
        exc_tb: TracebackType | None,
    )

Source from the content-addressed store, hash-verified

113 # /Dark magic
114
115 def __exit__(
116 self,
117 exc_type: type[BaseException] | None,
118 exc_val: BaseException | None,
119 exc_tb: TracebackType | None,
120 ) -> Literal[False]:
121 """Restore an object's magic methods."""
122 type_ = type(self._obj)
123 __getattribute__, __getattr__ = self._attribs
124 # Dark magic:
125 if __getattribute__ is not None:
126 setattr(type_, "__getattribute__", __getattribute__)
127 if __getattr__ is not None:
128 setattr(type_, "__getattr__", __getattr__)
129 # /Dark magic
130 return False
131
132
133def parsekeywordpairs(signature: str) -> dict[str, str]:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected