mapFolding 0.4.3__py3-none-any.whl → 0.5.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.
Files changed (41) hide show
  1. mapFolding/__init__.py +93 -58
  2. mapFolding/basecamp.py +9 -11
  3. mapFolding/beDRY.py +24 -23
  4. mapFolding/oeis.py +47 -45
  5. mapFolding/theDao.py +48 -48
  6. mapFolding/theSSOT.py +22 -20
  7. mapFolding/theSSOTdatatypes.py +20 -32
  8. {mapFolding-0.4.3.dist-info → mapFolding-0.5.1.dist-info}/METADATA +3 -1
  9. mapFolding-0.5.1.dist-info/RECORD +14 -0
  10. {mapFolding-0.4.3.dist-info → mapFolding-0.5.1.dist-info}/top_level.txt +0 -1
  11. mapFolding/reference/flattened.py +0 -377
  12. mapFolding/reference/hunterNumba.py +0 -132
  13. mapFolding/reference/irvineJavaPort.py +0 -120
  14. mapFolding/reference/jax.py +0 -208
  15. mapFolding/reference/lunnan.py +0 -153
  16. mapFolding/reference/lunnanNumpy.py +0 -123
  17. mapFolding/reference/lunnanWhile.py +0 -121
  18. mapFolding/reference/rotatedEntryPoint.py +0 -240
  19. mapFolding/reference/total_countPlus1vsPlusN.py +0 -211
  20. mapFolding/someAssemblyRequired/__init__.py +0 -5
  21. mapFolding/someAssemblyRequired/getLLVMforNoReason.py +0 -19
  22. mapFolding/someAssemblyRequired/makeJob.py +0 -55
  23. mapFolding/someAssemblyRequired/synthesizeModuleJAX.py +0 -29
  24. mapFolding/someAssemblyRequired/synthesizeNumba.py +0 -340
  25. mapFolding/someAssemblyRequired/synthesizeNumbaGeneralized.py +0 -396
  26. mapFolding/someAssemblyRequired/synthesizeNumbaJob.py +0 -162
  27. mapFolding/someAssemblyRequired/synthesizeNumbaModules.py +0 -129
  28. mapFolding/syntheticModules/numbaCount.py +0 -158
  29. mapFolding/syntheticModules/numba_doTheNeedful.py +0 -13
  30. mapFolding-0.4.3.dist-info/RECORD +0 -40
  31. tests/__init__.py +0 -1
  32. tests/conftest.py +0 -306
  33. tests/test_computations.py +0 -43
  34. tests/test_oeis.py +0 -129
  35. tests/test_other.py +0 -171
  36. tests/test_tasks.py +0 -40
  37. tests/test_types.py +0 -5
  38. /mapFolding/{syntheticModules/__init__.py → py.typed} +0 -0
  39. {mapFolding-0.4.3.dist-info → mapFolding-0.5.1.dist-info}/LICENSE +0 -0
  40. {mapFolding-0.4.3.dist-info → mapFolding-0.5.1.dist-info}/WHEEL +0 -0
  41. {mapFolding-0.4.3.dist-info → mapFolding-0.5.1.dist-info}/entry_points.txt +0 -0
mapFolding/theDao.py CHANGED
@@ -1,93 +1,93 @@
1
1
  from mapFolding import indexMy, indexTrack
2
2
  from numba import prange
3
3
  from numpy import dtype, integer, ndarray
4
- from typing import Any, Tuple
4
+ from typing import Any
5
5
 
6
6
  # `.value` is not necessary for this module or most modules. But, this module is transformed into Numba "jitted" functions, and Numba won't use `Enum` for an ndarray index without `.value`.
7
- def activeLeafConnectedToItself(my: ndarray[Tuple[int], dtype[integer[Any]]]) -> Any:
7
+ def activeLeafConnectedToItself(my: ndarray[tuple[int], dtype[integer[Any]]]) -> Any:
8
8
  return my[indexMy.leafConnectee.value] == my[indexMy.leaf1ndex.value]
9
9
 
10
- def activeLeafGreaterThan0(my: ndarray[Tuple[int], dtype[integer[Any]]]) -> Any:
10
+ def activeLeafGreaterThan0(my: ndarray[tuple[int], dtype[integer[Any]]]) -> Any:
11
11
  return my[indexMy.leaf1ndex.value] > 0
12
12
 
13
- def activeLeafGreaterThanLeavesTotal(foldGroups: ndarray[Tuple[int], dtype[integer[Any]]], my: ndarray[Tuple[int], dtype[integer[Any]]]) -> Any:
13
+ def activeLeafGreaterThanLeavesTotal(foldGroups: ndarray[tuple[int], dtype[integer[Any]]], my: ndarray[tuple[int], dtype[integer[Any]]]) -> Any:
14
14
  return my[indexMy.leaf1ndex.value] > foldGroups[-1]
15
15
 
16
- def activeLeafIsTheFirstLeaf(my: ndarray[Tuple[int], dtype[integer[Any]]]) -> Any:
16
+ def activeLeafIsTheFirstLeaf(my: ndarray[tuple[int], dtype[integer[Any]]]) -> Any:
17
17
  return my[indexMy.leaf1ndex.value] <= 1
18
18
 
19
- def allDimensionsAreUnconstrained(my: ndarray[Tuple[int], dtype[integer[Any]]]) -> Any:
19
+ def allDimensionsAreUnconstrained(my: ndarray[tuple[int], dtype[integer[Any]]]) -> Any:
20
20
  return not my[indexMy.dimensionsUnconstrained.value]
21
21
 
22
- def backtrack(my: ndarray[Tuple[int], dtype[integer[Any]]], track: ndarray[Tuple[int, int], dtype[integer[Any]]]) -> None:
22
+ def backtrack(my: ndarray[tuple[int], dtype[integer[Any]]], track: ndarray[tuple[int, int], dtype[integer[Any]]]) -> None:
23
23
  my[indexMy.leaf1ndex.value] -= 1
24
24
  track[indexTrack.leafBelow.value, track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]] = track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]]
25
25
  track[indexTrack.leafAbove.value, track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]]] = track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]
26
26
 
27
- def countGaps(gapsWhere: ndarray[Tuple[int], dtype[integer[Any]]], my: ndarray[Tuple[int], dtype[integer[Any]]], track: ndarray[Tuple[int, int], dtype[integer[Any]]]) -> None:
27
+ def countGaps(gapsWhere: ndarray[tuple[int], dtype[integer[Any]]], my: ndarray[tuple[int], dtype[integer[Any]]], track: ndarray[tuple[int, int], dtype[integer[Any]]]) -> None:
28
28
  gapsWhere[my[indexMy.gap1ndexCeiling.value]] = my[indexMy.leafConnectee.value]
29
29
  if track[indexTrack.countDimensionsGapped.value, my[indexMy.leafConnectee.value]] == 0:
30
30
  incrementGap1ndexCeiling(my=my)
31
31
  track[indexTrack.countDimensionsGapped.value, my[indexMy.leafConnectee.value]] += 1
32
32
 
33
- def decrementDimensionsUnconstrained(my: ndarray[Tuple[int], dtype[integer[Any]]]) -> None:
33
+ def decrementDimensionsUnconstrained(my: ndarray[tuple[int], dtype[integer[Any]]]) -> None:
34
34
  my[indexMy.dimensionsUnconstrained.value] -= 1
35
35
 
36
- def dimensionsUnconstrainedCondition(connectionGraph: ndarray[Tuple[int, int, int], dtype[integer[Any]]], my: ndarray[Tuple[int], dtype[integer[Any]]]) -> Any:
36
+ def dimensionsUnconstrainedCondition(connectionGraph: ndarray[tuple[int, int, int], dtype[integer[Any]]], my: ndarray[tuple[int], dtype[integer[Any]]]) -> Any:
37
37
  return connectionGraph[my[indexMy.indexDimension.value], my[indexMy.leaf1ndex.value], my[indexMy.leaf1ndex.value]] == my[indexMy.leaf1ndex.value]
38
38
 
39
- def filterCommonGaps(gapsWhere: ndarray[Tuple[int], dtype[integer[Any]]], my: ndarray[Tuple[int], dtype[integer[Any]]], track: ndarray[Tuple[int, int], dtype[integer[Any]]]) -> None:
39
+ def filterCommonGaps(gapsWhere: ndarray[tuple[int], dtype[integer[Any]]], my: ndarray[tuple[int], dtype[integer[Any]]], track: ndarray[tuple[int, int], dtype[integer[Any]]]) -> None:
40
40
  gapsWhere[my[indexMy.gap1ndex.value]] = gapsWhere[my[indexMy.indexMiniGap.value]]
41
41
  if track[indexTrack.countDimensionsGapped.value, gapsWhere[my[indexMy.indexMiniGap.value]]] == my[indexMy.dimensionsUnconstrained.value]:
42
42
  incrementActiveGap(my=my)
43
43
  track[indexTrack.countDimensionsGapped.value, gapsWhere[my[indexMy.indexMiniGap.value]]] = 0
44
44
 
45
- def incrementActiveGap(my: ndarray[Tuple[int], dtype[integer[Any]]]) -> None:
45
+ def incrementActiveGap(my: ndarray[tuple[int], dtype[integer[Any]]]) -> None:
46
46
  my[indexMy.gap1ndex.value] += 1
47
47
 
48
- def incrementGap1ndexCeiling(my: ndarray[Tuple[int], dtype[integer[Any]]]) -> None:
48
+ def incrementGap1ndexCeiling(my: ndarray[tuple[int], dtype[integer[Any]]]) -> None:
49
49
  my[indexMy.gap1ndexCeiling.value] += 1
50
50
 
51
- def incrementIndexDimension(my: ndarray[Tuple[int], dtype[integer[Any]]]) -> None:
51
+ def incrementIndexDimension(my: ndarray[tuple[int], dtype[integer[Any]]]) -> None:
52
52
  my[indexMy.indexDimension.value] += 1
53
53
 
54
- def incrementIndexMiniGap(my: ndarray[Tuple[int], dtype[integer[Any]]]) -> None:
54
+ def incrementIndexMiniGap(my: ndarray[tuple[int], dtype[integer[Any]]]) -> None:
55
55
  my[indexMy.indexMiniGap.value] += 1
56
56
 
57
- def initializeIndexMiniGap(my: ndarray[Tuple[int], dtype[integer[Any]]]) -> None:
57
+ def initializeIndexMiniGap(my: ndarray[tuple[int], dtype[integer[Any]]]) -> None:
58
58
  my[indexMy.indexMiniGap.value] = my[indexMy.gap1ndex.value]
59
59
 
60
- def initializeLeafConnectee(connectionGraph: ndarray[Tuple[int, int, int], dtype[integer[Any]]], my: ndarray[Tuple[int], dtype[integer[Any]]]) -> None:
60
+ def initializeLeafConnectee(connectionGraph: ndarray[tuple[int, int, int], dtype[integer[Any]]], my: ndarray[tuple[int], dtype[integer[Any]]]) -> None:
61
61
  my[indexMy.leafConnectee.value] = connectionGraph[my[indexMy.indexDimension.value], my[indexMy.leaf1ndex.value], my[indexMy.leaf1ndex.value]]
62
62
 
63
- def initializeVariablesToFindGaps(my: ndarray[Tuple[int], dtype[integer[Any]]], track: ndarray[Tuple[int, int], dtype[integer[Any]]]) -> None:
63
+ def initializeVariablesToFindGaps(my: ndarray[tuple[int], dtype[integer[Any]]], track: ndarray[tuple[int, int], dtype[integer[Any]]]) -> None:
64
64
  my[indexMy.dimensionsUnconstrained.value] = my[indexMy.dimensionsTotal.value]
65
65
  my[indexMy.gap1ndexCeiling.value] = track[indexTrack.gapRangeStart.value, my[indexMy.leaf1ndex.value] - 1]
66
66
  my[indexMy.indexDimension.value] = 0
67
67
 
68
- def insertUnconstrainedLeaf(gapsWhere: ndarray[Tuple[int], dtype[integer[Any]]], my: ndarray[Tuple[int], dtype[integer[Any]]]) -> None:
68
+ def insertUnconstrainedLeaf(gapsWhere: ndarray[tuple[int], dtype[integer[Any]]], my: ndarray[tuple[int], dtype[integer[Any]]]) -> None:
69
69
  my[indexMy.indexLeaf.value] = 0
70
70
  while my[indexMy.indexLeaf.value] < my[indexMy.leaf1ndex.value]:
71
71
  gapsWhere[my[indexMy.gap1ndexCeiling.value]] = my[indexMy.indexLeaf.value]
72
72
  my[indexMy.gap1ndexCeiling.value] += 1
73
73
  my[indexMy.indexLeaf.value] += 1
74
74
 
75
- def leafBelowSentinelIs1(track: ndarray[Tuple[int, int], dtype[integer[Any]]]) -> Any:
75
+ def leafBelowSentinelIs1(track: ndarray[tuple[int, int], dtype[integer[Any]]]) -> Any:
76
76
  return track[indexTrack.leafBelow.value, 0] == 1
77
77
 
78
- def loopingLeavesConnectedToActiveLeaf(my: ndarray[Tuple[int], dtype[integer[Any]]]) -> Any:
78
+ def loopingLeavesConnectedToActiveLeaf(my: ndarray[tuple[int], dtype[integer[Any]]]) -> Any:
79
79
  return my[indexMy.leafConnectee.value] != my[indexMy.leaf1ndex.value]
80
80
 
81
- def loopingToActiveGapCeiling(my: ndarray[Tuple[int], dtype[integer[Any]]]) -> Any:
81
+ def loopingToActiveGapCeiling(my: ndarray[tuple[int], dtype[integer[Any]]]) -> Any:
82
82
  return my[indexMy.indexMiniGap.value] < my[indexMy.gap1ndexCeiling.value]
83
83
 
84
- def loopUpToDimensionsTotal(my: ndarray[Tuple[int], dtype[integer[Any]]]) -> Any:
84
+ def loopUpToDimensionsTotal(my: ndarray[tuple[int], dtype[integer[Any]]]) -> Any:
85
85
  return my[indexMy.indexDimension.value] < my[indexMy.dimensionsTotal.value]
86
86
 
87
- def noGapsHere(my: ndarray[Tuple[int], dtype[integer[Any]]], track: ndarray[Tuple[int, int], dtype[integer[Any]]]) -> Any:
87
+ def noGapsHere(my: ndarray[tuple[int], dtype[integer[Any]]], track: ndarray[tuple[int, int], dtype[integer[Any]]]) -> Any:
88
88
  return my[indexMy.leaf1ndex.value] > 0 and my[indexMy.gap1ndex.value] == track[indexTrack.gapRangeStart.value, my[indexMy.leaf1ndex.value] - 1]
89
89
 
90
- def placeLeaf(gapsWhere: ndarray[Tuple[int], dtype[integer[Any]]], my: ndarray[Tuple[int], dtype[integer[Any]]], track: ndarray[Tuple[int, int], dtype[integer[Any]]]) -> None:
90
+ def placeLeaf(gapsWhere: ndarray[tuple[int], dtype[integer[Any]]], my: ndarray[tuple[int], dtype[integer[Any]]], track: ndarray[tuple[int, int], dtype[integer[Any]]]) -> None:
91
91
  my[indexMy.gap1ndex.value] -= 1
92
92
  track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]] = gapsWhere[my[indexMy.gap1ndex.value]]
93
93
  track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]] = track[indexTrack.leafBelow.value, track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]]
@@ -96,19 +96,19 @@ def placeLeaf(gapsWhere: ndarray[Tuple[int], dtype[integer[Any]]], my: ndarray[T
96
96
  track[indexTrack.gapRangeStart.value, my[indexMy.leaf1ndex.value]] = my[indexMy.gap1ndex.value]
97
97
  my[indexMy.leaf1ndex.value] += 1
98
98
 
99
- def thereIsAnActiveLeaf(my: ndarray[Tuple[int], dtype[integer[Any]]]) -> Any:
99
+ def thereIsAnActiveLeaf(my: ndarray[tuple[int], dtype[integer[Any]]]) -> Any:
100
100
  return my[indexMy.leaf1ndex.value] > 0
101
101
 
102
- def thisIsMyTaskIndex(my: ndarray[Tuple[int], dtype[integer[Any]]]) -> Any:
102
+ def thisIsMyTaskIndex(my: ndarray[tuple[int], dtype[integer[Any]]]) -> Any:
103
103
  return my[indexMy.leaf1ndex.value] != my[indexMy.taskDivisions.value] or my[indexMy.leafConnectee.value] % my[indexMy.taskDivisions.value] == my[indexMy.taskIndex.value]
104
104
 
105
- def updateLeafConnectee(connectionGraph: ndarray[Tuple[int, int, int], dtype[integer[Any]]], my: ndarray[Tuple[int], dtype[integer[Any]]], track: ndarray[Tuple[int, int], dtype[integer[Any]]]) -> None:
105
+ def updateLeafConnectee(connectionGraph: ndarray[tuple[int, int, int], dtype[integer[Any]]], my: ndarray[tuple[int], dtype[integer[Any]]], track: ndarray[tuple[int, int], dtype[integer[Any]]]) -> None:
106
106
  my[indexMy.leafConnectee.value] = connectionGraph[my[indexMy.indexDimension.value], my[indexMy.leaf1ndex.value], track[indexTrack.leafBelow.value, my[indexMy.leafConnectee.value]]]
107
107
 
108
- def countInitialize(connectionGraph: ndarray[Tuple[int, int, int], dtype[integer[Any]]]
109
- , gapsWhere: ndarray[Tuple[int] , dtype[integer[Any]]]
110
- , my: ndarray[Tuple[int] , dtype[integer[Any]]]
111
- , track: ndarray[Tuple[int, int] , dtype[integer[Any]]]
108
+ def countInitialize(connectionGraph: ndarray[tuple[int, int, int], dtype[integer[Any]]]
109
+ , gapsWhere: ndarray[tuple[int] , dtype[integer[Any]]]
110
+ , my: ndarray[tuple[int] , dtype[integer[Any]]]
111
+ , track: ndarray[tuple[int, int] , dtype[integer[Any]]]
112
112
  ) -> None:
113
113
 
114
114
  while activeLeafGreaterThan0(my=my):
@@ -134,11 +134,11 @@ def countInitialize(connectionGraph: ndarray[Tuple[int, int, int], dtype[integer
134
134
  if my[indexMy.gap1ndex.value] > 0:
135
135
  return
136
136
 
137
- def countParallel(connectionGraph: ndarray[Tuple[int, int, int], dtype[integer[Any]]]
138
- , foldGroups: ndarray[Tuple[int] , dtype[integer[Any]]]
139
- , gapsWhere: ndarray[Tuple[int] , dtype[integer[Any]]]
140
- , my: ndarray[Tuple[int] , dtype[integer[Any]]]
141
- , track: ndarray[Tuple[int, int] , dtype[integer[Any]]]
137
+ def countParallel(connectionGraph: ndarray[tuple[int, int, int], dtype[integer[Any]]]
138
+ , foldGroups: ndarray[tuple[int] , dtype[integer[Any]]]
139
+ , gapsWhere: ndarray[tuple[int] , dtype[integer[Any]]]
140
+ , my: ndarray[tuple[int] , dtype[integer[Any]]]
141
+ , track: ndarray[tuple[int, int] , dtype[integer[Any]]]
142
142
  ) -> None:
143
143
 
144
144
  gapsWherePARALLEL = gapsWhere.copy()
@@ -182,11 +182,11 @@ def countParallel(connectionGraph: ndarray[Tuple[int, int, int], dtype[integer[A
182
182
  placeLeaf(gapsWhere=gapsWhere, my=my, track=track)
183
183
  foldGroups[my[indexMy.taskIndex.value]] = groupsOfFolds
184
184
 
185
- def countSequential( connectionGraph: ndarray[Tuple[int, int, int], dtype[integer[Any]]]
186
- , foldGroups: ndarray[Tuple[int] , dtype[integer[Any]]]
187
- , gapsWhere: ndarray[Tuple[int] , dtype[integer[Any]]]
188
- , my: ndarray[Tuple[int] , dtype[integer[Any]]]
189
- , track: ndarray[Tuple[int, int] , dtype[integer[Any]]]
185
+ def countSequential( connectionGraph: ndarray[tuple[int, int, int], dtype[integer[Any]]]
186
+ , foldGroups: ndarray[tuple[int] , dtype[integer[Any]]]
187
+ , gapsWhere: ndarray[tuple[int] , dtype[integer[Any]]]
188
+ , my: ndarray[tuple[int] , dtype[integer[Any]]]
189
+ , track: ndarray[tuple[int, int] , dtype[integer[Any]]]
190
190
  ) -> None:
191
191
 
192
192
  groupsOfFolds: int = 0
@@ -216,12 +216,12 @@ def countSequential( connectionGraph: ndarray[Tuple[int, int, int], dtype[intege
216
216
  placeLeaf(gapsWhere=gapsWhere, my=my, track=track)
217
217
  foldGroups[my[indexMy.taskIndex.value]] = groupsOfFolds
218
218
 
219
- def doTheNeedful(connectionGraph: ndarray[Tuple[int, int, int], dtype[integer[Any]]]
220
- , foldGroups: ndarray[Tuple[int] , dtype[integer[Any]]]
221
- , gapsWhere: ndarray[Tuple[int] , dtype[integer[Any]]]
222
- , mapShape: ndarray[Tuple[int] , dtype[integer[Any]]]
223
- , my: ndarray[Tuple[int] , dtype[integer[Any]]]
224
- , track: ndarray[Tuple[int, int] , dtype[integer[Any]]]
219
+ def doTheNeedful(connectionGraph: ndarray[tuple[int, int, int], dtype[integer[Any]]]
220
+ , foldGroups: ndarray[tuple[int] , dtype[integer[Any]]]
221
+ , gapsWhere: ndarray[tuple[int] , dtype[integer[Any]]]
222
+ , mapShape: ndarray[tuple[int] , dtype[integer[Any]]]
223
+ , my: ndarray[tuple[int] , dtype[integer[Any]]]
224
+ , track: ndarray[tuple[int, int] , dtype[integer[Any]]]
225
225
  ) -> None:
226
226
 
227
227
  countInitialize(connectionGraph, gapsWhere, my, track)
mapFolding/theSSOT.py CHANGED
@@ -1,15 +1,16 @@
1
+ from collections.abc import Callable
1
2
  from mapFolding.theSSOTdatatypes import *
2
3
  from numba.core.compiler import CompilerBase as numbaCompilerBase
3
4
  from numpy import dtype, integer, ndarray
5
+ from pathlib import Path
6
+ from sys import modules as sysModules
4
7
  from types import ModuleType
5
- from typing import Any, Callable, Dict, Final, Tuple, TYPE_CHECKING, Union, cast
6
- import pathlib
7
- import sys
8
+ from typing import Any, Final, TYPE_CHECKING, cast
8
9
 
9
10
  try:
10
11
  from typing import NotRequired
11
- except ImportError:
12
- from typing_extensions import NotRequired
12
+ except Exception:
13
+ from typing_extensions import NotRequired # type: ignore
13
14
 
14
15
  if TYPE_CHECKING:
15
16
  from typing import TypedDict
@@ -31,23 +32,24 @@ myPackageNameIs = "mapFolding"
31
32
  moduleOfSyntheticModules = "syntheticModules"
32
33
  # TODO I'm not sure if this is the right tool for the job.
33
34
  formatFilenameModuleDEFAULT = "numba_{callableTarget}.py"
35
+ # TODO figure out how to implement this
34
36
  dispatcherCallableNameDEFAULT = "doTheNeedful"
35
37
 
36
- def getPathPackage() -> pathlib.Path:
38
+ def getPathPackage() -> Path:
37
39
  import importlib, inspect
38
- pathPackage = pathlib.Path(inspect.getfile(importlib.import_module(myPackageNameIs)))
40
+ pathPackage = Path(inspect.getfile(importlib.import_module(myPackageNameIs)))
39
41
  if pathPackage.is_file():
40
42
  pathPackage = pathPackage.parent
41
43
  return pathPackage
42
44
 
43
- def getPathJobRootDEFAULT() -> pathlib.Path:
44
- if 'google.colab' in sys.modules:
45
- pathJobDEFAULT = pathlib.Path("/content/drive/MyDrive") / "jobs"
45
+ def getPathJobRootDEFAULT() -> Path:
46
+ if 'google.colab' in sysModules:
47
+ pathJobDEFAULT = Path("/content/drive/MyDrive") / "jobs"
46
48
  else:
47
49
  pathJobDEFAULT = getPathPackage() / "jobs"
48
50
  return pathJobDEFAULT
49
51
 
50
- def getPathSyntheticModules() -> pathlib.Path:
52
+ def getPathSyntheticModules() -> Path:
51
53
  pathSyntheticModules = getPathPackage() / moduleOfSyntheticModules
52
54
  return pathSyntheticModules
53
55
 
@@ -65,12 +67,12 @@ def getDispatcherCallable() -> Callable[..., None]:
65
67
 
66
68
  # NOTE I want this _concept_, not necessarily this method, to be well implemented and usable everywhere: Python, Numba, Jax, CUDA, idc
67
69
  class computationState(TypedDict):
68
- connectionGraph: ndarray[Tuple[int, int, int], dtype[integer[Any]]]
69
- foldGroups: ndarray[Tuple[int] , dtype[integer[Any]]]
70
- gapsWhere: ndarray[Tuple[int] , dtype[integer[Any]]]
71
- mapShape: ndarray[Tuple[int] , dtype[integer[Any]]]
72
- my: ndarray[Tuple[int] , dtype[integer[Any]]]
73
- track: ndarray[Tuple[int, int] , dtype[integer[Any]]]
70
+ connectionGraph: ndarray[tuple[int, int, int], dtype[integer[Any]]]
71
+ foldGroups: ndarray[tuple[int] , dtype[integer[Any]]]
72
+ gapsWhere: ndarray[tuple[int] , dtype[integer[Any]]]
73
+ mapShape: ndarray[tuple[int] , dtype[integer[Any]]]
74
+ my: ndarray[tuple[int] , dtype[integer[Any]]]
75
+ track: ndarray[tuple[int, int] , dtype[integer[Any]]]
74
76
 
75
77
  _datatypeModuleScalar = 'numba'
76
78
  _decoratorCallable = 'jit'
@@ -110,7 +112,7 @@ class ParametersNumba(TypedDict):
110
112
  forceinline: bool
111
113
  forceobj: NotRequired[bool]
112
114
  inline: str
113
- locals: NotRequired[Dict[str, Any]]
115
+ locals: NotRequired[dict[str, Any]]
114
116
  looplift: bool
115
117
  no_cfunc_wrapper: bool
116
118
  no_cpython_wrapper: bool
@@ -118,8 +120,8 @@ class ParametersNumba(TypedDict):
118
120
  nogil: NotRequired[bool]
119
121
  nopython: bool
120
122
  parallel: bool
121
- pipeline_class: NotRequired[Type[numbaCompilerBase]]
122
- signature_or_function: NotRequired[Union[Any, Callable, str, Tuple]]
123
+ pipeline_class: NotRequired[type[numbaCompilerBase]]
124
+ signature_or_function: NotRequired[Any | Callable[..., Any] | str | tuple[Any, ...]]
123
125
  target: NotRequired[str]
124
126
 
125
127
  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, }
@@ -1,21 +1,9 @@
1
1
  from collections import defaultdict
2
- from typing import Any, cast, Dict, Final, Optional, Type, TYPE_CHECKING
2
+ from typing import Any, cast, Final
3
3
  import enum
4
- import sys
5
- import numba
6
- import numpy
4
+ import numba # type: ignore
5
+ import numpy # type: ignore
7
6
 
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
7
  class EnumIndices(enum.IntEnum):
20
8
  @staticmethod
21
9
  def _generate_next_value_(name: str, start: int, count: int, last_values: list[Any]) -> int:
@@ -48,17 +36,17 @@ class indexTrack(EnumIndices):
48
36
  countDimensionsGapped = enum.auto()
49
37
  gapRangeStart = enum.auto()
50
38
 
51
- _datatypeDefault: Final[Dict[str, str]] = {
39
+ _datatypeDefault: Final[dict[str, str]] = {
52
40
  'elephino': 'uint16',
53
41
  'foldsTotal': 'int64',
54
42
  'leavesTotal': 'uint16',
55
43
  }
56
- _datatypeModule = ''
44
+ _datatypeModule: str = ''
57
45
  _datatypeModuleDEFAULT: Final[str] = 'numpy'
58
46
 
59
- _datatype: Dict[str, str] = defaultdict(str)
47
+ _datatype: dict[str, str] = defaultdict(str)
60
48
 
61
- def reportDatatypeLimit(identifier: str, datatype: str, sourGrapes: Optional[bool] = False) -> str:
49
+ def reportDatatypeLimit(identifier: str, datatype: str, sourGrapes: bool | None = False) -> str:
62
50
  global _datatype
63
51
  if not _datatype[identifier]:
64
52
  _datatype[identifier] = datatype
@@ -68,7 +56,7 @@ def reportDatatypeLimit(identifier: str, datatype: str, sourGrapes: Optional[boo
68
56
  raise Exception(f"Datatype is '{_datatype[identifier]}' not '{datatype}', so you can take your ball and go home.")
69
57
  return _datatype[identifier]
70
58
 
71
- def setDatatypeModule(datatypeModule: str, sourGrapes: Optional[bool] = False) -> str:
59
+ def setDatatypeModule(datatypeModule: str, sourGrapes: bool | None = False) -> str:
72
60
  global _datatypeModule
73
61
  if not _datatypeModule:
74
62
  _datatypeModule = datatypeModule
@@ -78,13 +66,13 @@ def setDatatypeModule(datatypeModule: str, sourGrapes: Optional[bool] = False) -
78
66
  raise Exception(f"Datatype module is '{_datatypeModule}' not '{datatypeModule}', so you can take your ball and go home.")
79
67
  return _datatypeModule
80
68
 
81
- def setDatatypeElephino(datatype: str, sourGrapes: Optional[bool] = False) -> str:
69
+ def setDatatypeElephino(datatype: str, sourGrapes: bool | None = False) -> str:
82
70
  return reportDatatypeLimit('elephino', datatype, sourGrapes)
83
71
 
84
- def setDatatypeFoldsTotal(datatype: str, sourGrapes: Optional[bool] = False) -> str:
72
+ def setDatatypeFoldsTotal(datatype: str, sourGrapes: bool | None = False) -> str:
85
73
  return reportDatatypeLimit('foldsTotal', datatype, sourGrapes)
86
74
 
87
- def setDatatypeLeavesTotal(datatype: str, sourGrapes: Optional[bool] = False) -> str:
75
+ def setDatatypeLeavesTotal(datatype: str, sourGrapes: bool | None = False) -> str:
88
76
  return reportDatatypeLimit('leavesTotal', datatype, sourGrapes)
89
77
 
90
78
  def _get_datatype(identifier: str) -> str:
@@ -104,13 +92,13 @@ def getDatatypeModule() -> str:
104
92
  _datatypeModule = _datatypeModuleDEFAULT
105
93
  return _datatypeModule
106
94
 
107
- def setInStone(identifier: str) -> Type[Any]:
108
- datatypeModule = getDatatypeModule()
109
- datatypeStr = _get_datatype(identifier)
110
- return cast(Type[Any], getattr(eval(datatypeModule), datatypeStr))
95
+ def setInStone(identifier: str) -> type[Any]:
96
+ datatypeModule: str = getDatatypeModule()
97
+ datatypeStr: str = _get_datatype(identifier)
98
+ return cast(type[Any], getattr(eval(datatypeModule), datatypeStr))
111
99
 
112
- def hackSSOTdtype(identifier: str) -> Type[Any]:
113
- _hackSSOTdtype={
100
+ def hackSSOTdtype(identifier: str) -> type[Any]:
101
+ _hackSSOTdtype: dict[str, str]={
114
102
  'connectionGraph': 'dtypeLeavesTotal',
115
103
  'dtypeElephino': 'dtypeElephino',
116
104
  'dtypeFoldsTotal': 'dtypeFoldsTotal',
@@ -121,7 +109,7 @@ def hackSSOTdtype(identifier: str) -> Type[Any]:
121
109
  'my': 'dtypeElephino',
122
110
  'track': 'dtypeElephino',
123
111
  }
124
- RubeGoldBerg = _hackSSOTdtype[identifier]
112
+ RubeGoldBerg: str = _hackSSOTdtype[identifier]
125
113
  if RubeGoldBerg == 'dtypeElephino':
126
114
  return setInStone('elephino')
127
115
  elif RubeGoldBerg == 'dtypeFoldsTotal':
@@ -131,7 +119,7 @@ def hackSSOTdtype(identifier: str) -> Type[Any]:
131
119
  raise Exception("Dude, you forgot to set a value in `hackSSOTdtype`.")
132
120
 
133
121
  def hackSSOTdatatype(identifier: str) -> str:
134
- _hackSSOTdatatype={
122
+ _hackSSOTdatatype: dict[str, str]={
135
123
  'connectionGraph': 'datatypeLeavesTotal',
136
124
  'countDimensionsGapped': 'datatypeLeavesTotal',
137
125
  'datatypeElephino': 'datatypeElephino',
@@ -158,7 +146,7 @@ def hackSSOTdatatype(identifier: str) -> str:
158
146
  'taskIndex': 'datatypeLeavesTotal',
159
147
  'track': 'datatypeElephino',
160
148
  }
161
- RubeGoldBerg = _hackSSOTdatatype[identifier]
149
+ RubeGoldBerg: str = _hackSSOTdatatype[identifier]
162
150
  if RubeGoldBerg == 'datatypeElephino':
163
151
  return _get_datatype('elephino')
164
152
  elif RubeGoldBerg == 'datatypeFoldsTotal':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mapFolding
3
- Version: 0.4.3
3
+ Version: 0.5.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
@@ -33,12 +33,14 @@ Requires-Dist: numpy
33
33
  Requires-Dist: Z0Z_tools
34
34
  Provides-Extra: testing
35
35
  Requires-Dist: autoflake; extra == "testing"
36
+ Requires-Dist: mypy; extra == "testing"
36
37
  Requires-Dist: more_itertools; extra == "testing"
37
38
  Requires-Dist: pytest-cov; extra == "testing"
38
39
  Requires-Dist: pytest-env; extra == "testing"
39
40
  Requires-Dist: pytest-xdist; extra == "testing"
40
41
  Requires-Dist: pytest; extra == "testing"
41
42
  Requires-Dist: python_minifier; extra == "testing"
43
+ Requires-Dist: pyupgrade; extra == "testing"
42
44
  Requires-Dist: updateCitation; extra == "testing"
43
45
 
44
46
  # mapFolding: Algorithms for enumerating distinct map/stamp folding patterns 🗺️
@@ -0,0 +1,14 @@
1
+ mapFolding/__init__.py,sha256=FmpYlbGIZ4Pkt5Qr49JRBWdPRX9be4dYNlEV1ZXkmKU,2620
2
+ mapFolding/basecamp.py,sha256=eU-9XQ9aOpgOcpVSTlbQ_XZEYsmfx1h6gESTgvP3RrI,3707
3
+ mapFolding/beDRY.py,sha256=_NswGMIkF77akOSEJQqbOQOMwwrAL0c9yJi5bTZUBzw,17027
4
+ mapFolding/oeis.py,sha256=ekXTb5P2GUkVgVsxWb23nukl8Pg97kdyU3-pePq7EQA,11393
5
+ mapFolding/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ mapFolding/theDao.py,sha256=64dlLhrdtNbZAXMbqcZhGAE0ZwgqYRt8nT1on46J-cc,12611
7
+ mapFolding/theSSOT.py,sha256=u7VXbqGasrTomxI771bQ7kURMpfn_ph6Y8ac8Rf70hw,5866
8
+ mapFolding/theSSOTdatatypes.py,sha256=-p9B5ikWPKqztnmDDg6NKAdys7qwiNU2c1oCbGXAf5Q,5714
9
+ mapFolding-0.5.1.dist-info/LICENSE,sha256=NxH5Y8BdC-gNU-WSMwim3uMbID2iNDXJz7fHtuTdXhk,19346
10
+ mapFolding-0.5.1.dist-info/METADATA,sha256=UJsh0vVsMCGhX3ORFIrrVCLSQDDGJeGC_QrUjJeKpB4,7718
11
+ mapFolding-0.5.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
12
+ mapFolding-0.5.1.dist-info/entry_points.txt,sha256=F3OUeZR1XDTpoH7k3wXuRb3KF_kXTTeYhu5AGK1SiOQ,146
13
+ mapFolding-0.5.1.dist-info/top_level.txt,sha256=aG3bjFBoxxuaV3Iu1wZAd241Ubs3cdaJtKYBQBDIjsg,11
14
+ mapFolding-0.5.1.dist-info/RECORD,,