Convenience functions for editing things. - Cameron Simpson <cs@cskk.id.au> 02jun2016
Project description
Convenience functions for editing things.
- Cameron Simpson cs@cskk.id.au 02jun2016
Latest release 20220429: New edit_obj to edit an object, usually in JSON format.
Function choose_editor(editor=None, environ=None)
Choose an editor,
honouring the $EDITOR
environment variable.
Parameters:
editor
: optional editor, default fromenviron['EDITOR']
or fromEDITOR
('vi'
).environ
: optional environment mapping, defaultos.environ
Function edit(lines, editor=None, environ=None)
Write lines to a temporary file, edit the file, return the new lines.
The editor is chosen by choose_editor(editor=editor,environ=environ)
.
Function edit_obj(o, editor=None, environ=None, to_text=None, from_text=None)
Edit the cotents of an object o
.
Return a new object containing the editing contents.
The default transcription is as JSON.
The editor is chosen by choose_editor(editor=editor,environ=environ)
.
Parameters:
o
: the object whoseto_text
: the transcription function of the object to text; defaultjson.dumps
from_text
: the transcription function of the object to text; defaultjson.loads
Function edit_strings(strs, editor=None, environ=None)
Edit an iterable list of str
, return tuples of changed string pairs.
The editor is chosen by choose_editor(editor=editor,environ=environ)
.
Release Log
Release 20220429: New edit_obj to edit an object, usually in JSON format.
Release 20191201.1: Initial PyPI release: assorted functions for invoking editors on strings.
Project details
Release history Release notifications | RSS feed
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 cs.edit-20220429-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b23172688d907cd5c52afbe1f2cd997baedc74d3b509d49cae01ba113b7692a5 |
|
MD5 | 1aeba19450d0fb2d68cfcce2eb607018 |
|
BLAKE2b-256 | 6d614e219879106a1d450f565197301debf9bdc7ebbfcc93db717b5af13fdd26 |