Skip to main content

Python diff wrapper

Project description

morelorless

This is a thin wrapper around difflib.unified_diff that Does The Right Thing for "No newline at eof". The args are also simplified compared to difflib:

moreorless.unified_diff(
    astr: str,
    bstr: str,
    filename: str,
    n: int = 3,
) -> str:
    ...

# raises moreorless.patch.PatchException
moreorless.patch.apply_single_file(
    contents: str,
    patch: str,
    allow_offsets: bool = True,
) -> str:
    ...

# uses click to write to stdout with colors
moreorless.click.echo_color_unified_diff(
    astr: str,
    bstr: str,
    filename: str,
    n: int = 3
) -> None:
    ...

# if you want to use unified_diff yourself first (e.g. in another process)
moreorless.click.echo_color_precomputed_diff(
    diff: str,
) -> None:
    ...

License

morelorless is copyright Tim Hatch, and licensed under the MIT license. I am providing code in this repository to you under an open source license. This is my personal repository; the license you receive to my code is from me and not from my employer. See the LICENSE file for details.

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

moreorless-0.4.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

moreorless-0.4.0-py2.py3-none-any.whl (9.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file moreorless-0.4.0.tar.gz.

File metadata

  • Download URL: moreorless-0.4.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.6

File hashes

Hashes for moreorless-0.4.0.tar.gz
Algorithm Hash digest
SHA256 85e19972c1a0b3a49f8543914f57bd83f6e1b10df144d5b97b8c5e9744d9c08c
MD5 be26b671110104dcb13c6aa1e700c3df
BLAKE2b-256 c55dc8ed33403f62a2f755905c8d2d36b71e3fc32588deeb53ad1206edbb067a

See more details on using hashes here.

File details

Details for the file moreorless-0.4.0-py2.py3-none-any.whl.

File metadata

  • Download URL: moreorless-0.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.6

File hashes

Hashes for moreorless-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 17f1fbef60fd21c84ee085a929fe3acefcaddca30df5dd09c024e9939a9e6a00
MD5 6b635168aaacec6a262e42be6cab2a1d
BLAKE2b-256 ad8818597dcf9ef8c5e99e1b7961975c56135810fd9d620fc43c6be8362c506a

See more details on using hashes here.

Supported by

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