mapFolding 0.9.0__py3-none-any.whl → 0.9.2__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 +49 -48
- mapFolding/basecamp.py +40 -35
- mapFolding/beDRY.py +75 -69
- mapFolding/oeis.py +74 -85
- mapFolding/reference/__init__.py +2 -2
- mapFolding/someAssemblyRequired/RecipeJob.py +103 -0
- mapFolding/someAssemblyRequired/__init__.py +31 -29
- mapFolding/someAssemblyRequired/_theTypes.py +9 -1
- mapFolding/someAssemblyRequired/_tool_Make.py +1 -2
- mapFolding/someAssemblyRequired/_tool_Then.py +16 -8
- mapFolding/someAssemblyRequired/_toolboxAntecedents.py +111 -23
- mapFolding/someAssemblyRequired/_toolboxContainers.py +27 -28
- mapFolding/someAssemblyRequired/_toolboxPython.py +3 -0
- mapFolding/someAssemblyRequired/synthesizeNumbaJob.py +83 -51
- mapFolding/someAssemblyRequired/toolboxNumba.py +19 -220
- mapFolding/someAssemblyRequired/transformationTools.py +183 -12
- mapFolding/syntheticModules/{numbaCount_doTheNeedful.py → numbaCount.py} +13 -12
- mapFolding/theDao.py +37 -36
- mapFolding/theSSOT.py +29 -33
- mapFolding/toolboxFilesystem.py +29 -38
- {mapfolding-0.9.0.dist-info → mapfolding-0.9.2.dist-info}/METADATA +2 -1
- mapfolding-0.9.2.dist-info/RECORD +47 -0
- tests/test_computations.py +2 -1
- tests/test_other.py +0 -7
- mapfolding-0.9.0.dist-info/RECORD +0 -46
- /mapFolding/reference/{lunnanNumpy.py → lunnonNumpy.py} +0 -0
- /mapFolding/reference/{lunnanWhile.py → lunnonWhile.py} +0 -0
- {mapfolding-0.9.0.dist-info → mapfolding-0.9.2.dist-info}/WHEEL +0 -0
- {mapfolding-0.9.0.dist-info → mapfolding-0.9.2.dist-info}/entry_points.txt +0 -0
- {mapfolding-0.9.0.dist-info → mapfolding-0.9.2.dist-info}/licenses/LICENSE +0 -0
- {mapfolding-0.9.0.dist-info → mapfolding-0.9.2.dist-info}/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ from mapFolding.theSSOT import Array1DElephino, Array1DFoldsTotal, Array1DLeaves
|
|
|
4
4
|
from numba import jit
|
|
5
5
|
|
|
6
6
|
def countInitialize(state: ComputationState) -> ComputationState:
|
|
7
|
-
while state.
|
|
7
|
+
while state.gap1ndex == 0:
|
|
8
8
|
if state.leaf1ndex <= 1 or state.leafBelow[0] == 1:
|
|
9
9
|
state.dimensionsUnconstrained = state.dimensionsTotal
|
|
10
10
|
state.gap1ndexCeiling = state.gapRangeStart[state.leaf1ndex - 1]
|
|
@@ -42,12 +42,10 @@ def countInitialize(state: ComputationState) -> ComputationState:
|
|
|
42
42
|
state.leafAbove[state.leafBelow[state.leaf1ndex]] = state.leaf1ndex
|
|
43
43
|
state.gapRangeStart[state.leaf1ndex] = state.gap1ndex
|
|
44
44
|
state.leaf1ndex += 1
|
|
45
|
-
if state.gap1ndex > 0:
|
|
46
|
-
break
|
|
47
45
|
return state
|
|
48
46
|
|
|
49
47
|
@jit(_nrt=True, boundscheck=False, cache=True, error_model='numpy', fastmath=True, forceinline=True, inline='always', looplift=False, no_cfunc_wrapper=False, no_cpython_wrapper=False, nopython=True, parallel=False)
|
|
50
|
-
def countParallel(
|
|
48
|
+
def countParallel(leavesTotal: DatatypeLeavesTotal, taskDivisions: DatatypeLeavesTotal, connectionGraph: Array3D, dimensionsTotal: DatatypeLeavesTotal, countDimensionsGapped: Array1DLeavesTotal, dimensionsUnconstrained: DatatypeLeavesTotal, gapRangeStart: Array1DElephino, gapsWhere: Array1DLeavesTotal, leafAbove: Array1DLeavesTotal, leafBelow: Array1DLeavesTotal, foldGroups: Array1DFoldsTotal, gap1ndex: DatatypeElephino, gap1ndexCeiling: DatatypeElephino, groupsOfFolds: DatatypeFoldsTotal, indexDimension: DatatypeLeavesTotal, indexMiniGap: DatatypeElephino, leaf1ndex: DatatypeLeavesTotal, leafConnectee: DatatypeLeavesTotal, taskIndex: DatatypeLeavesTotal) -> DatatypeFoldsTotal:
|
|
51
49
|
while leaf1ndex > 0:
|
|
52
50
|
if leaf1ndex <= 1 or leafBelow[0] == 1:
|
|
53
51
|
if leaf1ndex > leavesTotal:
|
|
@@ -92,7 +90,7 @@ def countParallel(mapShape: tuple[DatatypeLeavesTotal, ...], leavesTotal: Dataty
|
|
|
92
90
|
return groupsOfFolds
|
|
93
91
|
|
|
94
92
|
@jit(_nrt=True, boundscheck=False, cache=True, error_model='numpy', fastmath=True, forceinline=True, inline='always', looplift=False, no_cfunc_wrapper=False, no_cpython_wrapper=False, nopython=True, parallel=False)
|
|
95
|
-
def countSequential(mapShape: tuple[DatatypeLeavesTotal, ...], leavesTotal: DatatypeLeavesTotal, taskDivisions: DatatypeLeavesTotal, concurrencyLimit: DatatypeElephino, connectionGraph: Array3D, dimensionsTotal: DatatypeLeavesTotal, countDimensionsGapped: Array1DLeavesTotal, dimensionsUnconstrained: DatatypeLeavesTotal, gapRangeStart: Array1DElephino, gapsWhere: Array1DLeavesTotal, leafAbove: Array1DLeavesTotal, leafBelow: Array1DLeavesTotal, foldGroups: Array1DFoldsTotal, foldsTotal: DatatypeFoldsTotal, gap1ndex:
|
|
93
|
+
def countSequential(mapShape: tuple[DatatypeLeavesTotal, ...], leavesTotal: DatatypeLeavesTotal, taskDivisions: DatatypeLeavesTotal, concurrencyLimit: DatatypeElephino, connectionGraph: Array3D, dimensionsTotal: DatatypeLeavesTotal, countDimensionsGapped: Array1DLeavesTotal, dimensionsUnconstrained: DatatypeLeavesTotal, gapRangeStart: Array1DElephino, gapsWhere: Array1DLeavesTotal, leafAbove: Array1DLeavesTotal, leafBelow: Array1DLeavesTotal, foldGroups: Array1DFoldsTotal, foldsTotal: DatatypeFoldsTotal, gap1ndex: DatatypeElephino, gap1ndexCeiling: DatatypeElephino, groupsOfFolds: DatatypeFoldsTotal, indexDimension: DatatypeLeavesTotal, indexLeaf: DatatypeLeavesTotal, indexMiniGap: DatatypeElephino, leaf1ndex: DatatypeLeavesTotal, leafConnectee: DatatypeLeavesTotal, taskIndex: DatatypeLeavesTotal) -> tuple[tuple[DatatypeLeavesTotal, ...], DatatypeLeavesTotal, DatatypeLeavesTotal, DatatypeElephino, Array3D, DatatypeLeavesTotal, Array1DLeavesTotal, DatatypeLeavesTotal, Array1DElephino, Array1DLeavesTotal, Array1DLeavesTotal, Array1DLeavesTotal, Array1DFoldsTotal, DatatypeFoldsTotal, DatatypeElephino, DatatypeElephino, DatatypeFoldsTotal, DatatypeLeavesTotal, DatatypeLeavesTotal, DatatypeElephino, DatatypeLeavesTotal, DatatypeLeavesTotal, DatatypeLeavesTotal]:
|
|
96
94
|
while leaf1ndex > 0:
|
|
97
95
|
if leaf1ndex <= 1 or leafBelow[0] == 1:
|
|
98
96
|
if leaf1ndex > leavesTotal:
|
|
@@ -124,6 +122,9 @@ def countSequential(mapShape: tuple[DatatypeLeavesTotal, ...], leavesTotal: Data
|
|
|
124
122
|
leaf1ndex -= 1
|
|
125
123
|
leafBelow[leafAbove[leaf1ndex]] = leafBelow[leaf1ndex]
|
|
126
124
|
leafAbove[leafBelow[leaf1ndex]] = leafAbove[leaf1ndex]
|
|
125
|
+
if leaf1ndex == 3 and groupsOfFolds:
|
|
126
|
+
groupsOfFolds *= 2
|
|
127
|
+
break
|
|
127
128
|
if leaf1ndex > 0:
|
|
128
129
|
gap1ndex -= 1
|
|
129
130
|
leafAbove[leaf1ndex] = gapsWhere[gap1ndex]
|
|
@@ -158,16 +159,16 @@ def doTheNeedful(state: ComputationState) -> ComputationState:
|
|
|
158
159
|
leafBelow: Array1DLeavesTotal = state.leafBelow
|
|
159
160
|
foldGroups: Array1DFoldsTotal = state.foldGroups
|
|
160
161
|
foldsTotal: DatatypeFoldsTotal = state.foldsTotal
|
|
161
|
-
gap1ndex:
|
|
162
|
+
gap1ndex: DatatypeElephino = state.gap1ndex
|
|
162
163
|
gap1ndexCeiling: DatatypeElephino = state.gap1ndexCeiling
|
|
163
164
|
groupsOfFolds: DatatypeFoldsTotal = state.groupsOfFolds
|
|
164
165
|
indexDimension: DatatypeLeavesTotal = state.indexDimension
|
|
165
166
|
indexLeaf: DatatypeLeavesTotal = state.indexLeaf
|
|
166
167
|
indexMiniGap: DatatypeElephino = state.indexMiniGap
|
|
167
|
-
leaf1ndex:
|
|
168
|
-
leafConnectee:
|
|
168
|
+
leaf1ndex: DatatypeLeavesTotal = state.leaf1ndex
|
|
169
|
+
leafConnectee: DatatypeLeavesTotal = state.leafConnectee
|
|
169
170
|
taskIndex: DatatypeLeavesTotal = state.taskIndex
|
|
170
|
-
dictionaryConcurrency[indexSherpa] = concurrencyManager.submit(countParallel,
|
|
171
|
+
dictionaryConcurrency[indexSherpa] = concurrencyManager.submit(countParallel, leavesTotal, taskDivisions, connectionGraph, dimensionsTotal, countDimensionsGapped, dimensionsUnconstrained, gapRangeStart, gapsWhere, leafAbove, leafBelow, foldGroups, gap1ndex, gap1ndexCeiling, groupsOfFolds, indexDimension, indexMiniGap, leaf1ndex, leafConnectee, taskIndex)
|
|
171
172
|
for indexSherpa in range(stateParallel.taskDivisions):
|
|
172
173
|
stateParallel.foldGroups[indexSherpa] = dictionaryConcurrency[indexSherpa].result()
|
|
173
174
|
state = stateParallel
|
|
@@ -186,14 +187,14 @@ def doTheNeedful(state: ComputationState) -> ComputationState:
|
|
|
186
187
|
leafBelow: Array1DLeavesTotal = state.leafBelow
|
|
187
188
|
foldGroups: Array1DFoldsTotal = state.foldGroups
|
|
188
189
|
foldsTotal: DatatypeFoldsTotal = state.foldsTotal
|
|
189
|
-
gap1ndex:
|
|
190
|
+
gap1ndex: DatatypeElephino = state.gap1ndex
|
|
190
191
|
gap1ndexCeiling: DatatypeElephino = state.gap1ndexCeiling
|
|
191
192
|
groupsOfFolds: DatatypeFoldsTotal = state.groupsOfFolds
|
|
192
193
|
indexDimension: DatatypeLeavesTotal = state.indexDimension
|
|
193
194
|
indexLeaf: DatatypeLeavesTotal = state.indexLeaf
|
|
194
195
|
indexMiniGap: DatatypeElephino = state.indexMiniGap
|
|
195
|
-
leaf1ndex:
|
|
196
|
-
leafConnectee:
|
|
196
|
+
leaf1ndex: DatatypeLeavesTotal = state.leaf1ndex
|
|
197
|
+
leafConnectee: DatatypeLeavesTotal = state.leafConnectee
|
|
197
198
|
taskIndex: DatatypeLeavesTotal = state.taskIndex
|
|
198
199
|
mapShape, leavesTotal, taskDivisions, concurrencyLimit, connectionGraph, dimensionsTotal, countDimensionsGapped, dimensionsUnconstrained, gapRangeStart, gapsWhere, leafAbove, leafBelow, foldGroups, foldsTotal, gap1ndex, gap1ndexCeiling, groupsOfFolds, indexDimension, indexLeaf, indexMiniGap, leaf1ndex, leafConnectee, taskIndex = countSequential(mapShape, leavesTotal, taskDivisions, concurrencyLimit, connectionGraph, dimensionsTotal, countDimensionsGapped, dimensionsUnconstrained, gapRangeStart, gapsWhere, leafAbove, leafBelow, foldGroups, foldsTotal, gap1ndex, gap1ndexCeiling, groupsOfFolds, indexDimension, indexLeaf, indexMiniGap, leaf1ndex, leafConnectee, taskIndex)
|
|
199
200
|
state = ComputationState(mapShape=mapShape, leavesTotal=leavesTotal, taskDivisions=taskDivisions, concurrencyLimit=concurrencyLimit, countDimensionsGapped=countDimensionsGapped, dimensionsUnconstrained=dimensionsUnconstrained, gapRangeStart=gapRangeStart, gapsWhere=gapsWhere, leafAbove=leafAbove, leafBelow=leafBelow, foldGroups=foldGroups, foldsTotal=foldsTotal, gap1ndex=gap1ndex, gap1ndexCeiling=gap1ndexCeiling, groupsOfFolds=groupsOfFolds, indexDimension=indexDimension, indexLeaf=indexLeaf, indexMiniGap=indexMiniGap, leaf1ndex=leaf1ndex, leafConnectee=leafConnectee, taskIndex=taskIndex)
|
mapFolding/theDao.py
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Core computational algorithm for map folding counting and enumeration.
|
|
3
3
|
|
|
4
|
-
This module implements the core algorithms for enumerating and counting the various ways
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- A "
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
based on task divisions and concurrency parameters.
|
|
4
|
+
This module implements the core algorithms for enumerating and counting the various ways a rectangular map can be
|
|
5
|
+
folded. It uses a functional state-transformation approach, where each function performs a specific state mutation and
|
|
6
|
+
returns the updated state. The module provides three main counting algorithms:
|
|
7
|
+
|
|
8
|
+
1. `countInitialize`: Sets up the initial state for computation.
|
|
9
|
+
2. `countSequential`: Processes the folding computation sequentially.
|
|
10
|
+
3. `countParallel`: Distributes the computation across multiple processes.
|
|
11
|
+
|
|
12
|
+
All algorithms operate on a `ComputationState` object that tracks the folding process, including:
|
|
13
|
+
- A "leaf" is a unit square in the map.
|
|
14
|
+
- A "gap" is a potential position where a new leaf can be folded.
|
|
15
|
+
- Connections track how leaves can connect above/below each other.
|
|
16
|
+
- Leaves are enumerated starting from 1, not 0; hence, `leaf1ndex` not `leafIndex`.
|
|
17
|
+
|
|
18
|
+
The `doTheNeedful` function is the main entry point that orchestrates the computation strategy based on task divisions and
|
|
19
|
+
concurrency parameters.
|
|
21
20
|
"""
|
|
22
21
|
from concurrent.futures import Future as ConcurrentFuture, ProcessPoolExecutor
|
|
23
22
|
from copy import deepcopy
|
|
@@ -43,12 +42,6 @@ def activeLeafIsTheFirstLeaf(state: ComputationState) -> bool:
|
|
|
43
42
|
def allDimensionsAreUnconstrained(state: ComputationState) -> bool:
|
|
44
43
|
return not state.dimensionsUnconstrained
|
|
45
44
|
|
|
46
|
-
def undoLastLeafPlacement(state: ComputationState) -> ComputationState:
|
|
47
|
-
state.leaf1ndex -= 1
|
|
48
|
-
state.leafBelow[state.leafAbove[state.leaf1ndex]] = state.leafBelow[state.leaf1ndex]
|
|
49
|
-
state.leafAbove[state.leafBelow[state.leaf1ndex]] = state.leafAbove[state.leaf1ndex]
|
|
50
|
-
return state
|
|
51
|
-
|
|
52
45
|
def countGaps(state: ComputationState) -> ComputationState:
|
|
53
46
|
state.gapsWhere[state.gap1ndexCeiling] = state.leafConnectee
|
|
54
47
|
if state.countDimensionsGapped[state.leafConnectee] == 0:
|
|
@@ -100,6 +93,16 @@ def initializeVariablesToFindGaps(state: ComputationState) -> ComputationState:
|
|
|
100
93
|
state.indexDimension = 0
|
|
101
94
|
return state
|
|
102
95
|
|
|
96
|
+
def insertLeafAtGap(state: ComputationState) -> ComputationState:
|
|
97
|
+
state.gap1ndex -= 1
|
|
98
|
+
state.leafAbove[state.leaf1ndex] = state.gapsWhere[state.gap1ndex]
|
|
99
|
+
state.leafBelow[state.leaf1ndex] = state.leafBelow[state.leafAbove[state.leaf1ndex]]
|
|
100
|
+
state.leafBelow[state.leafAbove[state.leaf1ndex]] = state.leaf1ndex
|
|
101
|
+
state.leafAbove[state.leafBelow[state.leaf1ndex]] = state.leaf1ndex
|
|
102
|
+
state.gapRangeStart[state.leaf1ndex] = state.gap1ndex
|
|
103
|
+
state.leaf1ndex += 1
|
|
104
|
+
return state
|
|
105
|
+
|
|
103
106
|
def insertUnconstrainedLeaf(state: ComputationState) -> ComputationState:
|
|
104
107
|
state.indexLeaf = 0
|
|
105
108
|
while state.indexLeaf < state.leaf1ndex:
|
|
@@ -123,28 +126,24 @@ def loopUpToDimensionsTotal(state: ComputationState) -> bool:
|
|
|
123
126
|
def noGapsHere(state: ComputationState) -> bool:
|
|
124
127
|
return (state.leaf1ndex > 0) and (state.gap1ndex == state.gapRangeStart[state.leaf1ndex - 1])
|
|
125
128
|
|
|
126
|
-
def insertLeafAtGap(state: ComputationState) -> ComputationState:
|
|
127
|
-
state.gap1ndex -= 1
|
|
128
|
-
state.leafAbove[state.leaf1ndex] = state.gapsWhere[state.gap1ndex]
|
|
129
|
-
state.leafBelow[state.leaf1ndex] = state.leafBelow[state.leafAbove[state.leaf1ndex]]
|
|
130
|
-
state.leafBelow[state.leafAbove[state.leaf1ndex]] = state.leaf1ndex
|
|
131
|
-
state.leafAbove[state.leafBelow[state.leaf1ndex]] = state.leaf1ndex
|
|
132
|
-
state.gapRangeStart[state.leaf1ndex] = state.gap1ndex
|
|
133
|
-
state.leaf1ndex += 1
|
|
134
|
-
return state
|
|
135
|
-
|
|
136
129
|
def thereIsAnActiveLeaf(state: ComputationState) -> bool:
|
|
137
130
|
return state.leaf1ndex > 0
|
|
138
131
|
|
|
139
132
|
def thisIsMyTaskIndex(state: ComputationState) -> bool:
|
|
140
133
|
return (state.leaf1ndex != state.taskDivisions) or (state.leafConnectee % state.taskDivisions == state.taskIndex)
|
|
141
134
|
|
|
135
|
+
def undoLastLeafPlacement(state: ComputationState) -> ComputationState:
|
|
136
|
+
state.leaf1ndex -= 1
|
|
137
|
+
state.leafBelow[state.leafAbove[state.leaf1ndex]] = state.leafBelow[state.leaf1ndex]
|
|
138
|
+
state.leafAbove[state.leafBelow[state.leaf1ndex]] = state.leafAbove[state.leaf1ndex]
|
|
139
|
+
return state
|
|
140
|
+
|
|
142
141
|
def updateLeafConnectee(state: ComputationState) -> ComputationState:
|
|
143
142
|
state.leafConnectee = state.connectionGraph[state.indexDimension, state.leaf1ndex, state.leafBelow[state.leafConnectee]]
|
|
144
143
|
return state
|
|
145
144
|
|
|
146
145
|
def countInitialize(state: ComputationState) -> ComputationState:
|
|
147
|
-
while
|
|
146
|
+
while state.gap1ndex == 0:
|
|
148
147
|
if activeLeafIsTheFirstLeaf(state) or leafBelowSentinelIs1(state):
|
|
149
148
|
state = initializeVariablesToFindGaps(state)
|
|
150
149
|
while loopUpToDimensionsTotal(state):
|
|
@@ -164,8 +163,6 @@ def countInitialize(state: ComputationState) -> ComputationState:
|
|
|
164
163
|
state = incrementIndexMiniGap(state)
|
|
165
164
|
if thereIsAnActiveLeaf(state):
|
|
166
165
|
state = insertLeafAtGap(state)
|
|
167
|
-
if state.gap1ndex > 0:
|
|
168
|
-
break
|
|
169
166
|
return state
|
|
170
167
|
|
|
171
168
|
def countParallel(state: ComputationState) -> ComputationState:
|
|
@@ -218,6 +215,10 @@ def countSequential(state: ComputationState) -> ComputationState:
|
|
|
218
215
|
state = incrementIndexMiniGap(state)
|
|
219
216
|
while noGapsHere(state):
|
|
220
217
|
state = undoLastLeafPlacement(state)
|
|
218
|
+
if state.leaf1ndex == 3 and state.groupsOfFolds:
|
|
219
|
+
state.groupsOfFolds *= 2
|
|
220
|
+
# print('break')
|
|
221
|
+
break
|
|
221
222
|
if thereIsAnActiveLeaf(state):
|
|
222
223
|
state = insertLeafAtGap(state)
|
|
223
224
|
state.foldGroups[state.taskIndex] = state.groupsOfFolds
|
mapFolding/theSSOT.py
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Single Source of Truth module for configuration, types, and computational state management.
|
|
3
3
|
|
|
4
|
-
This module defines the core data structures, type definitions, and configuration settings
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
This module defines the core data structures, type definitions, and configuration settings used throughout the
|
|
5
|
+
mapFolding package. It implements the Single Source of Truth (SSOT) principle to ensure consistency across the package's
|
|
6
|
+
components.
|
|
7
7
|
|
|
8
8
|
Key features:
|
|
9
|
-
1. The ComputationState dataclass, which encapsulates the state of the folding computation
|
|
10
|
-
2. Unified type definitions for integers and arrays used in the computation
|
|
11
|
-
3. Configuration settings for synthetic module generation and dispatching
|
|
12
|
-
4. Path resolution and management for package resources and job output
|
|
13
|
-
5. Dynamic dispatch functionality for algorithm implementations
|
|
14
|
-
|
|
15
|
-
The module differentiates between "the" identifiers (package defaults) and other identifiers
|
|
16
|
-
|
|
9
|
+
1. The `ComputationState` dataclass, which encapsulates the state of the folding computation.
|
|
10
|
+
2. Unified type definitions for integers and arrays used in the computation.
|
|
11
|
+
3. Configuration settings for synthetic module generation and dispatching.
|
|
12
|
+
4. Path resolution and management for package resources and job output.
|
|
13
|
+
5. Dynamic dispatch functionality for algorithm implementations.
|
|
14
|
+
|
|
15
|
+
The module differentiates between "the" identifiers (package defaults) and other identifiers to avoid namespace
|
|
16
|
+
collisions when transforming algorithms.
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
19
|
from collections.abc import Callable
|
|
20
20
|
from importlib import import_module as importlib_import_module
|
|
21
21
|
from inspect import getfile as inspect_getfile
|
|
22
|
-
from numpy import dtype, int64 as numpy_int64,
|
|
22
|
+
from numpy import dtype, int64 as numpy_int64, integer, ndarray
|
|
23
23
|
from pathlib import Path
|
|
24
24
|
from tomli import load as tomli_load
|
|
25
25
|
from types import ModuleType
|
|
@@ -42,10 +42,10 @@ def getPathPackageINSTALLING() -> Path:
|
|
|
42
42
|
# I believe these values should be dynamically determined, so I have conspicuously marked them "HARDCODED"
|
|
43
43
|
# and created downstream logic that assumes the values were dynamically determined.
|
|
44
44
|
# Figure out dynamic flow control to synthesized modules https://github.com/hunterhogan/mapFolding/issues/4
|
|
45
|
-
logicalPathModuleDispatcherHARDCODED: str = 'mapFolding.syntheticModules.
|
|
45
|
+
logicalPathModuleDispatcherHARDCODED: str = 'mapFolding.syntheticModules.numbaCount'
|
|
46
46
|
callableDispatcherHARDCODED: str = 'doTheNeedful'
|
|
47
47
|
concurrencyPackageHARDCODED = 'multiprocessing'
|
|
48
|
-
# from mapFolding.someAssemblyRequired.
|
|
48
|
+
# from mapFolding.someAssemblyRequired.toolboxNumba.theNumbaFlow
|
|
49
49
|
|
|
50
50
|
# PackageSettings in theSSOT.py and immutability https://github.com/hunterhogan/mapFolding/issues/11
|
|
51
51
|
@dataclasses.dataclass
|
|
@@ -53,10 +53,9 @@ class PackageSettings:
|
|
|
53
53
|
"""
|
|
54
54
|
Centralized configuration settings for the mapFolding package.
|
|
55
55
|
|
|
56
|
-
This class implements the Single Source of Truth (SSOT) principle for package
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
is imported and used throughout the package to retrieve configuration values.
|
|
56
|
+
This class implements the Single Source of Truth (SSOT) principle for package configuration, providing a consistent
|
|
57
|
+
interface for accessing package settings, paths, and dispatch functions. The primary instance of this class, named
|
|
58
|
+
`The`, is imported and used throughout the package to retrieve configuration values.
|
|
60
59
|
"""
|
|
61
60
|
|
|
62
61
|
logicalPathModuleDispatcher: str | None = None
|
|
@@ -151,10 +150,10 @@ The = PackageSettings(logicalPathModuleDispatcher=logicalPathModuleDispatcherHAR
|
|
|
151
150
|
NumPyIntegerType = TypeVar('NumPyIntegerType', bound=integer[Any], covariant=True)
|
|
152
151
|
|
|
153
152
|
DatatypeLeavesTotal: TypeAlias = int
|
|
154
|
-
NumPyLeavesTotal: TypeAlias =
|
|
153
|
+
NumPyLeavesTotal: TypeAlias = numpy_int64
|
|
155
154
|
|
|
156
155
|
DatatypeElephino: TypeAlias = int
|
|
157
|
-
NumPyElephino: TypeAlias =
|
|
156
|
+
NumPyElephino: TypeAlias = numpy_int64
|
|
158
157
|
|
|
159
158
|
DatatypeFoldsTotal: TypeAlias = int
|
|
160
159
|
NumPyFoldsTotal: TypeAlias = numpy_int64
|
|
@@ -169,18 +168,15 @@ class ComputationState:
|
|
|
169
168
|
"""
|
|
170
169
|
Represents the complete state of a map folding computation.
|
|
171
170
|
|
|
172
|
-
This dataclass encapsulates all the information required to compute the number of
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
that flows through the entire computational algorithm.
|
|
171
|
+
This dataclass encapsulates all the information required to compute the number of possible ways to fold a map,
|
|
172
|
+
including the map dimensions, leaf connections, computation progress, and fold counting. It serves as the central
|
|
173
|
+
data structure that flows through the entire computational algorithm.
|
|
176
174
|
|
|
177
175
|
Fields are categorized into:
|
|
178
|
-
1. Input parameters (mapShape
|
|
179
|
-
2. Core computational structures (connectionGraph
|
|
180
|
-
3. Tracking variables for the folding algorithm state
|
|
181
|
-
4. Result accumulation fields (foldsTotal
|
|
182
|
-
|
|
183
|
-
The data structures and algorithms are based on Lunnon's 1971 paper on map folding.
|
|
176
|
+
1. Input parameters (`mapShape`, `leavesTotal`, etc.).
|
|
177
|
+
2. Core computational structures (`connectionGraph`, etc.).
|
|
178
|
+
3. Tracking variables for the folding algorithm state.
|
|
179
|
+
4. Result accumulation fields (`foldsTotal`, `groupsOfFolds`).
|
|
184
180
|
"""
|
|
185
181
|
# NOTE Python is anti-DRY, again, `DatatypeLeavesTotal` metadata needs to match the type
|
|
186
182
|
mapShape: tuple[DatatypeLeavesTotal, ...] = dataclasses.field(init=True, metadata={'elementConstructor': 'DatatypeLeavesTotal'})
|
|
@@ -226,7 +222,7 @@ class ComputationState:
|
|
|
226
222
|
foldsTotal: DatatypeFoldsTotal = DatatypeFoldsTotal(0)
|
|
227
223
|
"""The final computed total number of distinct folding patterns."""
|
|
228
224
|
|
|
229
|
-
gap1ndex:
|
|
225
|
+
gap1ndex: DatatypeElephino = DatatypeElephino(0)
|
|
230
226
|
"""Current index into gaps array during algorithm execution."""
|
|
231
227
|
|
|
232
228
|
gap1ndexCeiling: DatatypeElephino = DatatypeElephino(0)
|
|
@@ -244,10 +240,10 @@ class ComputationState:
|
|
|
244
240
|
indexMiniGap: DatatypeElephino = DatatypeElephino(0)
|
|
245
241
|
"""Index used when filtering common gaps."""
|
|
246
242
|
|
|
247
|
-
leaf1ndex:
|
|
243
|
+
leaf1ndex: DatatypeLeavesTotal = DatatypeLeavesTotal(1)
|
|
248
244
|
"""Active leaf being processed in the folding algorithm. Starts at 1, not 0."""
|
|
249
245
|
|
|
250
|
-
leafConnectee:
|
|
246
|
+
leafConnectee: DatatypeLeavesTotal = DatatypeLeavesTotal(0)
|
|
251
247
|
"""Leaf that is being connected to the active leaf."""
|
|
252
248
|
|
|
253
249
|
taskIndex: DatatypeLeavesTotal = DatatypeLeavesTotal(0)
|
mapFolding/toolboxFilesystem.py
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Filesystem utilities for managing map folding computation results.
|
|
3
3
|
|
|
4
|
-
This module provides functions for standardized handling of files related to the mapFolding
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
This module provides functions for standardized handling of files related to the mapFolding package, with a focus on
|
|
5
|
+
saving, retrieving, and naming computation results. It implements consistent naming conventions and path resolution
|
|
6
|
+
strategies to ensure that:
|
|
7
7
|
|
|
8
8
|
1. Computation results are stored in a predictable location.
|
|
9
9
|
2. Filenames follow a consistent pattern based on map dimensions.
|
|
10
10
|
3. Results can be reliably retrieved for future reference.
|
|
11
11
|
4. The system handles file operations safely with appropriate error handling.
|
|
12
12
|
|
|
13
|
-
The module serves as the standardized interface between the computational components
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
computations that may take days to complete.
|
|
13
|
+
The module serves as the standardized interface between the computational components of the package and the filesystem,
|
|
14
|
+
abstracting away the details of file operations and path management. It provides robust fallback mechanisms to preserve
|
|
15
|
+
computation results even in the face of filesystem errors, which is critical for long-running computations that may take
|
|
16
|
+
days to complete.
|
|
18
17
|
|
|
19
18
|
The functions here adhere to a consistent approach to path handling:
|
|
20
19
|
- Cross-platform compatibility through the use of `pathlib`.
|
|
@@ -33,9 +32,9 @@ def getFilenameFoldsTotal(mapShape: tuple[int, ...]) -> str:
|
|
|
33
32
|
"""
|
|
34
33
|
Create a standardized filename for a computed `foldsTotal` value.
|
|
35
34
|
|
|
36
|
-
This function generates a consistent, filesystem-safe filename based on map dimensions.
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
This function generates a consistent, filesystem-safe filename based on map dimensions. Standardizing filenames
|
|
36
|
+
ensures that results can be reliably stored and retrieved, avoiding potential filesystem incompatibilities or Python
|
|
37
|
+
naming restrictions.
|
|
39
38
|
|
|
40
39
|
Parameters:
|
|
41
40
|
mapShape: A sequence of integers representing the dimensions of the map.
|
|
@@ -49,7 +48,7 @@ def getFilenameFoldsTotal(mapShape: tuple[int, ...]) -> str:
|
|
|
49
48
|
- Safe filesystem characters
|
|
50
49
|
- Unique extension (.foldsTotal)
|
|
51
50
|
- Python-safe strings (no starting with numbers, no reserved words)
|
|
52
|
-
- The 'p' prefix comes from
|
|
51
|
+
- The 'p' prefix comes from Lunnon's original code.
|
|
53
52
|
"""
|
|
54
53
|
return 'p' + 'x'.join(str(dimension) for dimension in sorted(mapShape)) + '.foldsTotal'
|
|
55
54
|
|
|
@@ -57,14 +56,13 @@ def getPathFilenameFoldsTotal(mapShape: tuple[int, ...], pathLikeWriteFoldsTotal
|
|
|
57
56
|
"""
|
|
58
57
|
Get a standardized path and filename for the computed `foldsTotal` value.
|
|
59
58
|
|
|
60
|
-
This function resolves paths for storing computation results, handling different
|
|
61
|
-
|
|
62
|
-
that all parent directories exist in the resulting path.
|
|
59
|
+
This function resolves paths for storing computation results, handling different input types including directories,
|
|
60
|
+
absolute paths, or relative paths. It ensures that all parent directories exist in the resulting path.
|
|
63
61
|
|
|
64
62
|
Parameters:
|
|
65
63
|
mapShape: List of dimensions for the map folding problem.
|
|
66
|
-
pathLikeWriteFoldsTotal (getPathJobRootDEFAULT): Path, filename, or relative path and filename.
|
|
67
|
-
|
|
64
|
+
pathLikeWriteFoldsTotal (getPathJobRootDEFAULT): Path, filename, or relative path and filename. If None, uses
|
|
65
|
+
default path. If a directory, appends standardized filename.
|
|
68
66
|
|
|
69
67
|
Returns:
|
|
70
68
|
pathFilenameFoldsTotal: Absolute path and filename for storing the `foldsTotal` value.
|
|
@@ -91,10 +89,9 @@ def getPathRootJobDEFAULT() -> Path:
|
|
|
91
89
|
"""
|
|
92
90
|
Get the default root directory for map folding computation jobs.
|
|
93
91
|
|
|
94
|
-
This function determines the appropriate default directory for storing computation
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
Google Colab.
|
|
92
|
+
This function determines the appropriate default directory for storing computation results based on the current
|
|
93
|
+
runtime environment. It uses platform-specific directories for normal environments and adapts to special
|
|
94
|
+
environments like Google Colab.
|
|
98
95
|
|
|
99
96
|
Returns:
|
|
100
97
|
pathJobDEFAULT: Path to the default directory for storing computation results
|
|
@@ -112,10 +109,7 @@ def getPathRootJobDEFAULT() -> Path:
|
|
|
112
109
|
|
|
113
110
|
def _saveFoldsTotal(pathFilename: PathLike[str] | PurePath, foldsTotal: int) -> None:
|
|
114
111
|
"""
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
This is a low-level function used by the public `saveFoldsTotal` function.
|
|
118
|
-
It handles the basic file operation without extensive error handling.
|
|
112
|
+
Standardized function to save a `foldsTotal` value to a file.
|
|
119
113
|
|
|
120
114
|
Parameters:
|
|
121
115
|
pathFilename: Path where the `foldsTotal` value should be saved
|
|
@@ -129,9 +123,8 @@ def saveFoldsTotal(pathFilename: PathLike[str] | PurePath, foldsTotal: int) -> N
|
|
|
129
123
|
"""
|
|
130
124
|
Save `foldsTotal` value to disk with multiple fallback mechanisms.
|
|
131
125
|
|
|
132
|
-
This function attempts to save the computed `foldsTotal` value to the specified
|
|
133
|
-
|
|
134
|
-
The robustness is critical since these computations may take days to complete.
|
|
126
|
+
This function attempts to save the computed `foldsTotal` value to the specified location, with backup strategies in
|
|
127
|
+
case the primary save attempt fails. The robustness is critical since these computations may take days to complete.
|
|
135
128
|
|
|
136
129
|
Parameters:
|
|
137
130
|
pathFilename: Target save location for the `foldsTotal` value
|
|
@@ -165,9 +158,8 @@ def saveFoldsTotalFAILearly(pathFilename: PathLike[str] | PurePath) -> None:
|
|
|
165
158
|
"""
|
|
166
159
|
Preemptively test file write capabilities before beginning computation.
|
|
167
160
|
|
|
168
|
-
This function performs validation checks on the target file location before
|
|
169
|
-
|
|
170
|
-
aspects of filesystem functionality to ensure results can be saved:
|
|
161
|
+
This function performs validation checks on the target file location before a potentially long-running computation
|
|
162
|
+
begins. It tests several critical aspects of filesystem functionality to ensure results can be saved:
|
|
171
163
|
|
|
172
164
|
1. Checks if the file already exists to prevent accidental overwrites.
|
|
173
165
|
2. Verifies that parent directories exist.
|
|
@@ -182,8 +174,8 @@ def saveFoldsTotalFAILearly(pathFilename: PathLike[str] | PurePath) -> None:
|
|
|
182
174
|
FileNotFoundError: If parent directories don't exist or if write tests fail.
|
|
183
175
|
|
|
184
176
|
Notes:
|
|
185
|
-
This function helps prevent a situation where a computation runs for
|
|
186
|
-
|
|
177
|
+
This function helps prevent a situation where a computation runs for hours or days only to discover at the end
|
|
178
|
+
that results cannot be saved.
|
|
187
179
|
"""
|
|
188
180
|
if Path(pathFilename).exists():
|
|
189
181
|
raise FileExistsError(f"`{pathFilename = }` exists: a battle of overwriting might cause tears.")
|
|
@@ -201,17 +193,16 @@ def writeStringToHere(this: str, pathFilename: PathLike[str] | PurePath) -> None
|
|
|
201
193
|
"""
|
|
202
194
|
Write a string to a file, creating parent directories if needed.
|
|
203
195
|
|
|
204
|
-
This utility function provides a consistent interface for writing string content
|
|
205
|
-
|
|
206
|
-
string conversion.
|
|
196
|
+
This utility function provides a consistent interface for writing string content to files across the package. It
|
|
197
|
+
handles path creation and ensures proper string conversion.
|
|
207
198
|
|
|
208
199
|
Parameters:
|
|
209
200
|
this: The string content to write to the file.
|
|
210
201
|
pathFilename: The target file path where the string should be written.
|
|
211
202
|
|
|
212
203
|
Notes:
|
|
213
|
-
This function creates all parent directories in the path if they don't exist,
|
|
214
|
-
|
|
204
|
+
This function creates all parent directories in the path if they don't exist, making it safe to use with newly
|
|
205
|
+
created directory structures.
|
|
215
206
|
"""
|
|
216
207
|
pathFilename = Path(pathFilename)
|
|
217
208
|
pathFilename.parent.mkdir(parents=True, exist_ok=True)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mapFolding
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.2
|
|
4
4
|
Summary: Map folding algorithm with code transformation framework for optimizing numerical computations
|
|
5
5
|
Author-email: Hunter Hogan <HunterHogan@pm.me>
|
|
6
6
|
License: CC-BY-NC-4.0
|
|
@@ -38,6 +38,7 @@ Requires-Dist: numba
|
|
|
38
38
|
Requires-Dist: numpy
|
|
39
39
|
Requires-Dist: platformdirs
|
|
40
40
|
Requires-Dist: python_minifier
|
|
41
|
+
Requires-Dist: sympy
|
|
41
42
|
Requires-Dist: tomli
|
|
42
43
|
Requires-Dist: Z0Z_tools
|
|
43
44
|
Provides-Extra: testing
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
mapFolding/__init__.py,sha256=RwSpDoCykIukgnlZNf8HSmICtuk6xFuoovYvSuqzK_g,4253
|
|
2
|
+
mapFolding/basecamp.py,sha256=WQxSTucEuTA_ee7Wlfkd5RIClzEsal5OHaCwcT8g3rU,4747
|
|
3
|
+
mapFolding/beDRY.py,sha256=3GDFCzFHEL3uPAEGVxrUj8TX-MGHDObwn9KoMVEMKAc,16074
|
|
4
|
+
mapFolding/oeis.py,sha256=TYJKlCBrYSVhTCFret5QS5B_rs_MNEF8yFU0vLuu5OQ,17138
|
|
5
|
+
mapFolding/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
mapFolding/theDao.py,sha256=kc3rzTX3yts0PxgPCXFbgWvaqsBexsiU5ib2pzpvID0,10019
|
|
7
|
+
mapFolding/theSSOT.py,sha256=ozmfoUPVtbuB_i-m8On80nDGzqBSFHTvNrh6srHMrzY,16596
|
|
8
|
+
mapFolding/toolboxFilesystem.py,sha256=kVZoU-NBvfYSvI4R8mEpMXRUZee-1JV0fjtMFWPhk8Y,9818
|
|
9
|
+
mapFolding/reference/__init__.py,sha256=GKcSgYE49NcTISx-JZbELXyq-eRkMeTL5g4DXInWFw0,2206
|
|
10
|
+
mapFolding/reference/flattened.py,sha256=QK1xG9SllqCoi68e86Hyl9d9ATUAAFNpTQI-3zmcp5I,16072
|
|
11
|
+
mapFolding/reference/hunterNumba.py,sha256=iLfyqwGdAh6c5GbapnKsWhAsNsR3O-fyGGHAdohluLw,7258
|
|
12
|
+
mapFolding/reference/irvineJavaPort.py,sha256=UEfIX4QbPLl5jnyfYIyX5YRR3_rYvPUikK8jLehsFko,4076
|
|
13
|
+
mapFolding/reference/jaxCount.py,sha256=TuDNKOnyhQfuixKmIxO9Algv7dvy7KMGhgsV3h96FGE,14853
|
|
14
|
+
mapFolding/reference/lunnonNumpy.py,sha256=mMgrgbrBpe4nmo72ThEI-MGH0OwEHmfMPczSXHp2qKo,4357
|
|
15
|
+
mapFolding/reference/lunnonWhile.py,sha256=ZL8GAQtPs5nJZSgoDl5USrLSS_zs03y98y1Z9E4jOmQ,3799
|
|
16
|
+
mapFolding/reference/rotatedEntryPoint.py,sha256=5ughpKUT2JQhoAKgoDUdYNjgWQYPGV8v-7dWEAdDmfE,10274
|
|
17
|
+
mapFolding/reference/total_countPlus1vsPlusN.py,sha256=yJZAVLVdoXqHag2_N6_6CT-Q6HXBgRro-eny93-Rlpw,9307
|
|
18
|
+
mapFolding/reference/jobsCompleted/__init__.py,sha256=TU93ZGUW1xEkT6d9mQFn_rp5DvRy0ZslEB2Q6MF5ZDc,2596
|
|
19
|
+
mapFolding/reference/jobsCompleted/[2x19]/p2x19.py,sha256=_tvYtfzMWVo2VtUbIAieoscb4N8FFflgTdW4-ljBUuA,19626
|
|
20
|
+
mapFolding/reference/jobsCompleted/p2x19/p2x19.py,sha256=eZEw4Me4ocTt6VXoK2-Sbd5SowZtxRIbN9dZmc7OCVg,6395
|
|
21
|
+
mapFolding/someAssemblyRequired/RecipeJob.py,sha256=JL5Xkmp8ritVMhL1pGhX7eEw5fde3FVD8-9-vZOZwWI,5399
|
|
22
|
+
mapFolding/someAssemblyRequired/__init__.py,sha256=kMoIH57T68hHArRiW6EBuuC-JNpxTXgmjH2aqN-NjWE,4106
|
|
23
|
+
mapFolding/someAssemblyRequired/_theTypes.py,sha256=pkMnYGtIAvIgudcvmbhZwmNnczY3Gk_ZmcS_7vfSZsU,4342
|
|
24
|
+
mapFolding/someAssemblyRequired/_tool_Make.py,sha256=0TGZtCUt6uu8h47N833qZ9IIjbn_yhoPFsBDEotQp9A,7222
|
|
25
|
+
mapFolding/someAssemblyRequired/_tool_Then.py,sha256=0Xb-MfKJhXjoVBTC7CSjpgCxxilL_WquL4WzKQWMR5A,4464
|
|
26
|
+
mapFolding/someAssemblyRequired/_toolboxAntecedents.py,sha256=6m80_ThGF47WWIkYweEdc3LRq96fHklys7IpoFSqN7A,13288
|
|
27
|
+
mapFolding/someAssemblyRequired/_toolboxContainers.py,sha256=zXjE70W1XodEGo2H1PofLoDbjtTKaJVlfv5I49jMz3o,23609
|
|
28
|
+
mapFolding/someAssemblyRequired/_toolboxPython.py,sha256=TuRC5CD_6tTjjLuvGgPbnqCSvIP3Vp2k2r592Dcpff4,7642
|
|
29
|
+
mapFolding/someAssemblyRequired/getLLVMforNoReason.py,sha256=9RPU6vK_eUg64GtVFI_nZnvUryXw8gfHJs9NyDYHIvg,2745
|
|
30
|
+
mapFolding/someAssemblyRequired/synthesizeNumbaJob.py,sha256=0i4iBBzHY9Io0XrsmXD814P52C_igvv_Aeur4udR8jI,15571
|
|
31
|
+
mapFolding/someAssemblyRequired/toolboxNumba.py,sha256=cHpX8dn1Fr_TWpDgVhYx6ObmEeD6slYeMWeE9laJadI,10754
|
|
32
|
+
mapFolding/someAssemblyRequired/transformationTools.py,sha256=goxIq-LGu-lRkdzvCrKYDp9hJyKzL_TtNZnSP6zLbY8,35833
|
|
33
|
+
mapFolding/syntheticModules/__init__.py,sha256=evVFqhCGa-WZKDiLcnQWjs-Bj34eRnfSLqz_d7dFYZY,83
|
|
34
|
+
mapFolding/syntheticModules/numbaCount.py,sha256=zM-bp07c9tEDdvidwzZ_bJTd0JC0VUkYEEiHG--P1tQ,15525
|
|
35
|
+
mapfolding-0.9.2.dist-info/licenses/LICENSE,sha256=NxH5Y8BdC-gNU-WSMwim3uMbID2iNDXJz7fHtuTdXhk,19346
|
|
36
|
+
tests/__init__.py,sha256=UIvSWWz_anRXBELKPOdhfRoZ4hArHQTvghHrRquDHHw,1940
|
|
37
|
+
tests/conftest.py,sha256=G8vhDSTdTbYZUFBUKLFOUOzDL1Ja6NVZmICCh4biZas,14298
|
|
38
|
+
tests/test_computations.py,sha256=MbnK9kRRwH3UI7aVMreNuEbzNVC2hP0Gq2mR-xjuxrI,6205
|
|
39
|
+
tests/test_filesystem.py,sha256=T2DkjBoI3lW6tCxd5BilPmUFrVukNKLjOOZVZxLM560,3004
|
|
40
|
+
tests/test_oeis.py,sha256=uxvwmgbnylSDdsVJfuAT0LuYLbIVFwSgdLxHm-xUGBM,5043
|
|
41
|
+
tests/test_other.py,sha256=UMlK4JPInalpOZuPvTnUrgXWCJOxAw-OsPs6CxMR254,3753
|
|
42
|
+
tests/test_tasks.py,sha256=yrExYvFP23TEA3ta0IotMNmi59rwQ3Y9hA3fwvIhxTE,2851
|
|
43
|
+
mapfolding-0.9.2.dist-info/METADATA,sha256=Ec4d3Oalth5tiJ-9Cnxap4kp6ehPFVxij_YtkaunuyQ,7466
|
|
44
|
+
mapfolding-0.9.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
45
|
+
mapfolding-0.9.2.dist-info/entry_points.txt,sha256=F3OUeZR1XDTpoH7k3wXuRb3KF_kXTTeYhu5AGK1SiOQ,146
|
|
46
|
+
mapfolding-0.9.2.dist-info/top_level.txt,sha256=1gP2vFaqPwHujGwb3UjtMlLEGN-943VSYFR7V4gDqW8,17
|
|
47
|
+
mapfolding-0.9.2.dist-info/RECORD,,
|
tests/test_computations.py
CHANGED
|
@@ -87,6 +87,7 @@ that provide consistent, informative error messages and simplify test validation
|
|
|
87
87
|
|
|
88
88
|
from mapFolding import countFolds, getFoldsTotalKnown, oeisIDfor_n, validateListDimensions
|
|
89
89
|
from mapFolding.oeis import settingsOEIS
|
|
90
|
+
from mapFolding.someAssemblyRequired.RecipeJob import RecipeJob
|
|
90
91
|
from mapFolding.someAssemblyRequired.transformationTools import makeInitializedComputationState
|
|
91
92
|
from pathlib import Path, PurePosixPath
|
|
92
93
|
from tests.conftest import standardizedEqualToCallableReturn, registrarRecordsTmpObject
|
|
@@ -115,7 +116,7 @@ def test_syntheticSequential(syntheticDispatcherFixture: None, listDimensionsTes
|
|
|
115
116
|
|
|
116
117
|
@pytest.mark.parametrize('pathFilenameTmpTesting', ['.py'], indirect=True)
|
|
117
118
|
def test_writeJobNumba(oneTestCuzTestsOverwritingTests: list[int], pathFilenameTmpTesting: Path) -> None:
|
|
118
|
-
from mapFolding.someAssemblyRequired.toolboxNumba import
|
|
119
|
+
from mapFolding.someAssemblyRequired.toolboxNumba import SpicesJobNumba
|
|
119
120
|
from mapFolding.someAssemblyRequired.synthesizeNumbaJob import makeJobNumba
|
|
120
121
|
mapShape = validateListDimensions(oneTestCuzTestsOverwritingTests)
|
|
121
122
|
state = makeInitializedComputationState(mapShape)
|
tests/test_other.py
CHANGED
|
@@ -14,20 +14,15 @@ import sys
|
|
|
14
14
|
(['a'], ValueError, ValueError), # string
|
|
15
15
|
([-4, 2], [-4, 2], ValueError), # negative
|
|
16
16
|
([-3], [-3], ValueError), # negative
|
|
17
|
-
([0, 0], [0, 0], NotImplementedError), # no positive dimensions
|
|
18
|
-
([0, 5, 6], [0, 5, 6], (5, 6)), # zeros ignored
|
|
19
|
-
([0], [0], NotImplementedError), # edge case
|
|
20
17
|
([1, 2, 3, 4, 5], [1, 2, 3, 4, 5], (1, 2, 3, 4, 5)), # sequential
|
|
21
18
|
([1, sys.maxsize], [1, sys.maxsize], (1, sys.maxsize)), # maxint
|
|
22
19
|
([7.5], ValueError, ValueError), # float
|
|
23
20
|
([1] * 1000, [1] * 1000, (1,) * 1000), # long list
|
|
24
21
|
([11], [11], NotImplementedError), # single dimension
|
|
25
|
-
([13, 0, 17], [13, 0, 17], (13, 17)), # zeros handled
|
|
26
22
|
([2, 2, 2, 2], [2, 2, 2, 2], (2, 2, 2, 2)), # repeated dimensions
|
|
27
23
|
([2, 3, 4], [2, 3, 4], (2, 3, 4)),
|
|
28
24
|
([2, 3], [2, 3], (2, 3)),
|
|
29
25
|
([2] * 11, [2] * 11, (2,) * 11), # power of 2
|
|
30
|
-
([3, 2], [3, 2], (2, 3)), # return value is sorted
|
|
31
26
|
([3] * 5, [3] * 5, (3,) * 5), # power of 3
|
|
32
27
|
([None], TypeError, TypeError), # None
|
|
33
28
|
([True], TypeError, TypeError), # bool
|
|
@@ -36,8 +31,6 @@ import sys
|
|
|
36
31
|
([complex(1,1)], ValueError, ValueError), # complex number
|
|
37
32
|
([float('inf')], ValueError, ValueError), # infinity
|
|
38
33
|
([float('nan')], ValueError, ValueError), # NaN
|
|
39
|
-
([sys.maxsize - 1, 1], [sys.maxsize - 1, 1], (1, sys.maxsize - 1)), # near maxint
|
|
40
|
-
([sys.maxsize // 2, sys.maxsize // 2, 2], [sys.maxsize // 2, sys.maxsize // 2, 2], (2, sys.maxsize // 2, sys.maxsize // 2)), # overflow protection
|
|
41
34
|
([sys.maxsize, sys.maxsize], [sys.maxsize, sys.maxsize], (sys.maxsize, sys.maxsize)), # overflow protection
|
|
42
35
|
(range(3, 7), [3, 4, 5, 6], (3, 4, 5, 6)), # range sequence type
|
|
43
36
|
(tuple([3, 5, 7]), [3, 5, 7], (3, 5, 7)), # tuple sequence type
|