Magic command to dpaste / get line & cell content
Project description
Magic function that pushes or pulls code snippets out of pastebins. dpaste.de is currently supported.
%dpaste answer = 42
pushes line content & print the dpaste url.
%%dpaste answer = 42
pushes cell content & print the dpaste url.
%%dpaste {-1x -1h -1d -1w -0} answer = 42
returns a dpaste url with expires duration:
-1x: just for one read
-1h: one hour (default)
-1d: one day
-1w: one week
-0: never
These are the supported expiration time supported by dpaste.de.
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).
%dpaste -g XYZ answer = 42 retrieves snippet from XYZ dpaste hash or URL.
%getdpaste XYZ answer = 42 retrieves snippet from XYZ dpaste hash or URL (alias for dpaste -g).
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
Hashes for dpaste_magic-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 002ffc75633fc87ebd01f653d05edea2a409c40096cb221b95a48e90230f3acd |
|
MD5 | fec01a76e264653ee90ac74ec87fc833 |
|
BLAKE2b-256 | ec11e16cc581bdc429ef9427ccc2bad6f454ea3d1846025ffb90833046b37e7d |