Skip to main content

Convenience functions for editing things. - Cameron Simpson <cs@cskk.id.au> 02jun2016

Project description

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.

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

cs.edit-20220429.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

cs.edit-20220429-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file cs.edit-20220429.tar.gz.

File metadata

  • Download URL: cs.edit-20220429.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for cs.edit-20220429.tar.gz
Algorithm Hash digest
SHA256 3553c45329f8b602cf9acef11b459696d01362b9aae66033902c65c63237eb41
MD5 295f6776a167b637f174a00a8e3fcb82
BLAKE2b-256 9e4ab05eb05fdd2c78a5ab6963568c51a04ad6b9b1b754a857e1ad6fbd6d7327

See more details on using hashes here.

File details

Details for the file cs.edit-20220429-py3-none-any.whl.

File metadata

  • Download URL: cs.edit-20220429-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for cs.edit-20220429-py3-none-any.whl
Algorithm Hash digest
SHA256 b23172688d907cd5c52afbe1f2cd997baedc74d3b509d49cae01ba113b7692a5
MD5 1aeba19450d0fb2d68cfcce2eb607018
BLAKE2b-256 6d614e219879106a1d450f565197301debf9bdc7ebbfcc93db717b5af13fdd26

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page