Skip to main content

Convenience functions for editing things.

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 from environ['EDITOR'] or from EDITOR ('vi').
  • environ: optional environment mapping, default os.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 whose
  • to_text: the transcription function of the object to text; default json.dumps
  • from_text: the transcription function of the object to text; default json.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.

Release files for cs.edit 20220429

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cs.edit 20220429
File Size Uploaded
cs.edit-20220429.tar.gz 3.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cs.edit 20220429
File Interpreter ABI Platform
cs.edit-20220429-py3-none-any.whl Python 3 none any Details

Total release size: 6.7 kB

Release files / cs.edit-20220429.tar.gz

Download URL cs.edit-20220429.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3553c45329f8b602cf9acef11b459696d01362b9aae66033902c65c63237eb41
BLAKE2b-256 checksum
How to use checksums
9e4ab05eb05fdd2c78a5ab6963568c51a04ad6b9b1b754a857e1ad6fbd6d7327
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.1 readme-renderer/30.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.3.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.12

Release files / cs.edit-20220429-py3-none-any.whl

Download URL cs.edit-20220429-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b23172688d907cd5c52afbe1f2cd997baedc74d3b509d49cae01ba113b7692a5
BLAKE2b-256 checksum
How to use checksums
6d614e219879106a1d450f565197301debf9bdc7ebbfcc93db717b5af13fdd26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.1 readme-renderer/30.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.3.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.12

Release history Release notifications | RSS feed

This release

20220429 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page