@@ -8,37 +8,41 @@ OR and NOT - other compositions like XOR and NAND are not implemented
88but can be emulated with AND or and NOT. Expressions are constructed
99from parsed strings or in Python.
1010
11- It runs on Python 2.7 and Python 3.
11+ It runs on Python 3.6+
12+ You can use older version 3.x for Python 2.7+ support.
1213
1314https://github.com/bastikr/boolean.py
1415
1516Build status: |Build Status |
1617
18+
1719Example
1820-------
1921
2022::
2123
22- >>> import boolean
23- >>> algebra = boolean.BooleanAlgebra()
24- >>> expression1 = algebra.parse(u'apple and (oranges or banana) and not banana', simplify=False)
25- >>> expression1
26- AND(Symbol('apple'), OR(Symbol('oranges'), Symbol('banana')), NOT(Symbol('banana')))
24+ >>> import boolean
25+ >>> algebra = boolean.BooleanAlgebra()
26+ >>> expression1 = algebra.parse(u'apple and (oranges or banana) and not banana', simplify=False)
27+ >>> expression1
28+ AND(Symbol('apple'), OR(Symbol('oranges'), Symbol('banana')), NOT(Symbol('banana')))
29+
30+ >>> expression2 = algebra.parse('(oranges | banana) and not banana & apple', simplify=True)
31+ >>> expression2
32+ AND(Symbol('apple'), NOT(Symbol('banana')), Symbol('oranges'))
2733
28- >>> expression2 = algebra.parse(u'(oranges | banana) and not banana & apple', simplify=True)
29- >>> expression2
30- AND(Symbol('apple'), NOT(Symbol('banana')), Symbol('oranges'))
34+ >>> expression1 == expression2
35+ False
36+ >>> expression1.simplify() == expression2
37+ True
3138
32- >>> expression1 == expression2
33- False
34- >>> expression1.simplify() == expression2
35- True
3639
3740Documentation
3841-------------
3942
4043http://readthedocs.org/docs/booleanpy/en/latest/
4144
45+
4246Installation
4347------------
4448
@@ -55,20 +59,21 @@ You then only need to run the following command:
5559
5660``pip install boolean.py ``
5761
62+
5863Installation via package managers
5964~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6065
6166There are packages available for easy install on some operating systems.
6267You are welcome to help us package this tool for more distributions!
6368
6469- boolean.py has been packaged as Arch Linux, Fedora, openSus,
65- nixpkgs, Guix, DragonFly and FreeBSD
70+ nixpkgs, Guix, DragonFly and FreeBSD
6671 `packages <https://repology.org/project/python:boolean.py/versions >`__ .
6772
6873In particular:
6974
70- - Arch Linux:
71- `python-boolean.py <https://archlinux.org/packages/community/any /python-boolean.py/ >`__
75+ - Arch Linux (AUR) :
76+ `python-boolean.py <https://aur. archlinux.org/packages/python-boolean.py/ >`__
7277- Fedora:
7378 `python-boolean.py <https://apps.fedoraproject.org/packages/python-boolean.py >`__
7479- openSUSE:
@@ -86,20 +91,23 @@ Test with all of the supported Python environments using ``tox``:
8691
8792::
8893
89- pip install -r test- requirements.txt
94+ pip install -r requirements-dev .txt
9095 tox
9196
9297If ``tox `` throws ``InterpreterNotFound ``, limit it to python
9398interpreters that are actually installed on your machine:
9499
95100::
96101
97- tox -e py27,py36
102+ tox -e py36
103+
104+ Alternatively use pytest.
105+
98106
99107License
100108-------
101109
102- Copyright (c)
2009-2020 Sebastian Kraemer,
[email protected] and others
110+ Copyright (c) Sebastian Kraemer,
[email protected] and others
103111SPDX-License-Identifier: BSD-2-Clause
104112
105113.. |Build Status | image :: https://travis-ci.org/bastikr/boolean.py.svg?branch=master
0 commit comments