mapFolding 0.4.1__py3-none-any.whl → 0.4.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/theSSOT.py CHANGED
@@ -1,12 +1,8 @@
1
- from collections import defaultdict
2
- from mapFolding.theSSOTnumba import *
1
+ from mapFolding.theSSOTdatatypes import *
2
+ from numba.core.compiler import CompilerBase as numbaCompilerBase
3
3
  from numpy import dtype, integer, ndarray
4
4
  from types import ModuleType
5
- from typing import Any, Callable, cast, Dict, Final, Optional, Tuple, Type, TYPE_CHECKING
6
- import enum
7
- import numba
8
- import numpy
9
- import numpy.typing
5
+ from typing import Any, Callable, Dict, Final, Tuple, TYPE_CHECKING, Union, cast
10
6
  import pathlib
11
7
  import sys
12
8
 
@@ -20,45 +16,22 @@ if TYPE_CHECKING:
20
16
  else:
21
17
  TypedDict = dict
22
18
 
23
- """I have hobbled together:
24
- TypedDict, Enum, defaultdict, and lookup dictionaries to make DIY immutability and delayed realization/instantiation.
25
- Nevertheless, I am both confident that all of these processes will be replaced and completely ignorant of what will replace them."""
26
-
27
19
  """Technical concepts I am likely using and likely want to use more effectively:
28
20
  - Configuration Registry
29
21
  - Write-Once, Read-Many (WORM) / Immutable Initialization
30
22
  - Lazy Initialization
31
- - Separation of Concerns: in the sense that configuration is separated from business logic
32
-
33
- Furthermore, I want to more clearly divorce the concept of a single _source_ of (a) truth from
34
- the _authority_ of that truth. The analogy to a registry of ownership is still apt: the registry
35
- is, at most, a single (or centralized) source of truth, but it is merely the place to register/record
36
- the truth determined by some other authority.
23
+ - Separation of configuration from business logic
37
24
 
38
- And, I almost certainly want to change the semiotics from "authority" (of truth) to "power" (to create a truth).
39
- Here, "power" is a direct analogy to https://hunterthinks.com/opinion/a-hohfeldian-primer.
25
+ delay realization/instantiation until a concrete value is desired
26
+ moment of truth: when the value is needed, not when the value is defined
40
27
  """
41
28
 
42
- "delay realization/instantiation until a concrete value is desired"
43
-
44
- "moment of truth: when the value is needed, not when the value is defined"
45
-
46
- """What is a (not too complicated, integer) datatype?
47
- - ecosystem/module
48
- - must apathy|value|list of values
49
- - mustn't apathy|value|list of values
50
- - bit width
51
- - bits maximum apathy|value
52
- - bits minimum apathy|value
53
- - magnitude maximum apathy|value
54
- - ?magnitude minimum apathy|value
55
- - signedness apathy|non-negative|non-positive|both
56
- """
57
-
58
29
  myPackageNameIs = "mapFolding"
59
30
 
60
31
  moduleOfSyntheticModules = "syntheticModules"
61
- formatModuleNameDEFAULT = "numba_{callableTarget}"
32
+ # TODO I'm not sure if this is the right tool for the job.
33
+ formatFilenameModuleDEFAULT = "numba_{callableTarget}.py"
34
+ dispatcherCallableNameDEFAULT = "doTheNeedful"
62
35
 
63
36
  def getPathPackage() -> pathlib.Path:
64
37
  import importlib, inspect
@@ -99,159 +72,6 @@ class computationState(TypedDict):
99
72
  my: ndarray[Tuple[int] , dtype[integer[Any]]]
100
73
  track: ndarray[Tuple[int, int] , dtype[integer[Any]]]
101
74
 
102
- @enum.verify(enum.CONTINUOUS, enum.UNIQUE) if sys.version_info >= (3, 11) else lambda x: x
103
- class EnumIndices(enum.IntEnum):
104
- """Base class for index enums."""
105
- @staticmethod
106
- def _generate_next_value_(name: str, start: int, count: int, last_values: list[Any]) -> int:
107
- """0-indexed."""
108
- return count
109
-
110
- def __index__(self) -> int:
111
- """Adapt enum to the ultra-rare event of indexing a NumPy 'ndarray', which is not the
112
- same as `array.array`. See NumPy.org; I think it will be very popular someday."""
113
- return self.value
114
-
115
- class indexMy(EnumIndices):
116
- """Indices for scalar values."""
117
- dimensionsTotal = enum.auto()
118
- dimensionsUnconstrained = enum.auto()
119
- gap1ndex = enum.auto()
120
- gap1ndexCeiling = enum.auto()
121
- indexDimension = enum.auto()
122
- indexLeaf = enum.auto()
123
- indexMiniGap = enum.auto()
124
- leaf1ndex = enum.auto()
125
- leafConnectee = enum.auto()
126
- taskDivisions = enum.auto()
127
- taskIndex = enum.auto()
128
-
129
- class indexTrack(EnumIndices):
130
- """Indices for state tracking array."""
131
- leafAbove = enum.auto()
132
- leafBelow = enum.auto()
133
- countDimensionsGapped = enum.auto()
134
- gapRangeStart = enum.auto()
135
-
136
- _datatypeDefault: Final[Dict[str, str]] = {
137
- 'elephino': 'uint8',
138
- 'foldsTotal': 'int64',
139
- 'leavesTotal': 'uint8',
140
- }
141
- _datatypeModule = ''
142
- _datatypeModuleDEFAULT: Final[str] = 'numpy'
143
-
144
- _datatype: Dict[str, str] = defaultdict(str)
145
-
146
- def reportDatatypeLimit(identifier: str, datatype: str, sourGrapes: Optional[bool] = False) -> str:
147
- global _datatype
148
- if not _datatype[identifier]:
149
- _datatype[identifier] = datatype
150
- elif _datatype[identifier] == datatype:
151
- pass
152
- elif sourGrapes:
153
- raise Exception(f"Datatype is '{_datatype[identifier]}' not '{datatype}', so you can take your ball and go home.")
154
- return _datatype[identifier]
155
-
156
- def setDatatypeModule(datatypeModule: str, sourGrapes: Optional[bool] = False) -> str:
157
- global _datatypeModule
158
- if not _datatypeModule:
159
- _datatypeModule = datatypeModule
160
- elif _datatypeModule == datatypeModule:
161
- pass
162
- elif sourGrapes:
163
- raise Exception(f"Datatype module is '{_datatypeModule}' not '{datatypeModule}', so you can take your ball and go home.")
164
- return _datatypeModule
165
-
166
- def setDatatypeElephino(datatype: str, sourGrapes: Optional[bool] = False) -> str:
167
- return reportDatatypeLimit('elephino', datatype, sourGrapes)
168
-
169
- def setDatatypeFoldsTotal(datatype: str, sourGrapes: Optional[bool] = False) -> str:
170
- return reportDatatypeLimit('foldsTotal', datatype, sourGrapes)
171
-
172
- def setDatatypeLeavesTotal(datatype: str, sourGrapes: Optional[bool] = False) -> str:
173
- return reportDatatypeLimit('leavesTotal', datatype, sourGrapes)
174
-
175
- def _get_datatype(identifier: str) -> str:
176
- global _datatype
177
- if not _datatype[identifier]:
178
- if identifier in indexMy._member_names_:
179
- _datatype[identifier] = _datatypeDefault.get(identifier) or _get_datatype('elephino')
180
- elif identifier in indexTrack._member_names_:
181
- _datatype[identifier] = _datatypeDefault.get(identifier) or _get_datatype('elephino')
182
- else:
183
- _datatype[identifier] = _datatypeDefault.get(identifier) or _get_datatype('foldsTotal')
184
- return _datatype[identifier]
185
-
186
- def _getDatatypeModule() -> str:
187
- global _datatypeModule
188
- if not _datatypeModule:
189
- _datatypeModule = _datatypeModuleDEFAULT
190
- return _datatypeModule
191
-
192
- def setInStone(identifier: str) -> Type[Any]:
193
- datatypeModule = _getDatatypeModule()
194
- datatypeStr = _get_datatype(identifier)
195
- return cast(Type[Any], getattr(eval(datatypeModule), datatypeStr))
196
-
197
- def hackSSOTdtype(identifier: str) -> Type[Any]:
198
- _hackSSOTdtype={
199
- 'connectionGraph': 'dtypeLeavesTotal',
200
- 'dtypeElephino': 'dtypeElephino',
201
- 'dtypeFoldsTotal': 'dtypeFoldsTotal',
202
- 'dtypeLeavesTotal': 'dtypeLeavesTotal',
203
- 'foldGroups': 'dtypeFoldsTotal',
204
- 'gapsWhere': 'dtypeLeavesTotal',
205
- 'mapShape': 'dtypeLeavesTotal',
206
- 'my': 'dtypeElephino',
207
- 'track': 'dtypeElephino',
208
- }
209
- RubeGoldBerg = _hackSSOTdtype[identifier]
210
- if RubeGoldBerg == 'dtypeElephino':
211
- return setInStone('elephino')
212
- elif RubeGoldBerg == 'dtypeFoldsTotal':
213
- return setInStone('foldsTotal')
214
- elif RubeGoldBerg == 'dtypeLeavesTotal':
215
- return setInStone('leavesTotal')
216
- raise Exception("Dude, you forgot to set a value in `hackSSOTdtype`.")
217
-
218
- def hackSSOTdatatype(identifier: str) -> str:
219
- _hackSSOTdatatype={
220
- 'connectionGraph': 'datatypeLeavesTotal',
221
- 'countDimensionsGapped': 'datatypeLeavesTotal',
222
- 'datatypeElephino': 'datatypeElephino',
223
- 'datatypeFoldsTotal': 'datatypeFoldsTotal',
224
- 'datatypeLeavesTotal': 'datatypeLeavesTotal',
225
- 'dimensionsTotal': 'datatypeLeavesTotal',
226
- 'dimensionsUnconstrained': 'datatypeLeavesTotal',
227
- 'foldGroups': 'datatypeFoldsTotal',
228
- 'gap1ndex': 'datatypeLeavesTotal',
229
- 'gap1ndexCeiling': 'datatypeElephino',
230
- 'gapRangeStart': 'datatypeElephino',
231
- 'gapsWhere': 'datatypeLeavesTotal',
232
- 'groupsOfFolds': 'datatypeFoldsTotal',
233
- 'indexDimension': 'datatypeLeavesTotal',
234
- 'indexLeaf': 'datatypeLeavesTotal',
235
- 'indexMiniGap': 'datatypeElephino',
236
- 'leaf1ndex': 'datatypeLeavesTotal',
237
- 'leafAbove': 'datatypeLeavesTotal',
238
- 'leafBelow': 'datatypeLeavesTotal',
239
- 'leafConnectee': 'datatypeLeavesTotal',
240
- 'mapShape': 'datatypeLeavesTotal',
241
- 'my': 'datatypeElephino',
242
- 'taskDivisions': 'datatypeLeavesTotal',
243
- 'taskIndex': 'datatypeLeavesTotal',
244
- 'track': 'datatypeElephino',
245
- }
246
- RubeGoldBerg = _hackSSOTdatatype[identifier]
247
- if RubeGoldBerg == 'datatypeElephino':
248
- return _get_datatype('elephino')
249
- elif RubeGoldBerg == 'datatypeFoldsTotal':
250
- return _get_datatype('foldsTotal')
251
- elif RubeGoldBerg == 'datatypeLeavesTotal':
252
- return _get_datatype('leavesTotal')
253
- raise Exception("Dude, you forgot to set a value in `hackSSOTdatatype`.")
254
-
255
75
  _datatypeModuleScalar = 'numba'
256
76
  _decoratorCallable = 'jit'
257
77
  def Z0Z_getDatatypeModuleScalar() -> str:
@@ -277,3 +97,44 @@ class FREAKOUT(Exception):
277
97
  # TODO Learn how to assign theDao.py the power to set this truth
278
98
  # while using theSSOT.py as the SSOT.
279
99
  Z0Z_identifierCountFolds = 'groupsOfFolds'
100
+
101
+ class ParametersNumba(TypedDict):
102
+ _dbg_extend_lifetimes: NotRequired[bool]
103
+ _dbg_optnone: NotRequired[bool]
104
+ _nrt: NotRequired[bool]
105
+ boundscheck: NotRequired[bool]
106
+ cache: bool
107
+ debug: NotRequired[bool]
108
+ error_model: str
109
+ fastmath: bool
110
+ forceinline: bool
111
+ forceobj: NotRequired[bool]
112
+ inline: str
113
+ locals: NotRequired[Dict[str, Any]]
114
+ looplift: bool
115
+ no_cfunc_wrapper: bool
116
+ no_cpython_wrapper: bool
117
+ no_rewrites: NotRequired[bool]
118
+ nogil: NotRequired[bool]
119
+ nopython: bool
120
+ parallel: bool
121
+ pipeline_class: NotRequired[Type[numbaCompilerBase]]
122
+ signature_or_function: NotRequired[Union[Any, Callable, str, Tuple]]
123
+ target: NotRequired[str]
124
+
125
+ 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, }
126
+ """For a production function: speed is irrelevant, error discovery is paramount, must be compatible with anything downstream."""
127
+
128
+ 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, }
129
+ """Middle of the road: fast, lean, but will talk to non-jitted functions."""
130
+
131
+ parametersNumbaParallelDEFAULT: Final[ParametersNumba] = { **parametersNumbaDEFAULT, '_nrt': True, 'parallel': True, }
132
+ """Middle of the road: fast, lean, but will talk to non-jitted functions."""
133
+
134
+ parametersNumbaSuperJit: Final[ParametersNumba] = { **parametersNumbaDEFAULT, 'no_cfunc_wrapper': True, 'no_cpython_wrapper': True, }
135
+ """Speed, no helmet, no talking to non-jitted functions."""
136
+
137
+ parametersNumbaSuperJitParallel: Final[ParametersNumba] = { **parametersNumbaSuperJit, '_nrt': True, 'parallel': True, }
138
+ """Speed, no helmet, concurrency, no talking to non-jitted functions."""
139
+
140
+ 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, }
@@ -0,0 +1,168 @@
1
+ from collections import defaultdict
2
+ from typing import Any, cast, Dict, Final, Optional, Type, TYPE_CHECKING
3
+ import enum
4
+ import sys
5
+ import numba
6
+ import numpy
7
+
8
+ try:
9
+ from typing import NotRequired
10
+ except ImportError:
11
+ from typing_extensions import NotRequired
12
+
13
+ if TYPE_CHECKING:
14
+ from typing import TypedDict
15
+ else:
16
+ TypedDict = dict
17
+
18
+ @enum.verify(enum.CONTINUOUS, enum.UNIQUE) if sys.version_info >= (3, 11) else lambda x: x
19
+ class EnumIndices(enum.IntEnum):
20
+ @staticmethod
21
+ def _generate_next_value_(name: str, start: int, count: int, last_values: list[Any]) -> int:
22
+ """0-indexed."""
23
+ return count
24
+
25
+ def __index__(self) -> int:
26
+ """Adapt enum to the ultra-rare event of indexing a NumPy 'ndarray', which is not the
27
+ same as `array.array`. See NumPy.org; I think it will be very popular someday."""
28
+ return self.value
29
+
30
+ class indexMy(EnumIndices):
31
+ """Indices for scalar values."""
32
+ dimensionsTotal = enum.auto()
33
+ dimensionsUnconstrained = enum.auto()
34
+ gap1ndex = enum.auto()
35
+ gap1ndexCeiling = enum.auto()
36
+ indexDimension = enum.auto()
37
+ indexLeaf = enum.auto()
38
+ indexMiniGap = enum.auto()
39
+ leaf1ndex = enum.auto()
40
+ leafConnectee = enum.auto()
41
+ taskDivisions = enum.auto()
42
+ taskIndex = enum.auto()
43
+
44
+ class indexTrack(EnumIndices):
45
+ """Indices for state tracking array."""
46
+ leafAbove = enum.auto()
47
+ leafBelow = enum.auto()
48
+ countDimensionsGapped = enum.auto()
49
+ gapRangeStart = enum.auto()
50
+
51
+ _datatypeDefault: Final[Dict[str, str]] = {
52
+ 'elephino': 'uint16',
53
+ 'foldsTotal': 'int64',
54
+ 'leavesTotal': 'uint16',
55
+ }
56
+ _datatypeModule = ''
57
+ _datatypeModuleDEFAULT: Final[str] = 'numpy'
58
+
59
+ _datatype: Dict[str, str] = defaultdict(str)
60
+
61
+ def reportDatatypeLimit(identifier: str, datatype: str, sourGrapes: Optional[bool] = False) -> str:
62
+ global _datatype
63
+ if not _datatype[identifier]:
64
+ _datatype[identifier] = datatype
65
+ elif _datatype[identifier] == datatype:
66
+ pass
67
+ elif sourGrapes:
68
+ raise Exception(f"Datatype is '{_datatype[identifier]}' not '{datatype}', so you can take your ball and go home.")
69
+ return _datatype[identifier]
70
+
71
+ def setDatatypeModule(datatypeModule: str, sourGrapes: Optional[bool] = False) -> str:
72
+ global _datatypeModule
73
+ if not _datatypeModule:
74
+ _datatypeModule = datatypeModule
75
+ elif _datatypeModule == datatypeModule:
76
+ pass
77
+ elif sourGrapes:
78
+ raise Exception(f"Datatype module is '{_datatypeModule}' not '{datatypeModule}', so you can take your ball and go home.")
79
+ return _datatypeModule
80
+
81
+ def setDatatypeElephino(datatype: str, sourGrapes: Optional[bool] = False) -> str:
82
+ return reportDatatypeLimit('elephino', datatype, sourGrapes)
83
+
84
+ def setDatatypeFoldsTotal(datatype: str, sourGrapes: Optional[bool] = False) -> str:
85
+ return reportDatatypeLimit('foldsTotal', datatype, sourGrapes)
86
+
87
+ def setDatatypeLeavesTotal(datatype: str, sourGrapes: Optional[bool] = False) -> str:
88
+ return reportDatatypeLimit('leavesTotal', datatype, sourGrapes)
89
+
90
+ def _get_datatype(identifier: str) -> str:
91
+ global _datatype
92
+ if not _datatype[identifier]:
93
+ if identifier in indexMy._member_names_:
94
+ _datatype[identifier] = _datatypeDefault.get(identifier) or _get_datatype('elephino')
95
+ elif identifier in indexTrack._member_names_:
96
+ _datatype[identifier] = _datatypeDefault.get(identifier) or _get_datatype('elephino')
97
+ else:
98
+ _datatype[identifier] = _datatypeDefault.get(identifier) or _get_datatype('foldsTotal')
99
+ return _datatype[identifier]
100
+
101
+ def getDatatypeModule() -> str:
102
+ global _datatypeModule
103
+ if not _datatypeModule:
104
+ _datatypeModule = _datatypeModuleDEFAULT
105
+ return _datatypeModule
106
+
107
+ def setInStone(identifier: str) -> Type[Any]:
108
+ datatypeModule = getDatatypeModule()
109
+ datatypeStr = _get_datatype(identifier)
110
+ return cast(Type[Any], getattr(eval(datatypeModule), datatypeStr))
111
+
112
+ def hackSSOTdtype(identifier: str) -> Type[Any]:
113
+ _hackSSOTdtype={
114
+ 'connectionGraph': 'dtypeLeavesTotal',
115
+ 'dtypeElephino': 'dtypeElephino',
116
+ 'dtypeFoldsTotal': 'dtypeFoldsTotal',
117
+ 'dtypeLeavesTotal': 'dtypeLeavesTotal',
118
+ 'foldGroups': 'dtypeFoldsTotal',
119
+ 'gapsWhere': 'dtypeLeavesTotal',
120
+ 'mapShape': 'dtypeLeavesTotal',
121
+ 'my': 'dtypeElephino',
122
+ 'track': 'dtypeElephino',
123
+ }
124
+ RubeGoldBerg = _hackSSOTdtype[identifier]
125
+ if RubeGoldBerg == 'dtypeElephino':
126
+ return setInStone('elephino')
127
+ elif RubeGoldBerg == 'dtypeFoldsTotal':
128
+ return setInStone('foldsTotal')
129
+ elif RubeGoldBerg == 'dtypeLeavesTotal':
130
+ return setInStone('leavesTotal')
131
+ raise Exception("Dude, you forgot to set a value in `hackSSOTdtype`.")
132
+
133
+ def hackSSOTdatatype(identifier: str) -> str:
134
+ _hackSSOTdatatype={
135
+ 'connectionGraph': 'datatypeLeavesTotal',
136
+ 'countDimensionsGapped': 'datatypeLeavesTotal',
137
+ 'datatypeElephino': 'datatypeElephino',
138
+ 'datatypeFoldsTotal': 'datatypeFoldsTotal',
139
+ 'datatypeLeavesTotal': 'datatypeLeavesTotal',
140
+ 'dimensionsTotal': 'datatypeLeavesTotal',
141
+ 'dimensionsUnconstrained': 'datatypeLeavesTotal',
142
+ 'foldGroups': 'datatypeFoldsTotal',
143
+ 'gap1ndex': 'datatypeLeavesTotal',
144
+ 'gap1ndexCeiling': 'datatypeElephino',
145
+ 'gapRangeStart': 'datatypeElephino',
146
+ 'gapsWhere': 'datatypeLeavesTotal',
147
+ 'groupsOfFolds': 'datatypeFoldsTotal',
148
+ 'indexDimension': 'datatypeLeavesTotal',
149
+ 'indexLeaf': 'datatypeLeavesTotal',
150
+ 'indexMiniGap': 'datatypeElephino',
151
+ 'leaf1ndex': 'datatypeLeavesTotal',
152
+ 'leafAbove': 'datatypeLeavesTotal',
153
+ 'leafBelow': 'datatypeLeavesTotal',
154
+ 'leafConnectee': 'datatypeLeavesTotal',
155
+ 'mapShape': 'datatypeLeavesTotal',
156
+ 'my': 'datatypeElephino',
157
+ 'taskDivisions': 'datatypeLeavesTotal',
158
+ 'taskIndex': 'datatypeLeavesTotal',
159
+ 'track': 'datatypeElephino',
160
+ }
161
+ RubeGoldBerg = _hackSSOTdatatype[identifier]
162
+ if RubeGoldBerg == 'datatypeElephino':
163
+ return _get_datatype('elephino')
164
+ elif RubeGoldBerg == 'datatypeFoldsTotal':
165
+ return _get_datatype('foldsTotal')
166
+ elif RubeGoldBerg == 'datatypeLeavesTotal':
167
+ return _get_datatype('leavesTotal')
168
+ raise Exception("Dude, you forgot to set a value in `hackSSOTdatatype`.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mapFolding
3
- Version: 0.4.1
3
+ Version: 0.4.3
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
@@ -0,0 +1,40 @@
1
+ mapFolding/__init__.py,sha256=1-iO5PCGKlW81fhMDjSLrsKxuSeV-UMcU1NlKW352FM,1347
2
+ mapFolding/basecamp.py,sha256=MyrkAbJZawW6CPVEJ_7iPfCYjngdFHmicSs8Ylq5S1E,3787
3
+ mapFolding/beDRY.py,sha256=tDLddJzQoGvbcttJro8ML2B59KspMkZwIeZdm4hOy_4,16785
4
+ mapFolding/oeis.py,sha256=8c6q3STjgp-c4Reode9PLLYS3c00wCsJW-yfte7NI60,11103
5
+ mapFolding/theDao.py,sha256=PZgx_0X7QfdIpLpEO5mbdVNFMCRuP8PD-f62xU7C4U0,12618
6
+ mapFolding/theSSOT.py,sha256=RQmSsjmysc9izjGLsVseZ0J0nDzG_rKY7QkrOF-47SU,5794
7
+ mapFolding/theSSOTdatatypes.py,sha256=H0d1vAn59VCRPMhn28PtlBEZnjmQjEKofiefgvpBFsg,5955
8
+ mapFolding/reference/flattened.py,sha256=S6D9wiFTlbeoetEqaMLOcA-R22BHOzjqPRujffNxxUM,14875
9
+ mapFolding/reference/hunterNumba.py,sha256=jDS0ORHkIhcJ1rzA5hT49sZHKf3rgJOoGesUCcbKFFY,6054
10
+ mapFolding/reference/irvineJavaPort.py,sha256=7GvBU0tnS6wpFgkYad3465do9jBQW-2bYvbCYyABPHM,3341
11
+ mapFolding/reference/jax.py,sha256=7ji9YWia6Kof0cjcNdiS1GG1rMbC5SBjcyVr_07AeUk,13845
12
+ mapFolding/reference/lunnan.py,sha256=iAbJELfW6RKNMdPcBY9b6rGQ-z1zoRf-1XCurCRMOo8,3951
13
+ mapFolding/reference/lunnanNumpy.py,sha256=rwVP3WIDXimpAuaxhRIuBYU56nVDTKlfGiclw_FkgUU,3765
14
+ mapFolding/reference/lunnanWhile.py,sha256=uRrMT23jTJvoQDlD_FzeIQe_pfMXJG6_bRvs7uhC8z0,3271
15
+ mapFolding/reference/rotatedEntryPoint.py,sha256=USZY3n3zwhSE68ATscUuN66t1qShuEbMI790Gz9JFTw,9352
16
+ mapFolding/reference/total_countPlus1vsPlusN.py,sha256=wpgay-uqPOBd64Z4Pg6tg40j7-4pzWHGMM6v0bnmjhE,6288
17
+ mapFolding/someAssemblyRequired/__init__.py,sha256=wtec_hIz-AKz0_hGdXsWnCKTcCxdMV9-WK6SiIriAeU,396
18
+ mapFolding/someAssemblyRequired/getLLVMforNoReason.py,sha256=nX8tghZClYt7zJd6RpZBXhE_h-CGRHOS17biqiEdf-o,855
19
+ mapFolding/someAssemblyRequired/makeJob.py,sha256=c9sTRUK90snTCcXCvs86VKBH6z_nt3OVFjNs_WgCoIg,2422
20
+ mapFolding/someAssemblyRequired/synthesizeModuleJAX.py,sha256=jatvtYhK5ZJK-YmCKATt7w3icFXXO79cZDAYVrU9bgA,1258
21
+ mapFolding/someAssemblyRequired/synthesizeNumba.py,sha256=eJRZ8ttfaONMq-s3BawswJrHu_m0DUHp4dGpx6uVpuk,16920
22
+ mapFolding/someAssemblyRequired/synthesizeNumbaGeneralized.py,sha256=3FiD6fDGzam6uvgTg7YEsGlLftbBOol2ajvEa4GNTec,16698
23
+ mapFolding/someAssemblyRequired/synthesizeNumbaJob.py,sha256=pknX6CeH9iuDTs9tp0gz33T2U5gjO8NMpPnQnnBU2gA,9138
24
+ mapFolding/someAssemblyRequired/synthesizeNumbaModules.py,sha256=V9xpM1r4MQlhXoKLkF2PTg69gid7Ec64pbMc2ZZ2xXo,5590
25
+ mapFolding/syntheticModules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
+ mapFolding/syntheticModules/numbaCount.py,sha256=VkTHk97gIBRZg7FwX7hCgfunSBK2Gyr4pp3fzHNrLhw,12907
27
+ mapFolding/syntheticModules/numba_doTheNeedful.py,sha256=9syuZEc1KwH3BFp2TmK7-pBuT2N4lVJTiUhqu7ahaKY,1157
28
+ tests/__init__.py,sha256=eg9smg-6VblOr0kisM40CpGnuDtU2JgEEWGDTFVOlW8,57
29
+ tests/conftest.py,sha256=qP-ZCyyqXC4E9W_psMVbHPlXE-8Ue01fBckGqhzlhGQ,11972
30
+ tests/test_computations.py,sha256=WO28l9AmrFY6kbcx9iJr6YNoqLbZ8Lgs7FryH5DG0BI,2856
31
+ tests/test_oeis.py,sha256=C2F6XrI5oRPjc29lykN3e83rIcgl01UwBLB6L-Qz2pE,4733
32
+ tests/test_other.py,sha256=u0vINT5EyVsXTNTR2DZIMpWCg4FH471jjHLRzC2JX7U,8351
33
+ tests/test_tasks.py,sha256=iq6_dh43JQkC2vAWXua0Xe915BKFGbvRJAkmbco854A,2389
34
+ tests/test_types.py,sha256=58tmPG9WOeGGAQbdQK_h_7t4SnENnZugH4WXlI8-L-M,171
35
+ mapFolding-0.4.3.dist-info/LICENSE,sha256=NxH5Y8BdC-gNU-WSMwim3uMbID2iNDXJz7fHtuTdXhk,19346
36
+ mapFolding-0.4.3.dist-info/METADATA,sha256=52v3PWTTXMbJwXFaUQFAnJilfn29HFiESW83sPFUL1M,7633
37
+ mapFolding-0.4.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
38
+ mapFolding-0.4.3.dist-info/entry_points.txt,sha256=F3OUeZR1XDTpoH7k3wXuRb3KF_kXTTeYhu5AGK1SiOQ,146
39
+ mapFolding-0.4.3.dist-info/top_level.txt,sha256=1gP2vFaqPwHujGwb3UjtMlLEGN-943VSYFR7V4gDqW8,17
40
+ mapFolding-0.4.3.dist-info/RECORD,,
tests/conftest.py CHANGED
@@ -6,11 +6,11 @@ from mapFolding import *
6
6
  from mapFolding import basecamp, getAlgorithmDispatcher, getDispatcherCallable
7
7
  from mapFolding.beDRY import *
8
8
  from mapFolding.someAssemblyRequired import *
9
- from mapFolding.oeis import _getFilenameOEISbFile, _getOEISidInformation, _getOEISidValues
10
9
  from mapFolding.oeis import *
11
10
  from types import ModuleType
12
11
  from typing import Any, Callable, ContextManager, Dict, Generator, List, Literal, NoReturn, Optional, Sequence, Set, Tuple, Type, Union
13
12
  from Z0Z_tools.pytestForYourUse import PytestFor_defineConcurrencyLimit, PytestFor_intInnit, PytestFor_oopsieKwargsie
13
+ import importlib.util
14
14
  import pathlib
15
15
  import pytest
16
16
  import random
@@ -101,36 +101,6 @@ def makeDictionaryFoldsTotalKnown() -> Dict[Tuple[int,...], int]:
101
101
  dimensions = settings['getMapShape'](n)
102
102
  dimensions.sort()
103
103
  dictionaryMapDimensionsToFoldsTotalKnown[tuple(dimensions)] = foldingsTotal
104
-
105
- # Are we in a place that has jobs?
106
- pathJobDEFAULT = getPathJobRootDEFAULT()
107
- if pathJobDEFAULT.exists():
108
- # Are there foldsTotal files?
109
- for pathFilenameFoldsTotal in pathJobDEFAULT.rglob('*.foldsTotal'):
110
- if pathFilenameFoldsTotal.is_file():
111
- try:
112
- listDimensions = eval(pathFilenameFoldsTotal.stem)
113
- except Exception:
114
- continue
115
- # Are the dimensions in the dictionary?
116
- if isinstance(listDimensions, list) and all(isinstance(dimension, int) for dimension in listDimensions):
117
- listDimensions.sort()
118
- if tuple(listDimensions) in dictionaryMapDimensionsToFoldsTotalKnown:
119
- continue
120
- # Are the contents a reasonably large integer?
121
- try:
122
- foldsTotal = pathFilenameFoldsTotal.read_text()
123
- except Exception:
124
- continue
125
- # Why did I sincerely believe this would only be three lines of code?
126
- if foldsTotal.isdigit():
127
- foldsTotalInteger = int(foldsTotal)
128
- if foldsTotalInteger > 85109616 * 10**3:
129
- # You made it this far, so fuck it: put it in the dictionary
130
- dictionaryMapDimensionsToFoldsTotalKnown[tuple(listDimensions)] = foldsTotalInteger
131
- dictionaryMapDimensionsToFoldsTotalKnown[tuple(listDimensions)] = foldsTotalInteger
132
- # The sunk-costs fallacy claims another victim!
133
-
134
104
  return dictionaryMapDimensionsToFoldsTotalKnown
135
105
 
136
106
  """
@@ -255,6 +225,35 @@ def useAlgorithmSourceDispatcher(useThisDispatcher: Callable) -> Generator[None,
255
225
  useThisDispatcher(getAlgorithmDispatcher())
256
226
  yield
257
227
 
228
+ @pytest.fixture
229
+ def syntheticDispatcherFixture(useThisDispatcher):
230
+ listCallablesInlineHARDCODED: List[str] = ['countInitialize', 'countParallel', 'countSequential']
231
+ listCallablesInline = listCallablesInlineHARDCODED
232
+ callableDispatcher = True
233
+ algorithmSource = None
234
+ relativePathWrite = None
235
+ filenameModuleWrite = 'pytestCount.py'
236
+ formatFilenameWrite = "pytest_{callableTarget}.py"
237
+ listSynthesizedModules: List[youOughtaKnow] = makeFlowNumbaOptimized(listCallablesInline, callableDispatcher, algorithmSource, relativePathWrite, filenameModuleWrite, formatFilenameWrite)
238
+ dispatcherSynthetic = youOughtaKnow('','','')
239
+ for stuff in listSynthesizedModules:
240
+ registrarRecordsTmpObject(stuff.pathFilenameForMe)
241
+ if stuff.callableSynthesized not in listCallablesInline:
242
+ dispatcherSynthetic: youOughtaKnow = stuff
243
+
244
+ dispatcherSpec = importlib.util.spec_from_file_location(dispatcherSynthetic.callableSynthesized, dispatcherSynthetic.pathFilenameForMe)
245
+ if dispatcherSpec is None:
246
+ raise ImportError(f"{dispatcherSynthetic.pathFilenameForMe=}")
247
+ if dispatcherSpec.loader is None:
248
+ raise ImportError(f"Failed to get loader for module {dispatcherSynthetic.pathFilenameForMe}")
249
+
250
+ dispatcherModule = importlib.util.module_from_spec(dispatcherSpec)
251
+ dispatcherSpec.loader.exec_module(dispatcherModule)
252
+ callableDispatcherSynthetic = getattr(dispatcherModule, dispatcherSynthetic.callableSynthesized)
253
+
254
+ useThisDispatcher(callableDispatcherSynthetic)
255
+ return callableDispatcherSynthetic
256
+
258
257
  def uniformTestMessage(expected: Any, actual: Any, functionName: str, *arguments: Any) -> str:
259
258
  """Format assertion message for any test comparison."""
260
259
  return (f"\nTesting: `{functionName}({', '.join(str(parameter) for parameter in arguments)})`\n"