Magic command to dpaste / get line & cell content
Project description
dpaste\_magic
=============
Magic function that pushes or pulls code snippets out of pastebins.
dpaste.de is currently supported.
Pushing code & cells
--------------------
::
%dpaste answer = 42
---
https://dpaste.de/XYZ
pushes line content & print the dpaste url.
::
%%dpaste
answer = 42
---
https://dpaste.de/XYZ
pushes cell content & print the dpaste url.
::
%%dpaste {-1x -1h -1d -1w -0}
answer = 42
---
https://dpaste.de/XYZ
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`` pushes code online, prints & stores
url in ``my_url`` variable.
``my_url = %dpaste -o -s answer = 42`` pushes code online & stores url in
``my_url`` variable (silent mode, no print).
Getting back the paste
----------------------
::
%getdpaste XYZ
retrieves snippet from XYZ dpaste hash or URL and changes cell to:
::
# %load https://dpaste.de/XYZ/raw
answer = 42
With `%dpaste -g` get option:
::
%dpaste -g XYZ
retrieves snippet from XYZ dpaste hash or URL and changes cell to:
::
# %load https://dpaste.de/XYZ/raw
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
=============
Magic function that pushes or pulls code snippets out of pastebins.
dpaste.de is currently supported.
Pushing code & cells
--------------------
::
%dpaste answer = 42
---
https://dpaste.de/XYZ
pushes line content & print the dpaste url.
::
%%dpaste
answer = 42
---
https://dpaste.de/XYZ
pushes cell content & print the dpaste url.
::
%%dpaste {-1x -1h -1d -1w -0}
answer = 42
---
https://dpaste.de/XYZ
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`` pushes code online, prints & stores
url in ``my_url`` variable.
``my_url = %dpaste -o -s answer = 42`` pushes code online & stores url in
``my_url`` variable (silent mode, no print).
Getting back the paste
----------------------
::
%getdpaste XYZ
retrieves snippet from XYZ dpaste hash or URL and changes cell to:
::
# %load https://dpaste.de/XYZ/raw
answer = 42
With `%dpaste -g` get option:
::
%dpaste -g XYZ
retrieves snippet from XYZ dpaste hash or URL and changes cell to:
::
# %load https://dpaste.de/XYZ/raw
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
dpaste_magic-0.1.1.tar.gz
(4.9 kB
view hashes)
Built Distribution
Close
Hashes for dpaste_magic-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d49bad3859460282e2a1b9d2bf308262403dd3ae5f044dd89dd791c91f5a4be5 |
|
MD5 | 4fe3de8bbf194c7a15fdb0685ab1d39d |
|
BLAKE2b-256 | 0368518a7224a968dd083e1c87ad16ebeea6a43619a10f4966f9d7a61fe6b1f0 |