This commit is contained in:
Iliyan Angelov
2025-12-01 06:50:10 +02:00
parent 91f51bc6fe
commit 62c1fe5951
4682 changed files with 544807 additions and 31208 deletions

View File

@@ -0,0 +1,65 @@
Metadata-Version: 2.4
Name: boolean.py
Version: 5.0
Summary: Define boolean algebras, create and parse boolean expressions and create custom boolean DSL.
Home-page: https://github.com/bastikr/boolean.py
Author: Sebastian Kraemer
Author-email: basti.kr@gmail.com
License: BSD-2-Clause
Keywords: boolean expression,boolean algebra,logic,expression parser
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Software Development :: Compilers
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Description-Content-Type: text/x-rst
License-File: LICENSE.txt
License-File: README.rst
License-File: CHANGELOG.rst
Provides-Extra: testing
Requires-Dist: pytest!=7.0.0,>=6; extra == "testing"
Requires-Dist: pytest-xdist>=2; extra == "testing"
Provides-Extra: dev
Requires-Dist: twine; extra == "dev"
Requires-Dist: build; extra == "dev"
Provides-Extra: linting
Requires-Dist: black; extra == "linting"
Requires-Dist: isort; extra == "linting"
Requires-Dist: pycodestyle; extra == "linting"
Provides-Extra: docs
Requires-Dist: Sphinx>=3.3.1; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=0.5.0; extra == "docs"
Requires-Dist: doc8>=0.8.1; extra == "docs"
Requires-Dist: sphinxcontrib-apidoc>=0.3.0; extra == "docs"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: provides-extra
Dynamic: summary
This library helps you deal with boolean expressions and algebra with variables
and the boolean functions AND, OR, NOT.
You can parse expressions from strings and simplify and compare expressions.
You can also easily create your custom algreba and mini DSL and create custom
tokenizers to handle custom expressions.
For extensive documentation look either into the docs directory or view it online, at
https://booleanpy.readthedocs.org/en/latest/
https://github.com/bastikr/boolean.py
Copyright (c) 2009-2020 Sebastian Kraemer, basti.kr@gmail.com and others
SPDX-License-Identifier: BSD-2-Clause

View File

@@ -0,0 +1,14 @@
boolean/__init__.py,sha256=z1FOZZg2mXnYeAPS9csinA_JVjEI5GhhOGncVdoEqpA,657
boolean/__pycache__/__init__.cpython-312.pyc,,
boolean/__pycache__/boolean.cpython-312.pyc,,
boolean/__pycache__/test_boolean.cpython-312.pyc,,
boolean/boolean.py,sha256=6Wl7LT9Zci81eTiQYUtfSxGAifUQtyjnTS76av2Whlw,54740
boolean/test_boolean.py,sha256=FXCBgBHKtY7rJOe8BZ-o1OS5xgj7tQKRAZWLtWZEr0c,47024
boolean_py-5.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
boolean_py-5.0.dist-info/METADATA,sha256=nkOurhenMHOr7mHetfsmff3w7rZ9bjEjJwtSqsXth_o,2342
boolean_py-5.0.dist-info/RECORD,,
boolean_py-5.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
boolean_py-5.0.dist-info/licenses/CHANGELOG.rst,sha256=ZoWRYBmJ4IRdco2zn9y_AFMjllsaDbdYCYjaeOFjxRk,3036
boolean_py-5.0.dist-info/licenses/LICENSE.txt,sha256=XqDN-M_IJLRGzM9Zf_ZRjDYHplnpgEvHXxJh-casSto,1321
boolean_py-5.0.dist-info/licenses/README.rst,sha256=wVkJntSukf9-G6Q-Uve-9fq5Y97q5H5Nai7G_XPqTLs,2839
boolean_py-5.0.dist-info/top_level.txt,sha256=K_8zC8vXmHwYzBbAvKPwu6nrmYI0TFM-kD-gR1qmxHE,8

View File

@@ -0,0 +1,5 @@
Wheel-Version: 1.0
Generator: setuptools (78.1.0)
Root-Is-Purelib: true
Tag: py3-none-any

View File

@@ -0,0 +1,140 @@
Changelog
=========
next
----
5.0 (2025-04-03)
----------------
* API changes
* Drop support for Python versions older than 3.9.
* Add support by testing on Python 3.11 to 3.14
* Fix absorption issues https://github.com/bastikr/boolean.py/issues/111 and
https://github.com/bastikr/boolean.py/issues/112
4.0 (2022-05-05)
----------------
* API changes
* Drop support for Python 2.
* Test on Python 3.10
* Make Expression.sort_order an instance attributes and not a class attribute
* Misc.
* Correct licensing documentation
* Improve docstringf and apply minor refactorings
* Adopt black code style and isort for imports
* Drop Travis and use GitHub actions for CI
3.8 (2020-06-10)
----------------
* API changes
* Add support for evaluation of boolean expression.
Thank you to Lars van Gemerden @gemerden
* Bug fixes
* Fix parsing of tokens that have a number as the first character.
Thank you to Jeff Cohen @ jcohen28
* Restore proper Python 2 compatibility.
Thank you to Benjy Weinberger @benjyw
* Improve documentation
* Add pointers to Linux distro packages.
Thank you to Max Mehl @mxmehl and Carmen Bianca Bakker @carmenbianca
* Fix typo.
Thank you to Gabriel Niebler @der-gabe
3.7 (2019-10-04)
----------------
* API changes
* Add new sort argument to simplify() to optionally not sort when simplifying
expressions (e.g. not applying "commutativity"). Thank you to Steven Esser
@majurg for this
* Add new argument to tokenizer to optionally accept extra characters in symbol
tokens. Thank you to @carpie for this
3.6 (2018-08-06)
----------------
* No API changes
* Bug fixes
* Fix De Morgan's laws effect on double negation propositions. Thank you to Douglas Cardoso for this
* Improve error checking when parsing
3.5 (Nov 1, 2017)
-----------------
* No API changes
* Bug fixes
* Documentation updates and add testing for Python 3.6. Thank you to Alexander Lisianoi @alisianoi
* Improve testng and expression equivalence checks
* Improve subs() method to an expression
3.4 (May 12, 2017)
------------------
* No API changes
* Bug fixes and improvements
* Fix various documentation typos and improve tests . Thank you to Alexander Lisianoi @alisianoi
* Fix handling for literals vs. symbols in negations Thank you to @YaronK
3.3 (2017-02-09)
----------------
* API changes
* #40 and #50 Expression.subs() now takes 'default' thanks to @kronuz
* #45 simplify=False is now the default for parse and related functions or methods.
* #40 Use "&" and "|" as default operators
* Bug fixes
* #60 Fix bug for "a or b c" which is not a valid expression
* #58 Fix math formula display in docs
* Improve handling of parse errors
2.0.0 (2016-05-11)
------------------
* API changes
* New algebra definition. Refactored class hierarchy. Improved parsing.
* New features
* possibility to subclass algebra definition
* new normal forms shortcuts for DNF and CNF.
1.1 (2016-04-06)
------------------
* Initial release on Pypi.

View File

@@ -0,0 +1,23 @@
Copyright (c) Sebastian Kraemer, basti.kr@gmail.com and others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,114 @@
boolean.py
==========
"boolean.py" is a small library implementing a boolean algebra. It
defines two base elements, TRUE and FALSE, and a Symbol class that can
take on one of these two values. Calculations are done in terms of AND,
OR and NOT - other compositions like XOR and NAND are not implemented
but can be emulated with AND or and NOT. Expressions are constructed
from parsed strings or in Python.
It runs on Python 3.6+
You can use older version 3.x for Python 2.7+ support.
https://github.com/bastikr/boolean.py
Build status: |Build Status|
Example
-------
::
>>> import boolean
>>> algebra = boolean.BooleanAlgebra()
>>> expression1 = algebra.parse(u'apple and (oranges or banana) and not banana', simplify=False)
>>> expression1
AND(Symbol('apple'), OR(Symbol('oranges'), Symbol('banana')), NOT(Symbol('banana')))
>>> expression2 = algebra.parse('(oranges | banana) and not banana & apple', simplify=True)
>>> expression2
AND(Symbol('apple'), NOT(Symbol('banana')), Symbol('oranges'))
>>> expression1 == expression2
False
>>> expression1.simplify() == expression2
True
Documentation
-------------
http://readthedocs.org/docs/booleanpy/en/latest/
Installation
------------
Installation via pip
~~~~~~~~~~~~~~~~~~~~
To install boolean.py, you need to have the following pieces of software
on your computer:
- Python 3.6+
- pip
You then only need to run the following command:
``pip install boolean.py``
Installation via package managers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are packages available for easy install on some operating systems.
You are welcome to help us package this tool for more distributions!
- boolean.py has been packaged as Arch Linux, Fedora, openSus,
nixpkgs, Guix, DragonFly and FreeBSD
`packages <https://repology.org/project/python:boolean.py/versions>`__ .
In particular:
- Arch Linux (AUR):
`python-boolean.py <https://aur.archlinux.org/packages/python-boolean.py/>`__
- Fedora:
`python-boolean.py <https://apps.fedoraproject.org/packages/python-boolean.py>`__
- openSUSE:
`python-boolean.py <https://software.opensuse.org/package/python-boolean.py>`__
Testing
-------
Test ``boolean.py`` with your current Python environment:
``python setup.py test``
Test with all of the supported Python environments using ``tox``:
::
pip install -r requirements-dev.txt
tox
If ``tox`` throws ``InterpreterNotFound``, limit it to python
interpreters that are actually installed on your machine:
::
tox -e py36
Alternatively use pytest.
License
-------
Copyright (c) Sebastian Kraemer, basti.kr@gmail.com and others
SPDX-License-Identifier: BSD-2-Clause
.. |Build Status| image:: https://travis-ci.org/bastikr/boolean.py.svg?branch=master
:target: https://travis-ci.org/bastikr/boolean.py