Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/user/bin/python3
- from typing import TextIO
- import sys
- class PintFxnContext:
- _last_stream: TextIO
- _custom_stream: TextIO
- def __init__(self, out: TextIO):
- self._last_stream = sys.stdout
- self._custom_stream = out
- def __enter__(self):
- sys.stdout = self._custom_stream
- def __exit__(self, *_):
- sys.stdout = self._last_stream
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement