Skip to main content

Guard like Haskell for Python.

Project description

Guard like Haskell for Python.

Status

https://secure.travis-ci.org/mkouhei/pguard.png?branch=master https://coveralls.io/repos/mkouhei/pguard/badge.png?branch=master https://img.shields.io/pypi/v/pguard.svg Documentation Status

Requirements

  • Python 2.7 or Python 3.6 over or PyPy 2.4.0 over

Features

  • guard with lambda

  • Enable to use function or method as guard_cl statement argument.

Setup

$ pip install --user pguard
or
(venv)$ pip install pguard

Simple usage

>>> from pguard import guard
>>> from pguard import guard_cl as g
>>> (lambda n: guard(
... g(-1, n < 0),
... g(0, n == 0),
... g(1)  ## otherwise
... ))(0)
0

ChangeLog

0.4.0 (2019-03-18)

  • Supports Python 3.7.

  • Drops Python 2.7, Python 3.5.

0.3.1 (2018-11-03)

  • Fixes pylint violations.

0.3.0 (2016-04-30)

  • Fixes lazy evaluation.

  • Changes guard_cl() respond values.

0.2.1 (2016-04-29)

  • Fixes Python 2.7 classmethod behavior bugs.

0.2.0 (2016-04-27)

  • Supports “function” and “method” as guard_cl statement argument.

0.1.4 (2016-04-24)

  • Fixes setup.py url.

0.1.3 (2016-04-23)

  • Fixes README.

  • Adds check long-description to pre-commit hook.

0.1.2 (2016-04-23)

  • Fixes setup.py version.

0.1.1 (2016-04-23)

  • completed coverage 100%.

  • Adds sample usages.

0.1.0 (2016-04-23)

  • Initial release.

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

pguard-0.4.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

pguard-0.4.0-py2.py3-none-any.whl (3.3 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: pguard-0.4.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3rc1

File hashes

Hashes for pguard-0.4.0.tar.gz
Algorithm Hash digest
SHA256 0268b0de9a8c195f441446c4562686a4e9d3412aa0295c79c5d70a0ccc36ee33
MD5 2ee04aac66ed4d81c485d2fe7f17e2a9
BLAKE2b-256 de91feb33f4b5bca014bcdd5ef97af482f9516b302a245b9993f7e68ee28d650

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pguard-0.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3rc1

File hashes

Hashes for pguard-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e962c6954e5f0fcce02448581fef4565c63021140cda7c5176c90e00e39e1cdd
MD5 e210c81f71eaa83464ec88380146ac0e
BLAKE2b-256 1cddc1d145848a156e9397c70ac8e294e905e92f14a45df80e587feb38f2f171

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