Skip to main content

Ordering enumeration and protocols.

Project description

orderings

License Version Downloads Discord

Documentation Check Test Coverage

Ordering enumeration and protocols.

Installing

Python 3.7 or above is required.

pip

Installing the library with pip is quite simple:

$ pip install orderings

Alternatively, the library can be installed from source:

$ git clone https://github.com/nekitdev/orderings.git
$ cd orderings
$ python -m pip install .

poetry

You can add orderings as a dependency with the following command:

$ poetry add orderings

Or by directly specifying it in the configuration like so:

[tool.poetry.dependencies]
orderings = "^1.1.0"

Alternatively, you can add it directly from the source:

[tool.poetry.dependencies.orderings]
git = "https://github.com/nekitdev/orderings.git"

Examples

Core

The core of orderings is the Ordering enumeration and the Compare protocol:

from attrs import frozen
from orderings import Compare, Ordering

I = TypeVar("I", bound="Int")


@frozen()
class Int(Compare):
    value: int

    def compare(self: I, other: I) -> Ordering:
        self_value = self.value
        other_value = other.value

        if self_value < other_value:
            return Ordering.LESS

        if self_value > other_value:
            return Ordering.GREATER

        return Ordering.EQUAL

Compare implements all ordering operations (==, !=, <, >, <=, >=) using the compare method.

Documentation

You can find the documentation here.

Support

If you need support with the library, you can send an email or refer to the official Discord server.

Changelog

You can find the changelog here.

Security Policy

You can find the Security Policy of orderings here.

Contributing

If you are interested in contributing to orderings, make sure to take a look at the Contributing Guide, as well as the Code of Conduct.

License

orderings is licensed under the MIT License terms. See License 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

orderings-1.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

orderings-1.1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file orderings-1.1.0.tar.gz.

File metadata

  • Download URL: orderings-1.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.11.0 Linux/5.15.0-1023-azure

File hashes

Hashes for orderings-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f6b058fb347667af12933b6f1ce19cde2d5dcd8a92462e4dcfca5127c3070149
MD5 d18e836bf893b1c0b1b701771eba0486
BLAKE2b-256 36ff6cec178fe3536d51324594999172a0a718fce3773c6116260fd68deca31e

See more details on using hashes here.

File details

Details for the file orderings-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: orderings-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.11.0 Linux/5.15.0-1023-azure

File hashes

Hashes for orderings-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9defd7cf2fb46396e56a75a4fe4ba7da4ccb56c6c1b1d854cad8212a576f800b
MD5 1ba89a71ad35937ee17ac3d083aba892
BLAKE2b-256 3619f87481f0d17d7cea7c3521f8f2e343792ad5a6790cc72036e6eb1caddb07

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