asm
This commit is contained in:
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Min RK
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,77 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: wurlitzer
|
||||
Version: 3.0.3
|
||||
Summary: Capture C-level output in context managers
|
||||
Home-page: https://github.com/minrk/wurlitzer
|
||||
Author: Min RK
|
||||
Author-email: benjaminrk@gmail.com
|
||||
License: MIT
|
||||
Classifier: Development Status :: 4 - Beta
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Requires-Python: >=3.5
|
||||
Description-Content-Type: text/markdown
|
||||
License-File: LICENSE
|
||||
|
||||
# Wurlitzer
|
||||
|
||||
Capture C-level stdout/stderr pipes in Python via `os.dup2`.
|
||||
|
||||
For more details on why this is needed, please read [this blog post](https://eli.thegreenplace.net/2015/redirecting-all-kinds-of-stdout-in-python/).
|
||||
|
||||
## Install
|
||||
|
||||
pip install wurlitzer
|
||||
|
||||
## Usage
|
||||
|
||||
Capture stdout/stderr in pipes:
|
||||
|
||||
```python
|
||||
from wurlitzer import pipes
|
||||
|
||||
with pipes() as (out, err):
|
||||
call_some_c_function()
|
||||
|
||||
stdout = out.read()
|
||||
```
|
||||
|
||||
Capture stdout/stderr in StringIO:
|
||||
|
||||
```python
|
||||
from io import StringIO
|
||||
from wurlitzer import pipes, STDOUT
|
||||
|
||||
out = StringIO()
|
||||
with pipes(stdout=out, stderr=STDOUT):
|
||||
call_some_c_function()
|
||||
|
||||
stdout = out.getvalue()
|
||||
```
|
||||
|
||||
Forward C-level stdout/stderr to Python sys.stdout/stderr,
|
||||
which may already be forwarded somewhere by the environment, e.g. IPython:
|
||||
|
||||
```python
|
||||
from wurlitzer import sys_pipes
|
||||
|
||||
with sys_pipes():
|
||||
call_some_c_function()
|
||||
```
|
||||
|
||||
Or even simpler, enable it as an IPython extension:
|
||||
|
||||
```
|
||||
%load_ext wurlitzer
|
||||
```
|
||||
|
||||
To forward all C-level output to IPython during execution.
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
This package is based on stuff we learned with @takluyver and @karies while working on capturing output from the [Cling Kernel](https://github.com/root-mirror/cling/tree/master/tools/Jupyter/kernel) for Jupyter.
|
||||
|
||||
## Wurlitzer?!
|
||||
|
||||
[Wurlitzer](https://en.wikipedia.org/wiki/Wurlitzer) makes pipe organs. Get it? Pipes? Naming is hard.
|
||||
@@ -0,0 +1,8 @@
|
||||
__pycache__/wurlitzer.cpython-311.pyc,,
|
||||
wurlitzer-3.0.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
wurlitzer-3.0.3.dist-info/LICENSE,sha256=JDxpX8PafBjYNbhXjrTLkkssGj-DCA2PGQ47Djy6XeY,1073
|
||||
wurlitzer-3.0.3.dist-info/METADATA,sha256=8DThbmJ56CYAWvIEW-syFlDAGn6i_84P2SV6QxvIWp8,1855
|
||||
wurlitzer-3.0.3.dist-info/RECORD,,
|
||||
wurlitzer-3.0.3.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
||||
wurlitzer-3.0.3.dist-info/top_level.txt,sha256=O9qOU7tp1U4XJ5AUnTFnauGFIBkbiDxOdAQldTCgk0o,10
|
||||
wurlitzer.py,sha256=a3-5o3sTbRTcfVY7HSWUSAr_I2XK0BSLReIpbYmffe4,14992
|
||||
@@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.38.4)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
wurlitzer
|
||||
Reference in New Issue
Block a user