Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wuthefwasthat/magic_extract
https://github.com/wuthefwasthat/magic_extract
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/wuthefwasthat/magic_extract
- Owner: WuTheFWasThat
- License: mit
- Created: 2021-05-13T22:11:26.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-05T20:29:32.000Z (8 months ago)
- Last Synced: 2024-09-15T11:50:03.481Z (3 months ago)
- Language: Python
- Size: 9.77 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# magic_extract
Based on https://andyljones.com/posts/post-mortem-plotting.html
Examples run in interactive python:
```python
from magic_extract import extractdef main():
x = 3
extract()main() # raises a RunTimeError
print(x) # prints 3
``````python
from magic_extract import debugdef main(x):
y = x - 2
return x / ydebug(main, 4) # returns 2
debug(main, 3) # returns 3
debug(main, 2) # raises ZeroDivisionError and extracts
print(y) # prints 0
``````python
from magic_extract import decorate@decorate()
def main(x):
y = x - 2
return x / ymain(4) # returns 2
main(3) # returns 3
main(2) # raises ZeroDivisionError and extracts
print(y) # prints 0
```