Restore an object's magic methods.
(
self,
exc_type: type[BaseException] | None,
exc_val: BaseException | None,
exc_tb: TracebackType | None,
)
| 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 | |
| 133 | def parsekeywordpairs(signature: str) -> dict[str, str]: |
nothing calls this directly
no outgoing calls
no test coverage detected