Magic command to dpaste / get line & cell content
Project description
dpaste_magic
Magic function that pushes or pulls code snippets out of pastebins. dpaste.org is currently supported.
Pushing code & cells
%dpaste answer = 42 https://dpaste.org/WXYZ
pushes line content & print the dpaste url.
%%dpaste answer = 42 https://dpaste.org/WXYZ
pushes cell content & print the dpaste url.
%%dpaste {-1x -1h -1d -1w}
answer = 42
https://dpaste.org/WXYZ
returns a dpaste url with expires duration:
- -1x: just for one read
- -1h: one hour (default)
- -1d: one day
- -1w: one week
These are the supported expiration time supported by dpaste.org.
Options:
- -o: return URL as value (for storage in a variable)
- -s: silent mode (URL not printed)
my_url = %dpaste -o answer = 42
push code on line, prints & stores url in my_url variable.
my_url = %dpaste -o -s answer = 42
push code on line & stores url in my_url variable (silent mode, no print).
Getting back the paste
%getdpaste WXYZ
retrieves snippet from WXYZ dpaste hash or URL and changes cell to:
answer = 42
%getdpaste -u WXYZ
add retrieved URL as a Python comment in first line:
#https://dpaste.org/WXYZ/raw answer = 42
With %dpaste -g get option:
%dpaste -g WXYZ
retrieves snippet from WXYZ dpaste hash or URL and changes cell to:
answer = 42
Installation
Use:
pip install dpaste-magic
to install the magic command.
First load the magic in a cell:
%load_ext dpaste_magic
and then use the function in your cell to dpaste its content.
%%dpaste, %dpaste or %getdpaste.
TO DO
- increase tests range
- code unload function
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dpaste_magic-0.3.0.tar.gz.
File metadata
- Download URL: dpaste_magic-0.3.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc9597a92784c6094eaa75ee29089012441c4cc0459c2b49e52e348306b15f03
|
|
| MD5 |
54f9ee102f9e50b4e3ec9fd7031fbd25
|
|
| BLAKE2b-256 |
db563c0327ca4cc2b82fcf3b743ba3fc9470c7477626fed56f155b139c583a2d
|
File details
Details for the file dpaste_magic-0.3.0-py3-none-any.whl.
File metadata
- Download URL: dpaste_magic-0.3.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da48c9d895dcb2dca3194364358592156b4cf6bbc4356c1203c68ddfca96d826
|
|
| MD5 |
e117f0bf575d1e2905c5af847f9291a8
|
|
| BLAKE2b-256 |
fdd4a8c5c130b47a6f762054cf40277a2fd67a25836c887d4c4278a19e699a3e
|