pythonic-fp-booleans 2.0.0__tar.gz → 3.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/CHANGELOG.rst +11 -0
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/PKG-INFO +7 -7
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/README.rst +5 -5
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/pyproject.toml +2 -2
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/src/pythonic_fp/booleans/__init__.py +2 -1
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/src/pythonic_fp/booleans/flavored.py +13 -12
- pythonic_fp_booleans-3.0.0/src/pythonic_fp/booleans/flavored.pyi +19 -0
- pythonic_fp_booleans-3.0.0/src/pythonic_fp/booleans/py.typed +0 -0
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/src/pythonic_fp/booleans/subtypable.py +4 -4
- pythonic_fp_booleans-3.0.0/src/pythonic_fp/booleans/subtypable.pyi +18 -0
- pythonic_fp_booleans-3.0.0/src/pythonic_fp/booleans/truthy_falsy.pyi +21 -0
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/.gitignore +0 -0
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/LICENSE +0 -0
- /pythonic_fp_booleans-2.0.0/src/pythonic_fp/booleans/py.typed → /pythonic_fp_booleans-3.0.0/src/pythonic_fp/booleans/__init__.pyi +0 -0
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/src/pythonic_fp/booleans/truthy_falsy.py +0 -0
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/tests/test_bool_vs_fbool.py +0 -0
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/tests/test_bool_vs_sbool.py +0 -0
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/tests/test_flavored.py +0 -0
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/tests/test_flavored_non_shortcut_logic.py +0 -0
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/tests/test_flavored_sbool.py +0 -0
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/tests/test_subtypable_non_shortcut_logic.py +0 -0
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/tests/test_true_false.py +0 -0
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/tests/test_true_false_non_shortcut_logic.py +0 -0
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/tests/test_typing.py +0 -0
- {pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/tests/test_variance.py +0 -0
|
@@ -17,6 +17,17 @@ See `Semantic Versioning 2.0.0 <https://semver.org>`_.
|
|
|
17
17
|
Releases and Important Milestones
|
|
18
18
|
---------------------------------
|
|
19
19
|
|
|
20
|
+
PyPI 2.2.0 - 2025-12-02
|
|
21
|
+
~~~~~~~~~~~~~~~~~~~~~~~
|
|
22
|
+
|
|
23
|
+
Docstring updates.
|
|
24
|
+
|
|
25
|
+
PyPI 2.1.0 - 2025-12-02
|
|
26
|
+
~~~~~~~~~~~~~~~~~~~~~~~
|
|
27
|
+
|
|
28
|
+
Now requires pythonic-fp-gadgets 4.0.1 to be installed.
|
|
29
|
+
|
|
30
|
+
|
|
20
31
|
PyPI 2.0.0 - 2025-09-27
|
|
21
32
|
~~~~~~~~~~~~~~~~~~~~~~~
|
|
22
33
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pythonic-fp-booleans
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: Subtypable Boolean Class Hierarchy
|
|
5
5
|
Keywords: booleans,subtypable
|
|
6
6
|
Author-email: "Geoffrey R. Scheller" <geoffrey@scheller.com>
|
|
@@ -14,7 +14,7 @@ Classifier: Operating System :: OS Independent
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
15
|
Classifier: Typing :: Typed
|
|
16
16
|
License-File: LICENSE
|
|
17
|
-
Requires-Dist: pythonic-fp-gadgets>=
|
|
17
|
+
Requires-Dist: pythonic-fp-gadgets>=4.0.2
|
|
18
18
|
Requires-Dist: pytest>=8.4.1 ; extra == "test"
|
|
19
19
|
Project-URL: Changelog, https://github.com/grscheller/pythonic-fp-booleans/blob/main/CHANGELOG.rst
|
|
20
20
|
Project-URL: Documentation, https://grscheller.github.io/pythonic-fp/booleans/development/build/html/
|
|
@@ -31,12 +31,12 @@ PyPI project
|
|
|
31
31
|
|
|
32
32
|
Subtypable Boolean like classes.
|
|
33
33
|
|
|
34
|
-
While still compatible with Python shortcut logic, these classes
|
|
35
|
-
composed with Python’s bitwise operators.
|
|
34
|
+
While still compatible with Python shortcut logic, these singleton classes
|
|
35
|
+
can be non-shortcut logically composed with Python’s bitwise operators.
|
|
36
36
|
|
|
37
37
|
Part of the
|
|
38
38
|
`pythonic-fp
|
|
39
|
-
<https://grscheller.github.io/pythonic-fp
|
|
39
|
+
<https://grscheller.github.io/pythonic-fp>`_
|
|
40
40
|
PyPI projects.
|
|
41
41
|
|
|
42
42
|
Documentation
|
|
@@ -44,11 +44,11 @@ Documentation
|
|
|
44
44
|
|
|
45
45
|
Documentation for this project is hosted on
|
|
46
46
|
`GitHub Pages
|
|
47
|
-
<https://grscheller.github.io/pythonic-fp/booleans
|
|
47
|
+
<https://grscheller.github.io/pythonic-fp/booleans>`_.
|
|
48
48
|
|
|
49
49
|
Copyright and License
|
|
50
50
|
---------------------
|
|
51
51
|
|
|
52
|
-
Copyright (c) 2025 Geoffrey R. Scheller. Licensed under the Apache
|
|
52
|
+
Copyright (c) 2025-2026 Geoffrey R. Scheller. Licensed under the Apache
|
|
53
53
|
License, Version 2.0. See the LICENSE file for details.
|
|
54
54
|
|
|
@@ -7,12 +7,12 @@ PyPI project
|
|
|
7
7
|
|
|
8
8
|
Subtypable Boolean like classes.
|
|
9
9
|
|
|
10
|
-
While still compatible with Python shortcut logic, these classes
|
|
11
|
-
composed with Python’s bitwise operators.
|
|
10
|
+
While still compatible with Python shortcut logic, these singleton classes
|
|
11
|
+
can be non-shortcut logically composed with Python’s bitwise operators.
|
|
12
12
|
|
|
13
13
|
Part of the
|
|
14
14
|
`pythonic-fp
|
|
15
|
-
<https://grscheller.github.io/pythonic-fp
|
|
15
|
+
<https://grscheller.github.io/pythonic-fp>`_
|
|
16
16
|
PyPI projects.
|
|
17
17
|
|
|
18
18
|
Documentation
|
|
@@ -20,10 +20,10 @@ Documentation
|
|
|
20
20
|
|
|
21
21
|
Documentation for this project is hosted on
|
|
22
22
|
`GitHub Pages
|
|
23
|
-
<https://grscheller.github.io/pythonic-fp/booleans
|
|
23
|
+
<https://grscheller.github.io/pythonic-fp/booleans>`_.
|
|
24
24
|
|
|
25
25
|
Copyright and License
|
|
26
26
|
---------------------
|
|
27
27
|
|
|
28
|
-
Copyright (c) 2025 Geoffrey R. Scheller. Licensed under the Apache
|
|
28
|
+
Copyright (c) 2025-2026 Geoffrey R. Scheller. Licensed under the Apache
|
|
29
29
|
License, Version 2.0. See the LICENSE file for details.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pythonic-fp-booleans"
|
|
3
|
-
version = "
|
|
3
|
+
version = "3.0.0"
|
|
4
4
|
readme = "README.rst"
|
|
5
5
|
requires-python = ">=3.13"
|
|
6
6
|
license = { file = "LICENSE" }
|
|
@@ -19,7 +19,7 @@ classifiers = [
|
|
|
19
19
|
"Typing :: Typed",
|
|
20
20
|
]
|
|
21
21
|
dependencies = [
|
|
22
|
-
"pythonic-fp-gadgets>=
|
|
22
|
+
"pythonic-fp-gadgets>=4.0.2",
|
|
23
23
|
]
|
|
24
24
|
dynamic = ["description"]
|
|
25
25
|
|
{pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/src/pythonic_fp/booleans/__init__.py
RENAMED
|
@@ -35,8 +35,9 @@ Subtypable Boolean Class Hierarchy
|
|
|
35
35
|
While still compatible with Python shortcut logic, ``SBool`` and its
|
|
36
36
|
subclasses can be non-shortcut logically composed with Python's bitwise
|
|
37
37
|
operators.
|
|
38
|
+
|
|
38
39
|
"""
|
|
39
40
|
|
|
40
41
|
__author__ = 'Geoffrey R. Scheller'
|
|
41
|
-
__copyright__ = 'Copyright (c) 2025 Geoffrey R. Scheller'
|
|
42
|
+
__copyright__ = 'Copyright (c) 2025-2026 Geoffrey R. Scheller'
|
|
42
43
|
__license__ = 'Apache License 2.0'
|
{pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/src/pythonic_fp/booleans/flavored.py
RENAMED
|
@@ -13,28 +13,29 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
"""
|
|
16
|
-
|
|
16
|
+
.. admonition:: Class Favored Booleans: ``F_Bool``.
|
|
17
17
|
|
|
18
|
-
When different flavors of the truth matter. Each ``FBool`` is
|
|
19
|
-
an ``SBool`` subtype corresponds to a hashable value
|
|
20
|
-
called its flavor.
|
|
18
|
+
When different flavors of the truth matter. Each ``FBool`` is
|
|
19
|
+
an ``SBool`` subtype corresponds to a hashable value
|
|
20
|
+
called its flavor.
|
|
21
21
|
|
|
22
|
-
.. warning::
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
.. warning::
|
|
23
|
+
|
|
24
|
+
Combining ``FBool`` instances of different flavors
|
|
25
|
+
with bitwise operators will just result in an ``SBool``.
|
|
26
26
|
|
|
27
27
|
----
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
.. admonition:: Function truthy: ``truthy(flavor: Hashable)``.
|
|
30
30
|
|
|
31
|
-
Returns the truthy ``FBool`` of a particular ``flavor``.
|
|
31
|
+
Returns the truthy singleton ``FBool`` of a particular ``flavor``.
|
|
32
32
|
|
|
33
33
|
----
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
.. admonition:: Function falsy: ``falsy(flavor: Hashable)``.
|
|
36
|
+
|
|
37
|
+
Returns the falsy singleton ``FBool`` of a particular ``flavor``.
|
|
36
38
|
|
|
37
|
-
Returns the falsy ``FBool`` of a particular ``flavor``.
|
|
38
39
|
"""
|
|
39
40
|
|
|
40
41
|
import threading
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from .subtypable import SBool
|
|
2
|
+
from collections.abc import Hashable
|
|
3
|
+
|
|
4
|
+
__all__ = ['FBool', 'truthy', 'falsy']
|
|
5
|
+
|
|
6
|
+
class FBool(SBool):
|
|
7
|
+
def __new__(cls, witness: object, flavor: Hashable) -> FBool: ...
|
|
8
|
+
def __init__(self, witness: object, flavor: Hashable) -> None: ...
|
|
9
|
+
def __invert__(self) -> FBool: ...
|
|
10
|
+
def __and__(self, other: int) -> SBool: ...
|
|
11
|
+
def __rand__(self, other: int) -> SBool: ...
|
|
12
|
+
def __or__(self, other: int) -> SBool: ...
|
|
13
|
+
def __ror__(self, other: int) -> SBool: ...
|
|
14
|
+
def __xor__(self, other: int) -> SBool: ...
|
|
15
|
+
def __rxor__(self, other: int) -> SBool: ...
|
|
16
|
+
def flavor(self) -> Hashable: ...
|
|
17
|
+
|
|
18
|
+
def truthy(flavor: Hashable) -> FBool: ...
|
|
19
|
+
def falsy(flavor: Hashable) -> FBool: ...
|
|
File without changes
|
{pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/src/pythonic_fp/booleans/subtypable.py
RENAMED
|
@@ -56,7 +56,7 @@ operator to return an opposite ``SBool`` class or subclass.
|
|
|
56
56
|
import threading
|
|
57
57
|
from collections.abc import Hashable
|
|
58
58
|
from typing import cast, ClassVar, Final, overload
|
|
59
|
-
from pythonic_fp.gadgets
|
|
59
|
+
from pythonic_fp.gadgets import first_common_ancestor as fca
|
|
60
60
|
from pythonic_fp.gadgets.sentinels.novalue import NoValue
|
|
61
61
|
|
|
62
62
|
__all__ = ['SBool', 'TRUTH', 'LIE']
|
|
@@ -110,7 +110,7 @@ class SBool(int):
|
|
|
110
110
|
|
|
111
111
|
def __and__(self, other: int) -> int:
|
|
112
112
|
try:
|
|
113
|
-
base_class =
|
|
113
|
+
base_class = fca(type(self), type(other))
|
|
114
114
|
except TypeError:
|
|
115
115
|
if type(other) is bool:
|
|
116
116
|
base_class = int
|
|
@@ -127,7 +127,7 @@ class SBool(int):
|
|
|
127
127
|
|
|
128
128
|
def __or__(self, other: int) -> int:
|
|
129
129
|
try:
|
|
130
|
-
base_class =
|
|
130
|
+
base_class = fca(type(self), type(other))
|
|
131
131
|
except TypeError:
|
|
132
132
|
if type(other) is bool:
|
|
133
133
|
base_class = int
|
|
@@ -144,7 +144,7 @@ class SBool(int):
|
|
|
144
144
|
|
|
145
145
|
def __xor__(self, other: int) -> int:
|
|
146
146
|
try:
|
|
147
|
-
base_class =
|
|
147
|
+
base_class = fca(type(self), type(other))
|
|
148
148
|
except TypeError:
|
|
149
149
|
if type(other) is bool:
|
|
150
150
|
base_class = int
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from collections.abc import Hashable
|
|
2
|
+
from typing import Final, overload
|
|
3
|
+
|
|
4
|
+
__all__ = ['SBool', 'TRUTH', 'LIE']
|
|
5
|
+
|
|
6
|
+
class SBool(int):
|
|
7
|
+
@overload
|
|
8
|
+
def __new__(cls) -> SBool: ...
|
|
9
|
+
@overload
|
|
10
|
+
def __new__(cls, witness: object) -> SBool: ...
|
|
11
|
+
def __init__(self, witness: object = False, flavor: Hashable = ...) -> None: ...
|
|
12
|
+
def __invert__(self) -> SBool: ...
|
|
13
|
+
def __and__(self, other: int) -> int: ...
|
|
14
|
+
def __or__(self, other: int) -> int: ...
|
|
15
|
+
def __xor__(self, other: int) -> int: ...
|
|
16
|
+
|
|
17
|
+
TRUTH: Final[SBool]
|
|
18
|
+
LIE: Final[SBool]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from .subtypable import SBool
|
|
2
|
+
from collections.abc import Hashable
|
|
3
|
+
from typing import Final
|
|
4
|
+
|
|
5
|
+
__all__ = ['TF_Bool', 'T_Bool', 'F_Bool', 'ALWAYS', 'NEVER', 'TF_Boolean']
|
|
6
|
+
|
|
7
|
+
class TF_Bool(SBool):
|
|
8
|
+
def __new__(cls, witness: object, flavor: Hashable = ...) -> TF_Bool: ...
|
|
9
|
+
def __invert__(self) -> TF_Bool: ...
|
|
10
|
+
def __and__(self, other: int) -> SBool: ...
|
|
11
|
+
def __or__(self, other: int) -> SBool: ...
|
|
12
|
+
def __xor__(self, other: int) -> SBool: ...
|
|
13
|
+
|
|
14
|
+
class T_Bool(TF_Bool):
|
|
15
|
+
def __new__(cls, witness: object = ..., flavor: Hashable = ...) -> T_Bool: ...
|
|
16
|
+
|
|
17
|
+
class F_Bool(TF_Bool):
|
|
18
|
+
def __new__(cls, witness: object = ..., flavor: Hashable = ...) -> F_Bool: ...
|
|
19
|
+
TF_Boolean = T_Bool | F_Bool | TF_Bool
|
|
20
|
+
ALWAYS: Final[TF_Boolean]
|
|
21
|
+
NEVER: Final[TF_Boolean]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/src/pythonic_fp/booleans/truthy_falsy.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythonic_fp_booleans-2.0.0 → pythonic_fp_booleans-3.0.0}/tests/test_flavored_non_shortcut_logic.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|