mapFolding 0.12.2__py3-none-any.whl → 0.12.3__py3-none-any.whl
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.
- mapFolding/__init__.py +4 -2
- mapFolding/_theSSOT.py +32 -88
- mapFolding/{datatypes.py → _theTypes.py} +25 -3
- mapFolding/basecamp.py +39 -34
- mapFolding/beDRY.py +79 -54
- mapFolding/dataBaskets.py +117 -74
- mapFolding/filesystemToolkit.py +140 -91
- mapFolding/oeis.py +242 -144
- mapFolding/reference/flattened.py +1 -1
- mapFolding/someAssemblyRequired/RecipeJob.py +68 -53
- mapFolding/someAssemblyRequired/__init__.py +40 -15
- mapFolding/someAssemblyRequired/_toolIfThis.py +82 -54
- mapFolding/someAssemblyRequired/_toolkitContainers.py +19 -16
- mapFolding/someAssemblyRequired/getLLVMforNoReason.py +35 -26
- mapFolding/someAssemblyRequired/makeAllModules.py +348 -275
- mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +81 -57
- mapFolding/someAssemblyRequired/toolkitNumba.py +80 -50
- mapFolding/someAssemblyRequired/transformationTools.py +63 -40
- {mapfolding-0.12.2.dist-info → mapfolding-0.12.3.dist-info}/METADATA +7 -11
- {mapfolding-0.12.2.dist-info → mapfolding-0.12.3.dist-info}/RECORD +28 -28
- tests/test_computations.py +26 -8
- tests/test_oeis.py +8 -7
- tests/test_other.py +3 -3
- tests/test_tasks.py +2 -4
- {mapfolding-0.12.2.dist-info → mapfolding-0.12.3.dist-info}/WHEEL +0 -0
- {mapfolding-0.12.2.dist-info → mapfolding-0.12.3.dist-info}/entry_points.txt +0 -0
- {mapfolding-0.12.2.dist-info → mapfolding-0.12.3.dist-info}/licenses/LICENSE +0 -0
- {mapfolding-0.12.2.dist-info → mapfolding-0.12.3.dist-info}/top_level.txt +0 -0
mapFolding/__init__.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"""Computational toolkit for analyzing multi-dimensional map folding patterns.
|
|
2
2
|
|
|
3
|
+
(AI generated docstring)
|
|
4
|
+
|
|
3
5
|
The mapFolding package provides a complete implementation of Lunnon's 1971 algorithm
|
|
4
6
|
for counting distinct folding patterns in multi-dimensional maps. This toolkit
|
|
5
7
|
transforms the complex combinatorial mathematics of map folding into accessible
|
|
@@ -40,7 +42,7 @@ For practitioners: The robust result persistence and type safety ensure
|
|
|
40
42
|
reliable completion of complex analytical tasks.
|
|
41
43
|
"""
|
|
42
44
|
|
|
43
|
-
from mapFolding.
|
|
45
|
+
from mapFolding._theTypes import (
|
|
44
46
|
Array1DElephino as Array1DElephino,
|
|
45
47
|
Array1DFoldsTotal as Array1DFoldsTotal,
|
|
46
48
|
Array1DLeavesTotal as Array1DLeavesTotal,
|
|
@@ -54,7 +56,7 @@ from mapFolding.datatypes import (
|
|
|
54
56
|
NumPyLeavesTotal as NumPyLeavesTotal,
|
|
55
57
|
)
|
|
56
58
|
|
|
57
|
-
from mapFolding._theSSOT import
|
|
59
|
+
from mapFolding._theSSOT import packageSettings as packageSettings
|
|
58
60
|
|
|
59
61
|
from mapFolding.beDRY import (
|
|
60
62
|
getConnectionGraph as getConnectionGraph,
|
mapFolding/_theSSOT.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Foundation layer for the map folding computational ecosystem.
|
|
3
3
|
|
|
4
|
+
(AI generated docstring)
|
|
5
|
+
|
|
4
6
|
This module establishes the fundamental configuration infrastructure that underpins
|
|
5
7
|
all map folding operations. Map folding, as defined by Lunnon's 1971 algorithm,
|
|
6
8
|
requires precise coordination of computational resources, type systems, and data
|
|
@@ -20,72 +22,20 @@ functions, computational state management, result persistence, and ultimately th
|
|
|
20
22
|
main computational interface that users interact with to solve map folding problems.
|
|
21
23
|
"""
|
|
22
24
|
|
|
23
|
-
from
|
|
24
|
-
from inspect import getfile as inspect_getfile
|
|
25
|
-
from pathlib import Path
|
|
26
|
-
from tomli import load as tomli_load
|
|
25
|
+
from hunterMakesPy import PackageSettings
|
|
27
26
|
import dataclasses
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
"""
|
|
31
|
-
Hardcoded package name used as fallback when dynamic resolution fails.
|
|
32
|
-
|
|
33
|
-
This constant serves as the ultimate fallback for package name resolution,
|
|
34
|
-
ensuring the package can function even when pyproject.toml is not accessible
|
|
35
|
-
during packaging or when module introspection fails during installation.
|
|
36
|
-
"""
|
|
28
|
+
packageNameHARDCODED = "mapFolding"
|
|
29
|
+
"""Hardcoded package name used as fallback when dynamic resolution fails."""
|
|
37
30
|
|
|
38
31
|
concurrencyPackageHARDCODED = 'multiprocessing'
|
|
39
|
-
"""
|
|
40
|
-
Default package identifier for concurrent execution operations.
|
|
41
|
-
|
|
42
|
-
Specifies which Python concurrency package should be used as the default
|
|
43
|
-
for parallel computations. This can be overridden through PackageSettings
|
|
44
|
-
to use alternative packages like 'numba' for specialized performance scenarios.
|
|
45
|
-
"""
|
|
46
|
-
|
|
47
|
-
# Evaluate When Packaging
|
|
48
|
-
# https://github.com/hunterhogan/mapFolding/issues/18
|
|
49
|
-
try:
|
|
50
|
-
packageNamePACKAGING: str = tomli_load(Path("../pyproject.toml").open('rb'))["project"]["name"]
|
|
51
|
-
"""
|
|
52
|
-
Package name dynamically resolved from pyproject.toml during packaging.
|
|
53
|
-
|
|
54
|
-
This value is determined by reading the project configuration file during
|
|
55
|
-
the packaging process, ensuring consistency between the package metadata
|
|
56
|
-
and runtime identification. Falls back to hardcoded value if resolution fails.
|
|
57
|
-
"""
|
|
58
|
-
except Exception:
|
|
59
|
-
packageNamePACKAGING = packageNamePACKAGING_HARDCODED
|
|
60
|
-
|
|
61
|
-
# Evaluate When Installing
|
|
62
|
-
# https://github.com/hunterhogan/mapFolding/issues/18
|
|
63
|
-
def getPathPackageINSTALLING() -> Path:
|
|
64
|
-
"""
|
|
65
|
-
Resolve the absolute filesystem path to the installed package directory.
|
|
66
|
-
|
|
67
|
-
This function determines the package location at runtime by introspecting
|
|
68
|
-
the imported module's file location. It handles both regular Python files
|
|
69
|
-
and package directories, ensuring reliable path resolution across different
|
|
70
|
-
installation methods and environments.
|
|
71
|
-
|
|
72
|
-
Returns:
|
|
73
|
-
pathPackage: Absolute path to the package directory containing the module files.
|
|
74
|
-
|
|
75
|
-
Notes:
|
|
76
|
-
The function automatically handles the case where module introspection
|
|
77
|
-
returns a file path by extracting the parent directory, ensuring the
|
|
78
|
-
returned path always points to the package directory itself.
|
|
79
|
-
"""
|
|
80
|
-
pathPackage: Path = Path(inspect_getfile(importlib_import_module(packageNamePACKAGING)))
|
|
81
|
-
if pathPackage.is_file():
|
|
82
|
-
pathPackage = pathPackage.parent
|
|
83
|
-
return pathPackage
|
|
32
|
+
"""Default package identifier for concurrent execution operations."""
|
|
84
33
|
|
|
85
34
|
@dataclasses.dataclass
|
|
86
|
-
class PackageSettings:
|
|
87
|
-
"""
|
|
88
|
-
|
|
35
|
+
class mapFoldingPackageSettings(PackageSettings):
|
|
36
|
+
"""Centralized configuration container for all package-wide settings.
|
|
37
|
+
|
|
38
|
+
(AI generated docstring)
|
|
89
39
|
|
|
90
40
|
This dataclass serves as the single source of truth for package configuration,
|
|
91
41
|
providing both static and dynamically-resolved values needed throughout the
|
|
@@ -93,23 +43,28 @@ class PackageSettings:
|
|
|
93
43
|
determined - either during packaging or at installation/runtime.
|
|
94
44
|
|
|
95
45
|
The design supports different evaluation phases to optimize performance and
|
|
96
|
-
reliability
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
46
|
+
reliability. Packaging-time values can be determined during package creation,
|
|
47
|
+
while installing-time values require filesystem access or module introspection.
|
|
48
|
+
|
|
49
|
+
Attributes
|
|
50
|
+
----------
|
|
51
|
+
fileExtension : str = '.py'
|
|
52
|
+
Standard file extension for Python modules in this package.
|
|
53
|
+
packageName : str
|
|
54
|
+
Canonical name of the package as defined in project configuration.
|
|
55
|
+
pathPackage : Path
|
|
56
|
+
Absolute filesystem path to the installed package directory.
|
|
57
|
+
concurrencyPackage : str | None = None
|
|
58
|
+
Package identifier for concurrent execution operations.
|
|
59
|
+
|
|
105
60
|
"""
|
|
106
|
-
|
|
107
|
-
packageName: str = dataclasses.field(default = packageNamePACKAGING, metadata={'evaluateWhen': 'packaging'})
|
|
108
|
-
pathPackage: Path = dataclasses.field(default_factory=getPathPackageINSTALLING, metadata={'evaluateWhen': 'installing'})
|
|
61
|
+
|
|
109
62
|
concurrencyPackage: str | None = None
|
|
110
63
|
"""
|
|
111
64
|
Package identifier for concurrent execution operations.
|
|
112
65
|
|
|
66
|
+
(AI generated docstring)
|
|
67
|
+
|
|
113
68
|
Specifies which Python package should be used for parallel processing
|
|
114
69
|
in computationally intensive operations. When None, the default concurrency
|
|
115
70
|
package specified in the module constants is used. Accepted values include
|
|
@@ -118,20 +73,9 @@ class PackageSettings:
|
|
|
118
73
|
"""
|
|
119
74
|
|
|
120
75
|
concurrencyPackage = concurrencyPackageHARDCODED
|
|
121
|
-
"""
|
|
122
|
-
Active concurrency package configuration for the current session.
|
|
123
|
-
|
|
124
|
-
This module-level variable holds the currently selected concurrency package
|
|
125
|
-
identifier, initialized from the hardcoded default but available for runtime
|
|
126
|
-
modification through the package settings system.
|
|
127
|
-
"""
|
|
76
|
+
"""Active concurrency package configuration for the current session."""
|
|
128
77
|
|
|
129
|
-
packageSettings =
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
This singleton instance serves as the primary interface for accessing package
|
|
134
|
-
configuration throughout the codebase. It combines statically-defined defaults
|
|
135
|
-
with dynamically-resolved values to provide a complete configuration profile
|
|
136
|
-
for the current package installation and runtime environment.
|
|
137
|
-
"""
|
|
78
|
+
packageSettings = mapFoldingPackageSettings(
|
|
79
|
+
identifierPackageFALLBACK=packageNameHARDCODED
|
|
80
|
+
, concurrencyPackage=concurrencyPackage)
|
|
81
|
+
"""Global package settings."""
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Type system architecture for map folding computational domains.
|
|
3
3
|
|
|
4
|
+
(AI generated docstring)
|
|
5
|
+
|
|
4
6
|
Building upon the configuration foundation, this module defines the complete type
|
|
5
7
|
hierarchy that ensures type safety and semantic clarity throughout the map folding
|
|
6
8
|
computational framework. The type system recognizes three distinct computational
|
|
@@ -20,15 +22,15 @@ complex multi-dimensional folding patterns. The array types built from these
|
|
|
20
22
|
base types provide the structured data containers that computational state
|
|
21
23
|
management depends upon.
|
|
22
24
|
"""
|
|
23
|
-
from numpy import
|
|
24
|
-
dtype, integer, ndarray, uint8 as numpy_uint8, uint16 as numpy_uint16, uint64 as numpy_uint64,
|
|
25
|
-
)
|
|
25
|
+
from numpy import dtype, integer, ndarray, uint8 as numpy_uint8, uint16 as numpy_uint16, uint64 as numpy_uint64
|
|
26
26
|
from typing import Any, TypeAlias, TypeVar
|
|
27
27
|
|
|
28
28
|
NumPyIntegerType = TypeVar('NumPyIntegerType', bound=integer[Any], covariant=True)
|
|
29
29
|
"""
|
|
30
30
|
Generic type variable for NumPy integer types used in computational operations.
|
|
31
31
|
|
|
32
|
+
(AI generated docstring)
|
|
33
|
+
|
|
32
34
|
This type variable enables generic programming with NumPy integer types while
|
|
33
35
|
maintaining type safety. It supports covariant relationships between different
|
|
34
36
|
NumPy integer types and their array containers.
|
|
@@ -38,6 +40,8 @@ DatatypeLeavesTotal: TypeAlias = int
|
|
|
38
40
|
"""
|
|
39
41
|
Python type for leaf-related counts and indices in map folding computations.
|
|
40
42
|
|
|
43
|
+
(AI generated docstring)
|
|
44
|
+
|
|
41
45
|
Represents quantities related to individual map sections (leaves), including
|
|
42
46
|
total leaf counts, leaf indices, and dimensional parameters. Uses standard
|
|
43
47
|
Python integers for compatibility with general computations while enabling
|
|
@@ -48,6 +52,8 @@ NumPyLeavesTotal: TypeAlias = numpy_uint8
|
|
|
48
52
|
"""
|
|
49
53
|
NumPy type for efficient leaf-related computations and array operations.
|
|
50
54
|
|
|
55
|
+
(AI generated docstring)
|
|
56
|
+
|
|
51
57
|
Corresponds to `DatatypeLeavesTotal` but optimized for NumPy operations.
|
|
52
58
|
Uses 8-bit unsigned integers since leaf counts in practical map folding
|
|
53
59
|
scenarios typically remain small (under 256).
|
|
@@ -57,6 +63,8 @@ DatatypeElephino: TypeAlias = int
|
|
|
57
63
|
"""
|
|
58
64
|
Python type for internal computational indices and intermediate values.
|
|
59
65
|
|
|
66
|
+
(AI generated docstring)
|
|
67
|
+
|
|
60
68
|
Used for temporary variables, gap indices, and other internal computational
|
|
61
69
|
state that doesn't directly correspond to leaves or final fold counts. The
|
|
62
70
|
name follows the package convention for internal computational domains.
|
|
@@ -66,6 +74,8 @@ NumPyElephino: TypeAlias = numpy_uint16
|
|
|
66
74
|
"""
|
|
67
75
|
NumPy type for internal computational operations requiring moderate value ranges.
|
|
68
76
|
|
|
77
|
+
(AI generated docstring)
|
|
78
|
+
|
|
69
79
|
Corresponds to `DatatypeElephino` with 16-bit unsigned integer storage,
|
|
70
80
|
providing sufficient range for internal computations while maintaining
|
|
71
81
|
memory efficiency in array operations.
|
|
@@ -75,6 +85,8 @@ DatatypeFoldsTotal: TypeAlias = int
|
|
|
75
85
|
"""
|
|
76
86
|
Python type for final fold counts and pattern totals.
|
|
77
87
|
|
|
88
|
+
(AI generated docstring)
|
|
89
|
+
|
|
78
90
|
Represents the ultimate results of map folding computations - the total number
|
|
79
91
|
of distinct folding patterns possible for a given map configuration. These
|
|
80
92
|
values can grow exponentially with map size, requiring flexible integer types.
|
|
@@ -84,6 +96,8 @@ NumPyFoldsTotal: TypeAlias = numpy_uint64
|
|
|
84
96
|
"""
|
|
85
97
|
NumPy type for large fold count computations and high-precision results.
|
|
86
98
|
|
|
99
|
+
(AI generated docstring)
|
|
100
|
+
|
|
87
101
|
Corresponds to `DatatypeFoldsTotal` using 64-bit unsigned integers to
|
|
88
102
|
accommodate the exponentially large values that can result from map folding
|
|
89
103
|
computations on even moderately-sized maps.
|
|
@@ -93,6 +107,8 @@ Array3D: TypeAlias = ndarray[tuple[int, int, int], dtype[NumPyLeavesTotal]]
|
|
|
93
107
|
"""
|
|
94
108
|
Three-dimensional NumPy array type for connection graph representations.
|
|
95
109
|
|
|
110
|
+
(AI generated docstring)
|
|
111
|
+
|
|
96
112
|
Used to store the connectivity relationships between map leaves in a
|
|
97
113
|
3D array structure. The array uses `NumPyLeavesTotal` element type since
|
|
98
114
|
the stored values represent leaf indices and connection states.
|
|
@@ -102,6 +118,8 @@ Array1DLeavesTotal: TypeAlias = ndarray[tuple[int], dtype[NumPyLeavesTotal]]
|
|
|
102
118
|
"""
|
|
103
119
|
One-dimensional NumPy array type for leaf-related data sequences.
|
|
104
120
|
|
|
121
|
+
(AI generated docstring)
|
|
122
|
+
|
|
105
123
|
Stores sequences of leaf counts, indices, or related values in efficient
|
|
106
124
|
array format. Common uses include leaf sequences, gap locations, and
|
|
107
125
|
dimensional data where each element relates to the leaves domain.
|
|
@@ -111,6 +129,8 @@ Array1DElephino: TypeAlias = ndarray[tuple[int], dtype[NumPyElephino]]
|
|
|
111
129
|
"""
|
|
112
130
|
One-dimensional NumPy array type for internal computational sequences.
|
|
113
131
|
|
|
132
|
+
(AI generated docstring)
|
|
133
|
+
|
|
114
134
|
Used for storing sequences of internal computational values such as
|
|
115
135
|
gap range starts, temporary indices, and other intermediate results
|
|
116
136
|
that require the elephino computational domain's value range.
|
|
@@ -120,6 +140,8 @@ Array1DFoldsTotal: TypeAlias = ndarray[tuple[int], dtype[NumPyFoldsTotal]]
|
|
|
120
140
|
"""
|
|
121
141
|
One-dimensional NumPy array type for sequences of fold count results.
|
|
122
142
|
|
|
143
|
+
(AI generated docstring)
|
|
144
|
+
|
|
123
145
|
Stores sequences of fold totals and pattern counts, using the large
|
|
124
146
|
integer type to accommodate the potentially enormous values that
|
|
125
147
|
result from complex map folding computations.
|
mapFolding/basecamp.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Unified interface for map folding computation orchestration.
|
|
3
3
|
|
|
4
|
+
(AI generated docstring)
|
|
5
|
+
|
|
4
6
|
This module represents the culmination of the computational ecosystem, providing
|
|
5
7
|
the primary entry point where users interact with the complete map folding analysis
|
|
6
8
|
system. It orchestrates all preceding layers: the configuration foundation,
|
|
@@ -23,13 +25,13 @@ consistent, reliable, and efficiently computed folding pattern counts.
|
|
|
23
25
|
|
|
24
26
|
from collections.abc import Sequence
|
|
25
27
|
from mapFolding import (
|
|
26
|
-
getPathFilenameFoldsTotal, packageSettings, saveFoldsTotal, saveFoldsTotalFAILearly,
|
|
27
|
-
|
|
28
|
-
)
|
|
28
|
+
getPathFilenameFoldsTotal, packageSettings, saveFoldsTotal, saveFoldsTotalFAILearly, setProcessorLimit,
|
|
29
|
+
validateListDimensions)
|
|
29
30
|
from os import PathLike
|
|
30
31
|
from pathlib import PurePath
|
|
32
|
+
import contextlib
|
|
31
33
|
|
|
32
|
-
def countFolds(listDimensions: Sequence[int] | None = None
|
|
34
|
+
def countFolds(listDimensions: Sequence[int] | None = None # noqa: C901
|
|
33
35
|
, pathLikeWriteFoldsTotal: PathLike[str] | PurePath | None = None
|
|
34
36
|
, computationDivisions: int | str | None = None
|
|
35
37
|
, CPUlimit: int | float | bool | None = None
|
|
@@ -42,6 +44,8 @@ def countFolds(listDimensions: Sequence[int] | None = None
|
|
|
42
44
|
"""
|
|
43
45
|
Count the total number of possible foldings for a given map dimensions.
|
|
44
46
|
|
|
47
|
+
(AI generated docstring)
|
|
48
|
+
|
|
45
49
|
This function serves as the main public interface to the map folding algorithm, handling all parameter validation,
|
|
46
50
|
computation state management, and result persistence in a user-friendly way.
|
|
47
51
|
|
|
@@ -86,32 +90,33 @@ def countFolds(listDimensions: Sequence[int] | None = None
|
|
|
86
90
|
computation time. If logicalCores >= `leavesTotal`, it will probably be faster. If logicalCores <= 2 * `leavesTotal`, it
|
|
87
91
|
will almost certainly be slower for all map dimensions.
|
|
88
92
|
"""
|
|
89
|
-
# mapShape
|
|
93
|
+
# mapShape ---------------------------------------------------------------------
|
|
90
94
|
|
|
91
95
|
if mapShape:
|
|
92
96
|
pass
|
|
93
97
|
else:
|
|
94
98
|
if oeisID and oeis_n:
|
|
95
|
-
from mapFolding.oeis import settingsOEIS
|
|
96
|
-
|
|
99
|
+
from mapFolding.oeis import settingsOEIS # noqa: PLC0415
|
|
100
|
+
with contextlib.suppress(KeyError):
|
|
97
101
|
mapShape = settingsOEIS[oeisID]['getMapShape'](oeis_n)
|
|
98
|
-
except KeyError:
|
|
99
|
-
pass
|
|
100
102
|
if not mapShape and listDimensions:
|
|
101
103
|
mapShape = validateListDimensions(listDimensions)
|
|
102
104
|
|
|
103
105
|
if mapShape is None:
|
|
104
|
-
|
|
106
|
+
message = (
|
|
107
|
+
f"""I received these values:
|
|
105
108
|
`{listDimensions = }`,
|
|
106
109
|
`{mapShape = }`,
|
|
107
110
|
`{oeisID = }` and `{oeis_n = }`,
|
|
108
|
-
but I was unable to select a map for which to count the folds."""
|
|
111
|
+
but I was unable to select a map for which to count the folds."""
|
|
112
|
+
)
|
|
113
|
+
raise ValueError(message)
|
|
109
114
|
|
|
110
|
-
# task division instructions
|
|
115
|
+
# task division instructions -----------------------------------------------------
|
|
111
116
|
|
|
112
117
|
if computationDivisions:
|
|
113
118
|
concurrencyLimit: int = setProcessorLimit(CPUlimit, packageSettings.concurrencyPackage)
|
|
114
|
-
from mapFolding.beDRY import getLeavesTotal, getTaskDivisions
|
|
119
|
+
from mapFolding.beDRY import getLeavesTotal, getTaskDivisions # noqa: PLC0415
|
|
115
120
|
leavesTotal: int = getLeavesTotal(mapShape)
|
|
116
121
|
taskDivisions = getTaskDivisions(computationDivisions, concurrencyLimit, leavesTotal)
|
|
117
122
|
del leavesTotal
|
|
@@ -119,7 +124,7 @@ def countFolds(listDimensions: Sequence[int] | None = None
|
|
|
119
124
|
concurrencyLimit = 1
|
|
120
125
|
taskDivisions = 0
|
|
121
126
|
|
|
122
|
-
# memorialization instructions
|
|
127
|
+
# memorialization instructions ---------------------------------------------
|
|
123
128
|
|
|
124
129
|
if pathLikeWriteFoldsTotal is not None:
|
|
125
130
|
pathFilenameFoldsTotal = getPathFilenameFoldsTotal(mapShape, pathLikeWriteFoldsTotal)
|
|
@@ -127,70 +132,70 @@ def countFolds(listDimensions: Sequence[int] | None = None
|
|
|
127
132
|
else:
|
|
128
133
|
pathFilenameFoldsTotal = None
|
|
129
134
|
|
|
130
|
-
# Flow control until I can figure out a good way
|
|
135
|
+
# Flow control until I can figure out a good way ---------------------------------
|
|
131
136
|
|
|
132
137
|
if flow == 'daoOfMapFolding':
|
|
133
|
-
from mapFolding.dataBaskets import MapFoldingState
|
|
138
|
+
from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
|
|
134
139
|
mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
|
|
135
140
|
|
|
136
|
-
from mapFolding.daoOfMapFolding import doTheNeedful
|
|
141
|
+
from mapFolding.daoOfMapFolding import doTheNeedful # noqa: PLC0415
|
|
137
142
|
mapFoldingState = doTheNeedful(mapFoldingState)
|
|
138
143
|
foldsTotal = mapFoldingState.foldsTotal
|
|
139
144
|
|
|
140
|
-
elif flow == 'theorem2' and any(dimension > 2 for dimension in mapShape):
|
|
141
|
-
from mapFolding.dataBaskets import MapFoldingState
|
|
145
|
+
elif flow == 'theorem2' and any(dimension > 2 for dimension in mapShape): # noqa: PLR2004
|
|
146
|
+
from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
|
|
142
147
|
mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
|
|
143
148
|
|
|
144
|
-
from mapFolding.syntheticModules.initializeCount import initializeGroupsOfFolds
|
|
149
|
+
from mapFolding.syntheticModules.initializeCount import initializeGroupsOfFolds # noqa: PLC0415
|
|
145
150
|
mapFoldingState = initializeGroupsOfFolds(mapFoldingState)
|
|
146
151
|
|
|
147
|
-
from mapFolding.syntheticModules.theorem2 import count
|
|
152
|
+
from mapFolding.syntheticModules.theorem2 import count # noqa: PLC0415
|
|
148
153
|
mapFoldingState = count(mapFoldingState)
|
|
149
154
|
|
|
150
155
|
foldsTotal = mapFoldingState.foldsTotal
|
|
151
156
|
|
|
152
|
-
elif flow == 'theorem2Trimmed' and any(dimension > 2 for dimension in mapShape):
|
|
153
|
-
from mapFolding.dataBaskets import MapFoldingState
|
|
157
|
+
elif flow == 'theorem2Trimmed' and any(dimension > 2 for dimension in mapShape): # noqa: PLR2004
|
|
158
|
+
from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
|
|
154
159
|
mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
|
|
155
160
|
|
|
156
|
-
from mapFolding.syntheticModules.initializeCount import initializeGroupsOfFolds
|
|
161
|
+
from mapFolding.syntheticModules.initializeCount import initializeGroupsOfFolds # noqa: PLC0415
|
|
157
162
|
mapFoldingState = initializeGroupsOfFolds(mapFoldingState)
|
|
158
163
|
|
|
159
|
-
from mapFolding.syntheticModules.theorem2Trimmed import count
|
|
164
|
+
from mapFolding.syntheticModules.theorem2Trimmed import count # noqa: PLC0415
|
|
160
165
|
mapFoldingState = count(mapFoldingState)
|
|
161
166
|
|
|
162
167
|
foldsTotal = mapFoldingState.foldsTotal
|
|
163
168
|
|
|
164
|
-
elif (flow == 'theorem2Numba' or taskDivisions == 0) and any(dimension > 2 for dimension in mapShape):
|
|
165
|
-
from mapFolding.dataBaskets import MapFoldingState
|
|
169
|
+
elif (flow == 'theorem2Numba' or taskDivisions == 0) and any(dimension > 2 for dimension in mapShape): # noqa: PLR2004
|
|
170
|
+
from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
|
|
166
171
|
mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
|
|
167
172
|
|
|
168
|
-
from mapFolding.syntheticModules.initializeCount import initializeGroupsOfFolds
|
|
173
|
+
from mapFolding.syntheticModules.initializeCount import initializeGroupsOfFolds # noqa: PLC0415
|
|
169
174
|
mapFoldingState = initializeGroupsOfFolds(mapFoldingState)
|
|
170
175
|
|
|
171
|
-
from mapFolding.syntheticModules.dataPacking import sequential
|
|
176
|
+
from mapFolding.syntheticModules.dataPacking import sequential # noqa: PLC0415
|
|
172
177
|
mapFoldingState = sequential(mapFoldingState)
|
|
173
178
|
|
|
174
179
|
foldsTotal = mapFoldingState.foldsTotal
|
|
175
180
|
|
|
176
181
|
elif taskDivisions > 1:
|
|
177
|
-
from mapFolding.dataBaskets import ParallelMapFoldingState
|
|
182
|
+
from mapFolding.dataBaskets import ParallelMapFoldingState # noqa: PLC0415
|
|
178
183
|
parallelMapFoldingState: ParallelMapFoldingState = ParallelMapFoldingState(mapShape, taskDivisions=taskDivisions)
|
|
179
184
|
|
|
180
|
-
from mapFolding.syntheticModules.countParallel import doTheNeedful
|
|
185
|
+
from mapFolding.syntheticModules.countParallel import doTheNeedful # noqa: PLC0415
|
|
181
186
|
|
|
182
187
|
# `listStatesParallel` exists in case you want to research the parallel computation.
|
|
183
188
|
foldsTotal, listStatesParallel = doTheNeedful(parallelMapFoldingState, concurrencyLimit) # pyright: ignore[reportUnusedVariable]
|
|
184
189
|
|
|
185
190
|
else:
|
|
186
|
-
from mapFolding.dataBaskets import MapFoldingState
|
|
191
|
+
from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
|
|
187
192
|
mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
|
|
188
193
|
|
|
189
|
-
from mapFolding.syntheticModules.daoOfMapFolding import doTheNeedful
|
|
194
|
+
from mapFolding.syntheticModules.daoOfMapFolding import doTheNeedful # noqa: PLC0415
|
|
190
195
|
mapFoldingState = doTheNeedful(mapFoldingState)
|
|
191
196
|
foldsTotal = mapFoldingState.foldsTotal
|
|
192
197
|
|
|
193
|
-
# Follow memorialization instructions
|
|
198
|
+
# Follow memorialization instructions ---------------------------------------------
|
|
194
199
|
|
|
195
200
|
if pathFilenameFoldsTotal is not None:
|
|
196
201
|
saveFoldsTotal(pathFilenameFoldsTotal, foldsTotal)
|