mapFolding 0.6.0__py3-none-any.whl → 0.7.1__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 +6 -104
- mapFolding/basecamp.py +12 -8
- mapFolding/beDRY.py +103 -286
- mapFolding/filesystem.py +95 -0
- mapFolding/noHomeYet.py +20 -0
- mapFolding/oeis.py +46 -39
- mapFolding/reference/flattened.py +377 -0
- mapFolding/reference/hunterNumba.py +132 -0
- mapFolding/reference/irvineJavaPort.py +120 -0
- mapFolding/reference/jax.py +208 -0
- mapFolding/reference/lunnan.py +153 -0
- mapFolding/reference/lunnanNumpy.py +123 -0
- mapFolding/reference/lunnanWhile.py +121 -0
- mapFolding/reference/rotatedEntryPoint.py +240 -0
- mapFolding/reference/total_countPlus1vsPlusN.py +211 -0
- mapFolding/someAssemblyRequired/Z0Z_workbench.py +33 -0
- mapFolding/someAssemblyRequired/__init__.py +16 -0
- mapFolding/someAssemblyRequired/getLLVMforNoReason.py +21 -0
- mapFolding/someAssemblyRequired/ingredientsNumba.py +100 -0
- mapFolding/someAssemblyRequired/synthesizeCountingFunctions.py +7 -0
- mapFolding/someAssemblyRequired/synthesizeDataConverters.py +135 -0
- mapFolding/someAssemblyRequired/synthesizeNumba.py +91 -0
- mapFolding/someAssemblyRequired/synthesizeNumbaJob.py +417 -0
- mapFolding/someAssemblyRequired/synthesizeNumbaModules.py +91 -0
- mapFolding/someAssemblyRequired/transformationTools.py +425 -0
- mapFolding/someAssemblyRequired/whatWillBe.py +357 -0
- mapFolding/syntheticModules/__init__.py +0 -0
- mapFolding/syntheticModules/dataNamespaceFlattened.py +30 -0
- mapFolding/syntheticModules/multiprocessingCount_doTheNeedful.py +216 -0
- mapFolding/syntheticModules/numbaCount.py +90 -0
- mapFolding/syntheticModules/numbaCountExample.py +158 -0
- mapFolding/syntheticModules/numbaCountSequential.py +111 -0
- mapFolding/syntheticModules/numbaCount_doTheNeedful.py +13 -0
- mapFolding/syntheticModules/numba_doTheNeedful.py +12 -0
- mapFolding/syntheticModules/numba_doTheNeedfulExample.py +13 -0
- mapFolding/theDao.py +216 -229
- mapFolding/theSSOT.py +269 -101
- {mapfolding-0.6.0.dist-info → mapfolding-0.7.1.dist-info}/METADATA +7 -6
- mapfolding-0.7.1.dist-info/RECORD +51 -0
- {mapfolding-0.6.0.dist-info → mapfolding-0.7.1.dist-info}/WHEEL +1 -1
- {mapfolding-0.6.0.dist-info → mapfolding-0.7.1.dist-info}/top_level.txt +1 -0
- tests/__init__.py +0 -0
- tests/conftest.py +278 -0
- tests/test_computations.py +53 -0
- tests/test_filesystem.py +52 -0
- tests/test_oeis.py +128 -0
- tests/test_other.py +84 -0
- tests/test_tasks.py +56 -0
- mapFolding/theConfiguration.py +0 -58
- mapFolding/theSSOTdatatypes.py +0 -155
- mapFolding/theWrongWay.py +0 -7
- mapfolding-0.6.0.dist-info/RECORD +0 -16
- {mapfolding-0.6.0.dist-info → mapfolding-0.7.1.dist-info}/LICENSE +0 -0
- {mapfolding-0.6.0.dist-info → mapfolding-0.7.1.dist-info}/entry_points.txt +0 -0
mapFolding/theSSOT.py
CHANGED
|
@@ -1,20 +1,279 @@
|
|
|
1
1
|
from collections.abc import Callable
|
|
2
|
-
from
|
|
3
|
-
from
|
|
4
|
-
from numpy import dtype,
|
|
2
|
+
from importlib import import_module as importlib_import_module
|
|
3
|
+
from inspect import getfile as inspect_getfile
|
|
4
|
+
from numpy import dtype, int64 as numpy_int64, int16 as numpy_int16, ndarray, signedinteger
|
|
5
5
|
from pathlib import Path
|
|
6
|
+
from sys import modules as sysModules
|
|
7
|
+
from tomli import load as tomli_load
|
|
6
8
|
from types import ModuleType
|
|
7
|
-
from typing import Any, Final,
|
|
9
|
+
from typing import Any, Final, TypeAlias
|
|
10
|
+
import dataclasses
|
|
11
|
+
|
|
12
|
+
"""
|
|
13
|
+
2025 March 11
|
|
14
|
+
Note to self: fundamental concept in Python:
|
|
15
|
+
Identifiers: scope and resolution, LEGB (Local, Enclosing, Global, Builtin)
|
|
16
|
+
- Local: Inside the function
|
|
17
|
+
- Enclosing: Inside enclosing functions
|
|
18
|
+
- Global: At the uppermost level
|
|
19
|
+
- Builtin: Python's built-in names
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
# I _think_, in theSSOT, I have abstracted the flow settings to only these couple of lines:
|
|
23
|
+
packageFlowSynthetic = 'numba'
|
|
24
|
+
# packageFlowSynthetic = 'multiprocessing'
|
|
25
|
+
Z0Z_packageFlow = 'algorithm'
|
|
26
|
+
# https://github.com/hunterhogan/mapFolding/issues/4
|
|
27
|
+
# Z0Z_packageFlow = packageFlowSynthetic
|
|
28
|
+
|
|
29
|
+
# =============================================================================
|
|
30
|
+
# The Wrong Way The Wrong Way The Wrong Way The Wrong Way The Wrong Way
|
|
31
|
+
# Evaluate When Packaging Evaluate When Packaging Evaluate When Packaging
|
|
32
|
+
|
|
33
|
+
sourceAlgorithmPACKAGING: str = 'theDao'
|
|
34
|
+
datatypePackagePACKAGING: Final[str] = 'numpy'
|
|
35
|
+
dispatcherCallablePACKAGING: str = 'doTheNeedful'
|
|
36
|
+
moduleOfSyntheticModulesPACKAGING: Final[str] = 'syntheticModules'
|
|
37
|
+
|
|
38
|
+
dataclassModulePACKAGING: str = 'theSSOT'
|
|
39
|
+
dataclassIdentifierPACKAGING: str = 'ComputationState'
|
|
40
|
+
dataclassInstancePACKAGING: str = 'state'
|
|
41
|
+
dataclassInstance_Pre_ParallelPACKAGING = dataclassInstancePACKAGING + 'PARALLEL'
|
|
42
|
+
dataclassInstance_Post_ParallelPACKAGING = dataclassInstancePACKAGING + 'COMPLETE'
|
|
43
|
+
|
|
44
|
+
sourceInitializeCallablePACKAGING = 'countInitialize'
|
|
45
|
+
sourceSequentialCallablePACKAGING = 'countSequential'
|
|
46
|
+
sourceParallelCallablePACKAGING = 'countParallel'
|
|
8
47
|
|
|
9
48
|
try:
|
|
10
|
-
|
|
49
|
+
thePackageNamePACKAGING: str = tomli_load(Path("../pyproject.toml").open('rb'))["project"]["name"]
|
|
11
50
|
except Exception:
|
|
12
|
-
|
|
51
|
+
thePackageNamePACKAGING: str = "mapFolding"
|
|
52
|
+
|
|
53
|
+
# =============================================================================
|
|
54
|
+
# The Wrong Way The Wrong Way The Wrong Way The Wrong Way The Wrong Way
|
|
55
|
+
# Evaluate When Installing Evaluate When Installing Evaluate When Installing
|
|
56
|
+
|
|
57
|
+
fileExtensionINSTALLING: str = '.py'
|
|
58
|
+
|
|
59
|
+
def getPathPackageINSTALLING() -> Path:
|
|
60
|
+
pathPackage: Path = Path(inspect_getfile(importlib_import_module(thePackageNamePACKAGING)))
|
|
61
|
+
if pathPackage.is_file():
|
|
62
|
+
pathPackage = pathPackage.parent
|
|
63
|
+
return pathPackage
|
|
64
|
+
|
|
65
|
+
# =============================================================================
|
|
66
|
+
# The Wrong Way The Wrong Way The Wrong Way The Wrong Way The Wrong Way
|
|
67
|
+
# Hardcoding Hardcoding Hardcoding Hardcoding Hardcoding Hardcoding Hardcoding
|
|
68
|
+
|
|
69
|
+
# =============================================================================
|
|
70
|
+
# The right way, perhaps.
|
|
71
|
+
|
|
72
|
+
# =====================
|
|
73
|
+
# Create enduring identifiers from the hopefully transient identifiers above.
|
|
74
|
+
thePackageName: Final[str] = thePackageNamePACKAGING
|
|
75
|
+
thePathPackage: Path = getPathPackageINSTALLING()
|
|
76
|
+
|
|
77
|
+
"""
|
|
78
|
+
NOTE on semiotics: `theIdentifier` vs `identifier`
|
|
79
|
+
|
|
80
|
+
- This package has a typical, "hardcoded" algorithm for counting map folds.
|
|
81
|
+
- This package has logic for transforming that algorithm into other forms.
|
|
82
|
+
- The transformation logic can transform other algorithms if 1) they are similar enough to the "hardcoded" algorithm and 2) I have written the transformation logic well enough to handle the differences.
|
|
83
|
+
- To avoid confusion and namespace collisions, I differentiate between, for example, `theSourceAlgorithm` of the package and any other `sourceAlgorithm` being transformed by the package.
|
|
84
|
+
"""
|
|
85
|
+
|
|
86
|
+
theSourceAlgorithm: str = sourceAlgorithmPACKAGING
|
|
87
|
+
theSourceInitializeCallable = sourceInitializeCallablePACKAGING
|
|
88
|
+
theSourceSequentialCallable = sourceSequentialCallablePACKAGING
|
|
89
|
+
theSourceParallelCallable = sourceParallelCallablePACKAGING
|
|
90
|
+
theDatatypePackage: Final[str] = datatypePackagePACKAGING
|
|
91
|
+
|
|
92
|
+
theDispatcherCallable: str = dispatcherCallablePACKAGING
|
|
93
|
+
|
|
94
|
+
theDataclassModule: str = dataclassModulePACKAGING
|
|
95
|
+
theDataclassIdentifier: str = dataclassIdentifierPACKAGING
|
|
96
|
+
theDataclassInstance: str = dataclassInstancePACKAGING
|
|
97
|
+
theDataclassInstance_Pre_Parallel: str = dataclassInstance_Pre_ParallelPACKAGING
|
|
98
|
+
theDataclassInstance_Post_Parallel: str = dataclassInstance_Post_ParallelPACKAGING
|
|
99
|
+
|
|
100
|
+
theFileExtension: str = fileExtensionINSTALLING
|
|
101
|
+
|
|
102
|
+
theModuleOfSyntheticModules: Final[str] = moduleOfSyntheticModulesPACKAGING
|
|
103
|
+
|
|
104
|
+
# =============================================================================
|
|
105
|
+
# The right way.
|
|
106
|
+
concurrencyPackage: str = Z0Z_packageFlow
|
|
107
|
+
|
|
108
|
+
# =============================================================================
|
|
109
|
+
# The relatively flexible type system needs a different paradigm, but I don't
|
|
110
|
+
# know what it should be. The system needs to 1) help optimize computation, 2)
|
|
111
|
+
# make it possible to change the basic type of the package (e.g., from numpy
|
|
112
|
+
# to superTypePy), 3) make it possible to synthesize the optimized flow of used
|
|
113
|
+
# by the package, and 4) make it possible to synthesize arbitrary modules with
|
|
114
|
+
# different type systems.
|
|
115
|
+
|
|
116
|
+
DatatypeLeavesTotal: TypeAlias = int
|
|
117
|
+
# this would be uint8, but mapShape (2,2,2,2, 2,2,2,2) has 256 leaves, so generic containers accommodate
|
|
118
|
+
numpyLeavesTotal: TypeAlias = numpy_int16
|
|
119
|
+
|
|
120
|
+
DatatypeElephino: TypeAlias = int
|
|
121
|
+
numpyElephino: TypeAlias = numpy_int16
|
|
122
|
+
|
|
123
|
+
DatatypeFoldsTotal: TypeAlias = int
|
|
124
|
+
numpyFoldsTotal: TypeAlias = numpy_int64
|
|
125
|
+
numpyDtypeDefault = numpyFoldsTotal
|
|
126
|
+
|
|
127
|
+
Array3D: TypeAlias = ndarray[tuple[int, int, int], dtype[numpyLeavesTotal]]
|
|
128
|
+
Array1DLeavesTotal: TypeAlias = ndarray[tuple[int], dtype[numpyLeavesTotal]]
|
|
129
|
+
Array1DElephino: TypeAlias = ndarray[tuple[int], dtype[numpyElephino]]
|
|
130
|
+
Array1DFoldsTotal: TypeAlias = ndarray[tuple[int], dtype[numpyFoldsTotal]]
|
|
131
|
+
|
|
132
|
+
# =============================================================================
|
|
133
|
+
# The right way.
|
|
134
|
+
# (The dataclass, not the typing of the dataclass.)
|
|
135
|
+
# (Also, my noobplementation of the dataclass certainly needs improvement.)
|
|
136
|
+
|
|
137
|
+
@dataclasses.dataclass
|
|
138
|
+
class ComputationState:
|
|
139
|
+
mapShape: tuple[DatatypeLeavesTotal, ...]
|
|
140
|
+
leavesTotal: DatatypeLeavesTotal
|
|
141
|
+
taskDivisions: DatatypeLeavesTotal
|
|
142
|
+
concurrencyLimit: DatatypeElephino
|
|
143
|
+
|
|
144
|
+
connectionGraph: Array3D = dataclasses.field(init=False, metadata={'description': 'A 3D array representing the connection graph of the map.'})
|
|
145
|
+
dimensionsTotal: DatatypeLeavesTotal = dataclasses.field(init=False)
|
|
13
146
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
147
|
+
countDimensionsGapped: Array1DLeavesTotal = dataclasses.field(default=None) # pyright: ignore[reportAssignmentType]
|
|
148
|
+
dimensionsUnconstrained: DatatypeLeavesTotal = dataclasses.field(default=None) # pyright: ignore[reportAssignmentType]
|
|
149
|
+
gapRangeStart: Array1DElephino = dataclasses.field(default=None) # pyright: ignore[reportAssignmentType]
|
|
150
|
+
gapsWhere: Array1DLeavesTotal = dataclasses.field(default=None) # pyright: ignore[reportAssignmentType]
|
|
151
|
+
leafAbove: Array1DLeavesTotal = dataclasses.field(default=None) # pyright: ignore[reportAssignmentType]
|
|
152
|
+
leafBelow: Array1DLeavesTotal = dataclasses.field(default=None) # pyright: ignore[reportAssignmentType]
|
|
153
|
+
foldGroups: Array1DFoldsTotal = dataclasses.field(default=None) # pyright: ignore[reportAssignmentType]
|
|
154
|
+
|
|
155
|
+
foldsTotal: DatatypeFoldsTotal = DatatypeFoldsTotal(0)
|
|
156
|
+
gap1ndex: DatatypeLeavesTotal = DatatypeLeavesTotal(0)
|
|
157
|
+
gap1ndexCeiling: DatatypeElephino = DatatypeElephino(0)
|
|
158
|
+
groupsOfFolds: DatatypeFoldsTotal = DatatypeFoldsTotal(0)
|
|
159
|
+
indexDimension: DatatypeLeavesTotal = DatatypeLeavesTotal(0)
|
|
160
|
+
indexLeaf: DatatypeLeavesTotal = DatatypeLeavesTotal(0)
|
|
161
|
+
indexMiniGap: DatatypeElephino = DatatypeElephino(0)
|
|
162
|
+
leaf1ndex: DatatypeElephino = DatatypeElephino(1)
|
|
163
|
+
leafConnectee: DatatypeElephino = DatatypeElephino(0)
|
|
164
|
+
taskIndex: DatatypeLeavesTotal = dataclasses.field(default=DatatypeLeavesTotal(0), metadata={'myType': DatatypeLeavesTotal})
|
|
165
|
+
# taskIndex: DatatypeLeavesTotal = DatatypeLeavesTotal(0)
|
|
166
|
+
|
|
167
|
+
def __post_init__(self):
|
|
168
|
+
from mapFolding.beDRY import makeConnectionGraph, makeDataContainer
|
|
169
|
+
self.dimensionsTotal = DatatypeLeavesTotal(len(self.mapShape))
|
|
170
|
+
self.connectionGraph = makeConnectionGraph(self.mapShape, self.leavesTotal, numpyLeavesTotal)
|
|
171
|
+
|
|
172
|
+
if self.dimensionsUnconstrained is None: # pyright: ignore[reportUnnecessaryComparison]
|
|
173
|
+
self.dimensionsUnconstrained = DatatypeLeavesTotal(int(self.dimensionsTotal))
|
|
174
|
+
|
|
175
|
+
if self.foldGroups is None:
|
|
176
|
+
self.foldGroups = makeDataContainer(max(2, int(self.taskDivisions) + 1), numpyFoldsTotal)
|
|
177
|
+
self.foldGroups[-1] = self.leavesTotal
|
|
178
|
+
|
|
179
|
+
leavesTotalAsInt = int(self.leavesTotal)
|
|
180
|
+
|
|
181
|
+
if self.countDimensionsGapped is None:
|
|
182
|
+
self.countDimensionsGapped = makeDataContainer(leavesTotalAsInt + 1, numpyElephino)
|
|
183
|
+
if self.gapRangeStart is None:
|
|
184
|
+
self.gapRangeStart = makeDataContainer(leavesTotalAsInt + 1, numpyLeavesTotal)
|
|
185
|
+
if self.gapsWhere is None:
|
|
186
|
+
self.gapsWhere = makeDataContainer(leavesTotalAsInt * leavesTotalAsInt + 1, numpyLeavesTotal)
|
|
187
|
+
if self.leafAbove is None:
|
|
188
|
+
self.leafAbove = makeDataContainer(leavesTotalAsInt + 1, numpyLeavesTotal)
|
|
189
|
+
if self.leafBelow is None:
|
|
190
|
+
self.leafBelow = makeDataContainer(leavesTotalAsInt + 1, numpyLeavesTotal)
|
|
191
|
+
|
|
192
|
+
def getFoldsTotal(self):
|
|
193
|
+
self.foldsTotal = DatatypeFoldsTotal(self.foldGroups[0:-1].sum() * self.leavesTotal)
|
|
194
|
+
|
|
195
|
+
# factory? constructor?
|
|
196
|
+
# state.taskIndex = state.taskIndex.type(indexSherpa)
|
|
197
|
+
# self.fieldName = self.fieldName.fieldType(indexSherpa)
|
|
198
|
+
# state.taskIndex.toMyType(indexSherpa)
|
|
199
|
+
|
|
200
|
+
# =============================================================================
|
|
201
|
+
# The most right way I know how to implement.
|
|
202
|
+
|
|
203
|
+
theLogicalPathModuleSourceAlgorithm: str = '.'.join([thePackageName, theSourceAlgorithm])
|
|
204
|
+
theLogicalPathModuleDispatcher: str = theLogicalPathModuleSourceAlgorithm
|
|
205
|
+
theLogicalPathModuleDataclass: str = '.'.join([thePackageName, theDataclassModule])
|
|
206
|
+
|
|
207
|
+
def getSourceAlgorithm() -> ModuleType:
|
|
208
|
+
moduleImported: ModuleType = importlib_import_module(theLogicalPathModuleSourceAlgorithm)
|
|
209
|
+
return moduleImported
|
|
210
|
+
|
|
211
|
+
# dynamically set the return type https://github.com/hunterhogan/mapFolding/issues/5
|
|
212
|
+
def getAlgorithmDispatcher():
|
|
213
|
+
moduleImported: ModuleType = getSourceAlgorithm()
|
|
214
|
+
dispatcherCallable = getattr(moduleImported, theDispatcherCallable)
|
|
215
|
+
return dispatcherCallable
|
|
216
|
+
|
|
217
|
+
def getPathSyntheticModules() -> Path:
|
|
218
|
+
return thePathPackage / theModuleOfSyntheticModules
|
|
219
|
+
|
|
220
|
+
# TODO learn how to see this from the user's perspective
|
|
221
|
+
def getPathJobRootDEFAULT() -> Path:
|
|
222
|
+
if 'google.colab' in sysModules:
|
|
223
|
+
pathJobDEFAULT: Path = Path("/content/drive/MyDrive") / "jobs"
|
|
224
|
+
else:
|
|
225
|
+
pathJobDEFAULT = thePathPackage / "jobs"
|
|
226
|
+
return pathJobDEFAULT
|
|
227
|
+
|
|
228
|
+
_datatypePackage: str = ''
|
|
229
|
+
def getDatatypePackage() -> str:
|
|
230
|
+
global _datatypePackage
|
|
231
|
+
if not _datatypePackage:
|
|
232
|
+
_datatypePackage = theDatatypePackage
|
|
233
|
+
return _datatypePackage
|
|
234
|
+
|
|
235
|
+
def getNumpyDtypeDefault() -> type[signedinteger[Any]]:
|
|
236
|
+
return numpyDtypeDefault
|
|
237
|
+
|
|
238
|
+
# =============================================================================
|
|
239
|
+
# The coping way.
|
|
240
|
+
|
|
241
|
+
class FREAKOUT(Exception): pass
|
|
242
|
+
|
|
243
|
+
# =============================================================================
|
|
244
|
+
# Temporary or transient or something; probably still the wrong way
|
|
245
|
+
|
|
246
|
+
# THIS IS A STUPID SYSTEM BUT I CAN'T FIGURE OUT AN IMPROVEMENT
|
|
247
|
+
# NOTE This section for _default_ values probably has value
|
|
248
|
+
# https://github.com/hunterhogan/mapFolding/issues/4
|
|
249
|
+
theFormatStrModuleSynthetic = "{packageFlow}Count"
|
|
250
|
+
theFormatStrModuleForCallableSynthetic = theFormatStrModuleSynthetic + "_{callableTarget}"
|
|
251
|
+
|
|
252
|
+
theModuleDispatcherSynthetic: str = theFormatStrModuleForCallableSynthetic.format(packageFlow=packageFlowSynthetic, callableTarget=theDispatcherCallable)
|
|
253
|
+
theLogicalPathModuleDispatcherSynthetic: str = '.'.join([thePackageName, theModuleOfSyntheticModules, theModuleDispatcherSynthetic])
|
|
254
|
+
|
|
255
|
+
# =============================================================================
|
|
256
|
+
# The most right way I know how to implement.
|
|
257
|
+
|
|
258
|
+
# https://github.com/hunterhogan/mapFolding/issues/4
|
|
259
|
+
if Z0Z_packageFlow == packageFlowSynthetic: # pyright: ignore [reportUnnecessaryComparison]
|
|
260
|
+
# NOTE this as a default value _might_ have value
|
|
261
|
+
theLogicalPathModuleDispatcher = theLogicalPathModuleDispatcherSynthetic
|
|
262
|
+
|
|
263
|
+
# https://github.com/hunterhogan/mapFolding/issues/4
|
|
264
|
+
# dynamically set the return type https://github.com/hunterhogan/mapFolding/issues/5
|
|
265
|
+
def getPackageDispatcher() -> Callable[[ComputationState], ComputationState]:
|
|
266
|
+
# NOTE but this part, if the package flow is synthetic, probably needs to be delegated
|
|
267
|
+
# to the authority for creating _that_ synthetic flow.
|
|
268
|
+
|
|
269
|
+
# Automated system
|
|
270
|
+
# moduleImported: ModuleType = importlib_import_module(theLogicalPathModuleDispatcher)
|
|
271
|
+
# dispatcherCallable = getattr(moduleImported, theDispatcherCallable)
|
|
272
|
+
|
|
273
|
+
# Hardcoded while I am refactoring "someAssemblyRequired"
|
|
274
|
+
from mapFolding.syntheticModules.numbaCountSequential import flattenData
|
|
275
|
+
dispatcherCallable = flattenData
|
|
276
|
+
return dispatcherCallable
|
|
18
277
|
|
|
19
278
|
"""Technical concepts I am likely using and likely want to use more effectively:
|
|
20
279
|
- Configuration Registry
|
|
@@ -27,94 +286,3 @@ theSSOT and yourSSOT
|
|
|
27
286
|
delay realization/instantiation until a concrete value is desired
|
|
28
287
|
moment of truth: when the value is needed, not when the value is defined
|
|
29
288
|
"""
|
|
30
|
-
|
|
31
|
-
"""
|
|
32
|
-
listDimensions: list[int]
|
|
33
|
-
mapShape
|
|
34
|
-
tupleDimensions: tuple[int, ...]
|
|
35
|
-
dimensionsTuple
|
|
36
|
-
dimensionTuple
|
|
37
|
-
"""
|
|
38
|
-
|
|
39
|
-
def getPathSyntheticModules() -> Path:
|
|
40
|
-
return pathPackage / moduleOfSyntheticModules
|
|
41
|
-
|
|
42
|
-
def getAlgorithmDispatcher() -> Callable[..., None]:
|
|
43
|
-
algorithmSource: ModuleType = getAlgorithmSource()
|
|
44
|
-
return cast(Callable[..., None], algorithmSource.doTheNeedful) # 'doTheNeedful' is duplicated and there is not a SSOT for it
|
|
45
|
-
|
|
46
|
-
# NOTE I want this _concept_, not necessarily this method, to be well implemented and usable everywhere: Python, Numba, Jax, CUDA, idc
|
|
47
|
-
class computationState(TypedDict):
|
|
48
|
-
connectionGraph: ndarray[tuple[int, int, int], dtype[integer[Any]]]
|
|
49
|
-
foldGroups: ndarray[tuple[int] , dtype[integer[Any]]]
|
|
50
|
-
gapsWhere: ndarray[tuple[int] , dtype[integer[Any]]]
|
|
51
|
-
mapShape: ndarray[tuple[int] , dtype[integer[Any]]]
|
|
52
|
-
my: ndarray[tuple[int] , dtype[integer[Any]]]
|
|
53
|
-
track: ndarray[tuple[int, int] , dtype[integer[Any]]]
|
|
54
|
-
|
|
55
|
-
_datatypeModuleScalar = 'numba'
|
|
56
|
-
_decoratorCallable = 'jit'
|
|
57
|
-
def Z0Z_getDatatypeModuleScalar() -> str:
|
|
58
|
-
return _datatypeModuleScalar
|
|
59
|
-
|
|
60
|
-
def Z0Z_setDatatypeModuleScalar(moduleName: str) -> str:
|
|
61
|
-
global _datatypeModuleScalar
|
|
62
|
-
_datatypeModuleScalar = moduleName
|
|
63
|
-
return _datatypeModuleScalar
|
|
64
|
-
|
|
65
|
-
def Z0Z_getDecoratorCallable() -> str:
|
|
66
|
-
return _decoratorCallable
|
|
67
|
-
|
|
68
|
-
def Z0Z_setDecoratorCallable(decoratorName: str) -> str:
|
|
69
|
-
global _decoratorCallable
|
|
70
|
-
_decoratorCallable = decoratorName
|
|
71
|
-
return _decoratorCallable
|
|
72
|
-
|
|
73
|
-
class FREAKOUT(Exception):
|
|
74
|
-
pass
|
|
75
|
-
|
|
76
|
-
# The following identifier is declared in theDao.py.
|
|
77
|
-
# TODO Learn how to assign theDao.py the power to set this truth
|
|
78
|
-
# while using theSSOT.py as the SSOT.
|
|
79
|
-
Z0Z_identifierCountFolds = 'groupsOfFolds'
|
|
80
|
-
|
|
81
|
-
class ParametersNumba(TypedDict):
|
|
82
|
-
_dbg_extend_lifetimes: NotRequired[bool]
|
|
83
|
-
_dbg_optnone: NotRequired[bool]
|
|
84
|
-
_nrt: NotRequired[bool]
|
|
85
|
-
boundscheck: NotRequired[bool]
|
|
86
|
-
cache: bool
|
|
87
|
-
debug: NotRequired[bool]
|
|
88
|
-
error_model: str
|
|
89
|
-
fastmath: bool
|
|
90
|
-
forceinline: bool
|
|
91
|
-
forceobj: NotRequired[bool]
|
|
92
|
-
inline: str
|
|
93
|
-
locals: NotRequired[dict[str, Any]]
|
|
94
|
-
looplift: bool
|
|
95
|
-
no_cfunc_wrapper: bool
|
|
96
|
-
no_cpython_wrapper: bool
|
|
97
|
-
no_rewrites: NotRequired[bool]
|
|
98
|
-
nogil: NotRequired[bool]
|
|
99
|
-
nopython: bool
|
|
100
|
-
parallel: bool
|
|
101
|
-
pipeline_class: NotRequired[type[numbaCompilerBase]]
|
|
102
|
-
signature_or_function: NotRequired[Any | Callable[..., Any] | str | tuple[Any, ...]]
|
|
103
|
-
target: NotRequired[str]
|
|
104
|
-
|
|
105
|
-
parametersNumbaFailEarly: Final[ParametersNumba] = { '_nrt': True, 'boundscheck': True, 'cache': True, 'error_model': 'python', 'fastmath': False, 'forceinline': True, 'inline': 'always', 'looplift': False, 'no_cfunc_wrapper': False, 'no_cpython_wrapper': False, 'nopython': True, 'parallel': False, }
|
|
106
|
-
"""For a production function: speed is irrelevant, error discovery is paramount, must be compatible with anything downstream."""
|
|
107
|
-
|
|
108
|
-
parametersNumbaDEFAULT: Final[ParametersNumba] = { '_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, }
|
|
109
|
-
"""Middle of the road: fast, lean, but will talk to non-jitted functions."""
|
|
110
|
-
|
|
111
|
-
parametersNumbaParallelDEFAULT: Final[ParametersNumba] = { **parametersNumbaDEFAULT, '_nrt': True, 'parallel': True, }
|
|
112
|
-
"""Middle of the road: fast, lean, but will talk to non-jitted functions."""
|
|
113
|
-
|
|
114
|
-
parametersNumbaSuperJit: Final[ParametersNumba] = { **parametersNumbaDEFAULT, 'no_cfunc_wrapper': True, 'no_cpython_wrapper': True, }
|
|
115
|
-
"""Speed, no helmet, no talking to non-jitted functions."""
|
|
116
|
-
|
|
117
|
-
parametersNumbaSuperJitParallel: Final[ParametersNumba] = { **parametersNumbaSuperJit, '_nrt': True, 'parallel': True, }
|
|
118
|
-
"""Speed, no helmet, concurrency, no talking to non-jitted functions."""
|
|
119
|
-
|
|
120
|
-
parametersNumbaMinimum: Final[ParametersNumba] = { '_nrt': True, 'boundscheck': True, 'cache': True, 'error_model': 'numpy', 'fastmath': True, 'forceinline': False, 'inline': 'always', 'looplift': False, 'no_cfunc_wrapper': False, 'no_cpython_wrapper': False, 'nopython': False, 'forceobj': True, 'parallel': False, }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: mapFolding
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.1
|
|
4
4
|
Summary: Count distinct ways to fold a map (or a strip of stamps)
|
|
5
5
|
Author-email: Hunter Hogan <HunterHogan@pm.me>
|
|
6
6
|
License: CC-BY-NC-4.0
|
|
@@ -8,7 +8,7 @@ Project-URL: Donate, https://www.patreon.com/integrated
|
|
|
8
8
|
Project-URL: Homepage, https://github.com/hunterhogan/mapFolding
|
|
9
9
|
Project-URL: Repository, https://github.com/hunterhogan/mapFolding.git
|
|
10
10
|
Keywords: A001415,A001416,A001417,A001418,A195646,combinatorics,folding,map folding,OEIS,optimization,stamp folding
|
|
11
|
-
Classifier: Development Status ::
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
12
|
Classifier: Environment :: Console
|
|
13
13
|
Classifier: Intended Audience :: Education
|
|
14
14
|
Classifier: Intended Audience :: End Users/Desktop
|
|
@@ -28,19 +28,20 @@ Classifier: Typing :: Typed
|
|
|
28
28
|
Requires-Python: >=3.10
|
|
29
29
|
Description-Content-Type: text/markdown
|
|
30
30
|
License-File: LICENSE
|
|
31
|
+
Requires-Dist: autoflake
|
|
32
|
+
Requires-Dist: more_itertools
|
|
33
|
+
Requires-Dist: numba_progress
|
|
31
34
|
Requires-Dist: numba
|
|
32
35
|
Requires-Dist: numpy
|
|
36
|
+
Requires-Dist: python_minifier
|
|
37
|
+
Requires-Dist: tomli
|
|
33
38
|
Requires-Dist: Z0Z_tools
|
|
34
39
|
Provides-Extra: testing
|
|
35
|
-
Requires-Dist: autoflake; extra == "testing"
|
|
36
40
|
Requires-Dist: mypy; extra == "testing"
|
|
37
|
-
Requires-Dist: more_itertools; extra == "testing"
|
|
38
|
-
Requires-Dist: numba_progress; extra == "testing"
|
|
39
41
|
Requires-Dist: pytest-cov; extra == "testing"
|
|
40
42
|
Requires-Dist: pytest-env; extra == "testing"
|
|
41
43
|
Requires-Dist: pytest-xdist; extra == "testing"
|
|
42
44
|
Requires-Dist: pytest; extra == "testing"
|
|
43
|
-
Requires-Dist: python_minifier; extra == "testing"
|
|
44
45
|
Requires-Dist: pyupgrade; extra == "testing"
|
|
45
46
|
Requires-Dist: updateCitation; extra == "testing"
|
|
46
47
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
mapFolding/__init__.py,sha256=hONqdWnBN1ebgrKZuMIZfI8m-1krSR66L4GTVRwBmw4,203
|
|
2
|
+
mapFolding/basecamp.py,sha256=Ik_oH-MpH8f6k-yBzwm99lfkv3pMDgFFEnSSDyiJjsQ,3861
|
|
3
|
+
mapFolding/beDRY.py,sha256=Icgj8s6Rgd_oIBdvzwr6dovywdvG3sIVELO-n74W-So,9011
|
|
4
|
+
mapFolding/filesystem.py,sha256=KqgsO-jaSWAlYib_9ovoXQY76PcQri09_73u0OqMWC8,4094
|
|
5
|
+
mapFolding/noHomeYet.py,sha256=HjxLP-7BGVkKL66T50q4BWnC0Cg2gHUeCKMFuwR2mEQ,785
|
|
6
|
+
mapFolding/oeis.py,sha256=xqnL_VyhwRBET-Kdpnf59K5W5metGbW0JiufTlVw7g0,11853
|
|
7
|
+
mapFolding/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
mapFolding/theDao.py,sha256=eQvR6lDMW_dI6qhZmkTqv-Eog79ekfQjap9rg8cavE8,8629
|
|
9
|
+
mapFolding/theSSOT.py,sha256=fWEkYyCoioi_jJzu2Qwi11GBIyXBbjcFfKAf3tlL9Aw,13270
|
|
10
|
+
mapFolding/reference/flattened.py,sha256=S6D9wiFTlbeoetEqaMLOcA-R22BHOzjqPRujffNxxUM,14875
|
|
11
|
+
mapFolding/reference/hunterNumba.py,sha256=jDS0ORHkIhcJ1rzA5hT49sZHKf3rgJOoGesUCcbKFFY,6054
|
|
12
|
+
mapFolding/reference/irvineJavaPort.py,sha256=7GvBU0tnS6wpFgkYad3465do9jBQW-2bYvbCYyABPHM,3341
|
|
13
|
+
mapFolding/reference/jax.py,sha256=7ji9YWia6Kof0cjcNdiS1GG1rMbC5SBjcyVr_07AeUk,13845
|
|
14
|
+
mapFolding/reference/lunnan.py,sha256=iAbJELfW6RKNMdPcBY9b6rGQ-z1zoRf-1XCurCRMOo8,3951
|
|
15
|
+
mapFolding/reference/lunnanNumpy.py,sha256=rwVP3WIDXimpAuaxhRIuBYU56nVDTKlfGiclw_FkgUU,3765
|
|
16
|
+
mapFolding/reference/lunnanWhile.py,sha256=uRrMT23jTJvoQDlD_FzeIQe_pfMXJG6_bRvs7uhC8z0,3271
|
|
17
|
+
mapFolding/reference/rotatedEntryPoint.py,sha256=USZY3n3zwhSE68ATscUuN66t1qShuEbMI790Gz9JFTw,9352
|
|
18
|
+
mapFolding/reference/total_countPlus1vsPlusN.py,sha256=wpgay-uqPOBd64Z4Pg6tg40j7-4pzWHGMM6v0bnmjhE,6288
|
|
19
|
+
mapFolding/someAssemblyRequired/Z0Z_workbench.py,sha256=XibNQRbX5gGfrkWVfRsW66kHlqphcqVCPz7TyJFcs90,1505
|
|
20
|
+
mapFolding/someAssemblyRequired/__init__.py,sha256=pYkG-1LM8emzTeQbGtOfiZsAiklm5DU92-WE63qB-9s,602
|
|
21
|
+
mapFolding/someAssemblyRequired/getLLVMforNoReason.py,sha256=sGDzg5HG21Q42M0upRD1NWzOUsd7mZ_9wUKJIQHI13o,1000
|
|
22
|
+
mapFolding/someAssemblyRequired/ingredientsNumba.py,sha256=HnWgo1KwIoevUrE5A1WZh4AVFXKQllt8L6RL46JTXEg,2787
|
|
23
|
+
mapFolding/someAssemblyRequired/synthesizeCountingFunctions.py,sha256=77iNPPsN8BmwHaYKdXcDKCwoZKS1g41CJNenQB0W-eg,252
|
|
24
|
+
mapFolding/someAssemblyRequired/synthesizeDataConverters.py,sha256=czo6Y0ABlwye01ShumObAFtkTn7PBx4Qsh9Jna5BMUw,6187
|
|
25
|
+
mapFolding/someAssemblyRequired/synthesizeNumba.py,sha256=cKXvp0BxmYayUBMQ2RJLkVoJUSvzPI1S4Wy_APRM5cI,4788
|
|
26
|
+
mapFolding/someAssemblyRequired/synthesizeNumbaJob.py,sha256=w7zLUzLrLXf2N6O75jKvXDoyTJemWB8GOdK4ryqSWbs,22700
|
|
27
|
+
mapFolding/someAssemblyRequired/synthesizeNumbaModules.py,sha256=zUclYPmAr6X5qFO3nQK1_HHqdiRq6j3EIBXjeax_b8c,4388
|
|
28
|
+
mapFolding/someAssemblyRequired/transformationTools.py,sha256=QAheMJgYWI09PBetyhnJqNhJk_hl6Zlu1TBbDjBwFSs,21001
|
|
29
|
+
mapFolding/someAssemblyRequired/whatWillBe.py,sha256=G_r1VD106gTZISyiwhuJosREfRzQd73JLAMpYg8F6O8,14641
|
|
30
|
+
mapFolding/syntheticModules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
31
|
+
mapFolding/syntheticModules/dataNamespaceFlattened.py,sha256=vsU4PDEMoEcZ424AzsXOJoXoVlX_bSk-pXSTlDsSN9k,2939
|
|
32
|
+
mapFolding/syntheticModules/multiprocessingCount_doTheNeedful.py,sha256=JwZzvF79mvuo2E0Lfs0NeY1QR6JP8FRuwUaRmENwDs8,8482
|
|
33
|
+
mapFolding/syntheticModules/numbaCount.py,sha256=znFV9RhZ0WqPA-r-DT92WDgZXUyhdQlrsKmnsGySuKc,4561
|
|
34
|
+
mapFolding/syntheticModules/numbaCountExample.py,sha256=Oo0Xeex89sLD15iRt3N76OKRFScKl9qwO84-d5sv6lM,11871
|
|
35
|
+
mapFolding/syntheticModules/numbaCountSequential.py,sha256=CtSA3UX2JzoN_uSo0SH7E3coKuHBWaTloQZwbExIPBw,4325
|
|
36
|
+
mapFolding/syntheticModules/numbaCount_doTheNeedful.py,sha256=J9wZ9PW5EVduOQWVze7CgpTHkUjRIvBPG8fNuT3IVpA,1145
|
|
37
|
+
mapFolding/syntheticModules/numba_doTheNeedful.py,sha256=8kgV2GGjy_nxVi9o_aAtrZzRSxsYr8HVNsVXesf4Kec,767
|
|
38
|
+
mapFolding/syntheticModules/numba_doTheNeedfulExample.py,sha256=J9wZ9PW5EVduOQWVze7CgpTHkUjRIvBPG8fNuT3IVpA,1145
|
|
39
|
+
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
|
+
tests/conftest.py,sha256=oPc1IS4RXhLQIBskhuawi4GEWhy6kXbM6D2MdX9kDhw,10833
|
|
41
|
+
tests/test_computations.py,sha256=YhadlskBh_r5RiefHRy0FlrYQ0FelYbqcSNNSkSJMIY,3368
|
|
42
|
+
tests/test_filesystem.py,sha256=7Ova6f4R6lI9rwnnu8SkZgficTYlKEhSzLp-nBRWESM,3183
|
|
43
|
+
tests/test_oeis.py,sha256=uxvwmgbnylSDdsVJfuAT0LuYLbIVFwSgdLxHm-xUGBM,5043
|
|
44
|
+
tests/test_other.py,sha256=CS64h5NACYmXhG3owBpPDcXv3BpYlXNeLqPcqT4quwg,4303
|
|
45
|
+
tests/test_tasks.py,sha256=K5WdCtsM8ghFHX_BMmATsNUTvCICoTHtU-K73QBA4gY,3048
|
|
46
|
+
mapfolding-0.7.1.dist-info/LICENSE,sha256=NxH5Y8BdC-gNU-WSMwim3uMbID2iNDXJz7fHtuTdXhk,19346
|
|
47
|
+
mapfolding-0.7.1.dist-info/METADATA,sha256=czJ_D8mDCOZg1ug6kaIvrwMTKJKh2zfk7Q3FWLJcs6U,7696
|
|
48
|
+
mapfolding-0.7.1.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
|
49
|
+
mapfolding-0.7.1.dist-info/entry_points.txt,sha256=F3OUeZR1XDTpoH7k3wXuRb3KF_kXTTeYhu5AGK1SiOQ,146
|
|
50
|
+
mapfolding-0.7.1.dist-info/top_level.txt,sha256=1gP2vFaqPwHujGwb3UjtMlLEGN-943VSYFR7V4gDqW8,17
|
|
51
|
+
mapfolding-0.7.1.dist-info/RECORD,,
|
tests/__init__.py
ADDED
|
File without changes
|