mapFolding 0.16.2__py3-none-any.whl → 0.17.0__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 (80) hide show
  1. easyRun/A000682.py +2 -2
  2. easyRun/NOTcountingFolds.py +16 -8
  3. easyRun/countFolds.py +9 -2
  4. easyRun/generateAllModules.py +14 -0
  5. easyRun/meanders.py +4 -4
  6. mapFolding/__init__.py +1 -0
  7. mapFolding/_theSSOT.py +3 -2
  8. mapFolding/_theTypes.py +3 -0
  9. mapFolding/algorithms/A000136constraintPropagation.py +95 -0
  10. mapFolding/algorithms/A000136elimination.py +163 -0
  11. mapFolding/algorithms/A000136eliminationParallel.py +77 -0
  12. mapFolding/algorithms/A086345.py +75 -0
  13. mapFolding/algorithms/matrixMeanders.py +59 -18
  14. mapFolding/algorithms/matrixMeandersNumPyndas.py +841 -0
  15. mapFolding/algorithms/oeisIDbyFormula.py +2 -2
  16. mapFolding/algorithms/symmetricFolds.py +35 -0
  17. mapFolding/basecamp.py +100 -153
  18. mapFolding/dataBaskets.py +142 -65
  19. mapFolding/filesystemToolkit.py +4 -32
  20. mapFolding/oeis.py +5 -12
  21. mapFolding/reference/A086345Wu.py +25 -0
  22. mapFolding/reference/irvineJavaPort.py +3 -3
  23. mapFolding/reference/matrixMeandersAnalysis/signatures.py +3 -0
  24. mapFolding/reference/meandersDumpingGround/matrixMeandersNumPyV1finalForm.py +1 -1
  25. mapFolding/someAssemblyRequired/A007822/A007822rawMaterials.py +10 -45
  26. mapFolding/someAssemblyRequired/A007822/_asynchronousAnnex.py +51 -0
  27. mapFolding/someAssemblyRequired/A007822/makeA007822AsynchronousModules.py +39 -196
  28. mapFolding/someAssemblyRequired/A007822/makeA007822Modules.py +57 -43
  29. mapFolding/someAssemblyRequired/RecipeJob.py +84 -34
  30. mapFolding/someAssemblyRequired/__init__.py +4 -8
  31. mapFolding/someAssemblyRequired/_toolkitContainers.py +38 -7
  32. mapFolding/someAssemblyRequired/infoBooth.py +41 -23
  33. mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +140 -164
  34. mapFolding/someAssemblyRequired/makeJobTheorem2codon.py +63 -96
  35. mapFolding/someAssemblyRequired/makingModules_count.py +26 -30
  36. mapFolding/someAssemblyRequired/makingModules_doTheNeedful.py +10 -72
  37. mapFolding/someAssemblyRequired/{mapFolding → mapFoldingModules}/makeMapFoldingModules.py +30 -35
  38. mapFolding/someAssemblyRequired/meanders/makeMeandersModules.py +13 -11
  39. mapFolding/someAssemblyRequired/toolkitMakeModules.py +5 -31
  40. mapFolding/someAssemblyRequired/toolkitNumba.py +3 -2
  41. mapFolding/someAssemblyRequired/transformationTools.py +12 -15
  42. mapFolding/syntheticModules/A007822/algorithm.py +45 -50
  43. mapFolding/syntheticModules/A007822/asynchronous.py +92 -36
  44. mapFolding/syntheticModules/A007822/initializeState.py +19 -23
  45. mapFolding/syntheticModules/A007822/theorem2.py +20 -24
  46. mapFolding/syntheticModules/A007822/theorem2Numba.py +23 -25
  47. mapFolding/syntheticModules/A007822/theorem2Trimmed.py +19 -23
  48. mapFolding/syntheticModules/countParallelNumba.py +1 -2
  49. mapFolding/syntheticModules/daoOfMapFoldingNumba.py +5 -4
  50. mapFolding/syntheticModules/initializeState.py +1 -1
  51. mapFolding/syntheticModules/meanders/bigInt.py +59 -22
  52. mapFolding/syntheticModules/theorem2.py +1 -1
  53. mapFolding/syntheticModules/theorem2Numba.py +30 -9
  54. mapFolding/syntheticModules/theorem2Trimmed.py +2 -2
  55. mapFolding/tests/test_computations.py +29 -3
  56. {mapfolding-0.16.2.dist-info → mapfolding-0.17.0.dist-info}/METADATA +11 -8
  57. mapfolding-0.17.0.dist-info/RECORD +107 -0
  58. mapFolding/_dataPacking.py +0 -68
  59. mapFolding/algorithms/matrixMeandersBeDry.py +0 -182
  60. mapFolding/algorithms/matrixMeandersNumPy.py +0 -333
  61. mapFolding/algorithms/matrixMeandersPandas.py +0 -334
  62. mapFolding/reference/meandersDumpingGround/A005316intOptimized.py +0 -122
  63. mapFolding/reference/meandersDumpingGround/A005316optimized128bit.py +0 -79
  64. mapFolding/reference/meandersDumpingGround/matrixMeandersBaseline.py +0 -65
  65. mapFolding/reference/meandersDumpingGround/matrixMeandersBaselineAnnex.py +0 -84
  66. mapFolding/reference/meandersDumpingGround/matrixMeandersSimpleQueue.py +0 -90
  67. mapFolding/syntheticModules/A007822/algorithmNumba.py +0 -94
  68. mapFolding/syntheticModules/A007822/asynchronousAnnex.py +0 -66
  69. mapFolding/syntheticModules/A007822/asynchronousAnnexNumba.py +0 -70
  70. mapFolding/syntheticModules/A007822/asynchronousNumba.py +0 -79
  71. mapFolding/syntheticModules/A007822/asynchronousTheorem2.py +0 -65
  72. mapFolding/syntheticModules/A007822/asynchronousTrimmed.py +0 -56
  73. mapFolding/syntheticModules/dataPacking.py +0 -26
  74. mapFolding/syntheticModules/dataPackingA007822.py +0 -92
  75. mapfolding-0.16.2.dist-info/RECORD +0 -115
  76. /mapFolding/someAssemblyRequired/{mapFolding → mapFoldingModules}/__init__.py +0 -0
  77. {mapfolding-0.16.2.dist-info → mapfolding-0.17.0.dist-info}/WHEEL +0 -0
  78. {mapfolding-0.16.2.dist-info → mapfolding-0.17.0.dist-info}/entry_points.txt +0 -0
  79. {mapfolding-0.16.2.dist-info → mapfolding-0.17.0.dist-info}/licenses/LICENSE +0 -0
  80. {mapfolding-0.16.2.dist-info → mapfolding-0.17.0.dist-info}/top_level.txt +0 -0
@@ -1,43 +1,79 @@
1
- from mapFolding.algorithms.matrixMeandersBeDry import (areIntegersWide,
2
- walkDyckPath)
3
- from mapFolding.dataBaskets import MatrixMeandersNumPyState
1
+ from functools import cache
2
+ from mapFolding.algorithms.matrixMeandersNumPyndas import areIntegersWide, MatrixMeandersNumPyState
4
3
 
4
+ @cache
5
+ def walkDyckPath(intWithExtra_0b1: int) -> int:
6
+ """Find the bit position for flipping paired curve endpoints in meander transfer matrices.
7
+
8
+ Parameters
9
+ ----------
10
+ intWithExtra_0b1 : int
11
+ Binary representation of curve locations with an extra bit encoding parity information.
12
+
13
+ Returns
14
+ -------
15
+ flipExtra_0b1_Here : int
16
+ Bit mask indicating the position where the balance condition fails, formatted as 2^(2k).
17
+
18
+ 3L33T H@X0R
19
+ ------------
20
+ Binary search for first negative balance in shifted bit pairs. Returns 2^(2k) mask for
21
+ bit position k where cumulative balance counter transitions from non-negative to negative.
22
+
23
+ Mathematics
24
+ -----------
25
+ Implements the Dyck path balance verification algorithm from Jensen's transfer matrix
26
+ enumeration. Computes the position where ∑(i=0 to k) (-1)^b_i < 0 for the first time,
27
+ where b_i are the bits of the input at positions 2i.
28
+
29
+ """
30
+ findTheExtra_0b1: int = 0
31
+ flipExtra_0b1_Here: int = 1
32
+ while True:
33
+ flipExtra_0b1_Here <<= 2
34
+ if intWithExtra_0b1 & flipExtra_0b1_Here == 0:
35
+ findTheExtra_0b1 += 1
36
+ else:
37
+ findTheExtra_0b1 -= 1
38
+ if findTheExtra_0b1 < 0:
39
+ break
40
+ return flipExtra_0b1_Here
5
41
 
6
42
  def countBigInt(state: MatrixMeandersNumPyState) -> MatrixMeandersNumPyState:
7
43
  """Count meanders with matrix transfer algorithm using Python `int` (*int*eger) contained in a Python `dict` (*dict*ionary).
8
44
 
9
- Parameters
10
- ----------
11
- state : MatrixMeandersState
12
- The algorithm state.
45
+ Parameters
46
+ ----------
47
+ state : MatrixMeandersState
48
+ The algorithm state.
13
49
 
14
- Notes
15
- -----
16
- The matrix transfer algorithm is sophisticated, but this implementation is straightforward: compute each index one at a time,
17
- compute each `arcCode` one at a time, and compute each type of analysis one at a time.
18
- """
50
+ Notes
51
+ -----
52
+ The matrix transfer algorithm is sophisticated, but this implementation is straightforward: compute each `boundary` one at a
53
+ time, compute each `arcCode` one at a time, and compute each type of analysis one at a time.
54
+ """
19
55
  dictionaryArcCodeToCrossings: dict[int, int] = {}
20
56
  while state.boundary > 0 and areIntegersWide(state):
21
- state.boundary -= 1
22
- state.bitWidth = max(state.dictionaryMeanders.keys()).bit_length()
57
+ state.reduceBoundary()
23
58
  dictionaryArcCodeToCrossings = state.dictionaryMeanders.copy()
24
59
  state.dictionaryMeanders = {}
25
- for arcCode, crossings in dictionaryArcCodeToCrossings.items():
26
- bitsAlpha: int = arcCode & state.locatorBits
27
- bitsZulu: int = arcCode >> 1 & state.locatorBits
60
+
61
+ def analyzeArcCode(arcCode: int, crossings: int) -> None:
62
+ bitsAlpha: int = arcCode & state.bitsLocator
28
63
  bitsAlphaHasArcs: bool = bitsAlpha > 1
29
- bitsZuluHasArcs: bool = bitsZulu > 1
30
64
  bitsAlphaIsEven: int = bitsAlpha & 1 ^ 1
65
+ bitsZulu: int = arcCode >> 1 & state.bitsLocator
66
+ bitsZuluHasArcs: bool = bitsZulu > 1
31
67
  bitsZuluIsEven: int = bitsZulu & 1 ^ 1
32
- arcCodeAnalysis = (bitsAlpha | bitsZulu << 1) << 2 | 3
68
+ arcCodeAnalysis: int = (bitsZulu << 1 | bitsAlpha) << 2 | 3
33
69
  if arcCodeAnalysis < state.MAXIMUMarcCode:
34
70
  state.dictionaryMeanders[arcCodeAnalysis] = state.dictionaryMeanders.get(arcCodeAnalysis, 0) + crossings
35
71
  if bitsAlphaHasArcs:
36
- arcCodeAnalysis = bitsAlpha >> 2 | bitsZulu << 3 | bitsAlphaIsEven << 1
72
+ arcCodeAnalysis = bitsAlphaIsEven << 1 | bitsAlpha >> 2 | bitsZulu << 3
37
73
  if arcCodeAnalysis < state.MAXIMUMarcCode:
38
74
  state.dictionaryMeanders[arcCodeAnalysis] = state.dictionaryMeanders.get(arcCodeAnalysis, 0) + crossings
39
75
  if bitsZuluHasArcs:
40
- arcCodeAnalysis = bitsZulu >> 1 | bitsAlpha << 2 | bitsZuluIsEven
76
+ arcCodeAnalysis = bitsZuluIsEven | bitsAlpha << 2 | bitsZulu >> 1
41
77
  if arcCodeAnalysis < state.MAXIMUMarcCode:
42
78
  state.dictionaryMeanders[arcCodeAnalysis] = state.dictionaryMeanders.get(arcCodeAnalysis, 0) + crossings
43
79
  if bitsAlphaHasArcs and bitsZuluHasArcs and (bitsAlphaIsEven or bitsZuluIsEven):
@@ -45,8 +81,9 @@ def countBigInt(state: MatrixMeandersNumPyState) -> MatrixMeandersNumPyState:
45
81
  bitsAlpha ^= walkDyckPath(bitsAlpha)
46
82
  elif bitsZuluIsEven and (not bitsAlphaIsEven):
47
83
  bitsZulu ^= walkDyckPath(bitsZulu)
48
- arcCodeAnalysis: int = bitsZulu >> 2 << 1 | bitsAlpha >> 2
84
+ arcCodeAnalysis = (bitsZulu >> 2 << 3 | bitsAlpha) >> 2
49
85
  if arcCodeAnalysis < state.MAXIMUMarcCode:
50
86
  state.dictionaryMeanders[arcCodeAnalysis] = state.dictionaryMeanders.get(arcCodeAnalysis, 0) + crossings
87
+ set(map(analyzeArcCode, dictionaryArcCodeToCrossings.keys(), dictionaryArcCodeToCrossings.values()))
51
88
  dictionaryArcCodeToCrossings = {}
52
89
  return state
@@ -53,4 +53,4 @@ def count(state: MapFoldingState) -> MapFoldingState:
53
53
  def doTheNeedful(state: MapFoldingState) -> MapFoldingState:
54
54
  state = transitionOnGroupsOfFolds(state)
55
55
  state = count(state)
56
- return state
56
+ return state
@@ -1,8 +1,11 @@
1
- from mapFolding.dataBaskets import Array1DElephino, Array1DLeavesTotal, Array3DLeavesTotal, DatatypeElephino, DatatypeFoldsTotal, DatatypeLeavesTotal
1
+ from mapFolding.dataBaskets import (
2
+ Array1DElephino, Array1DLeavesTotal, Array3DLeavesTotal, DatatypeElephino, DatatypeFoldsTotal, DatatypeLeavesTotal,
3
+ MapFoldingState)
4
+ from mapFolding.syntheticModules.initializeState import transitionOnGroupsOfFolds
2
5
  from numba import jit
3
6
 
4
7
  @jit(cache=True, error_model='numpy', fastmath=True, forceinline=True)
5
- def count(groupsOfFolds: DatatypeFoldsTotal, gap1ndex: DatatypeElephino, gap1ndexCeiling: DatatypeElephino, indexDimension: DatatypeLeavesTotal, indexLeaf: DatatypeLeavesTotal, indexMiniGap: DatatypeElephino, leaf1ndex: DatatypeLeavesTotal, leafConnectee: DatatypeLeavesTotal, dimensionsUnconstrained: DatatypeLeavesTotal, countDimensionsGapped: Array1DLeavesTotal, gapRangeStart: Array1DElephino, gapsWhere: Array1DLeavesTotal, leafAbove: Array1DLeavesTotal, leafBelow: Array1DLeavesTotal, connectionGraph: Array3DLeavesTotal, dimensionsTotal: DatatypeLeavesTotal, leavesTotal: DatatypeLeavesTotal) -> tuple[DatatypeFoldsTotal, DatatypeElephino, DatatypeElephino, DatatypeLeavesTotal, DatatypeLeavesTotal, DatatypeElephino, DatatypeLeavesTotal, DatatypeLeavesTotal, DatatypeLeavesTotal, Array1DLeavesTotal, Array1DElephino, Array1DLeavesTotal, Array1DLeavesTotal, Array1DLeavesTotal, Array3DLeavesTotal, DatatypeLeavesTotal, DatatypeLeavesTotal]:
8
+ def count(groupsOfFolds: DatatypeFoldsTotal, gap1ndex: DatatypeElephino, gap1ndexCeiling: DatatypeElephino, indexDimension: DatatypeLeavesTotal, indexMiniGap: DatatypeElephino, leaf1ndex: DatatypeLeavesTotal, leafConnectee: DatatypeLeavesTotal, dimensionsUnconstrained: DatatypeLeavesTotal, countDimensionsGapped: Array1DLeavesTotal, gapRangeStart: Array1DElephino, gapsWhere: Array1DLeavesTotal, leafAbove: Array1DLeavesTotal, leafBelow: Array1DLeavesTotal, connectionGraph: Array3DLeavesTotal, dimensionsTotal: DatatypeLeavesTotal, leavesTotal: DatatypeLeavesTotal) -> tuple[DatatypeFoldsTotal, DatatypeElephino, DatatypeElephino, DatatypeLeavesTotal, DatatypeElephino, DatatypeLeavesTotal, DatatypeLeavesTotal, DatatypeLeavesTotal, Array1DLeavesTotal, Array1DElephino, Array1DLeavesTotal, Array1DLeavesTotal, Array1DLeavesTotal, Array3DLeavesTotal, DatatypeLeavesTotal, DatatypeLeavesTotal]:
6
9
  while leaf1ndex > 4:
7
10
  if leafBelow[0] == 1:
8
11
  if leaf1ndex > leavesTotal:
@@ -23,12 +26,6 @@ def count(groupsOfFolds: DatatypeFoldsTotal, gap1ndex: DatatypeElephino, gap1nde
23
26
  countDimensionsGapped[leafConnectee] += 1
24
27
  leafConnectee = connectionGraph[indexDimension, leaf1ndex, leafBelow[leafConnectee]]
25
28
  indexDimension += 1
26
- if not dimensionsUnconstrained:
27
- indexLeaf = 0
28
- while indexLeaf < leaf1ndex:
29
- gapsWhere[gap1ndexCeiling] = indexLeaf
30
- gap1ndexCeiling += 1
31
- indexLeaf += 1
32
29
  indexMiniGap = gap1ndex
33
30
  while indexMiniGap < gap1ndexCeiling:
34
31
  gapsWhere[gap1ndex] = gapsWhere[indexMiniGap]
@@ -49,4 +46,28 @@ def count(groupsOfFolds: DatatypeFoldsTotal, gap1ndex: DatatypeElephino, gap1nde
49
46
  leaf1ndex += 1
50
47
  else:
51
48
  groupsOfFolds *= 2
52
- return (groupsOfFolds, gap1ndex, gap1ndexCeiling, indexDimension, indexLeaf, indexMiniGap, leaf1ndex, leafConnectee, dimensionsUnconstrained, countDimensionsGapped, gapRangeStart, gapsWhere, leafAbove, leafBelow, connectionGraph, dimensionsTotal, leavesTotal)
49
+ return (groupsOfFolds, gap1ndex, gap1ndexCeiling, indexDimension, indexMiniGap, leaf1ndex, leafConnectee, dimensionsUnconstrained, countDimensionsGapped, gapRangeStart, gapsWhere, leafAbove, leafBelow, connectionGraph, dimensionsTotal, leavesTotal)
50
+
51
+ def doTheNeedful(state: MapFoldingState) -> MapFoldingState:
52
+ state = transitionOnGroupsOfFolds(state)
53
+ mapShape: tuple[DatatypeLeavesTotal, ...] = state.mapShape
54
+ groupsOfFolds: DatatypeFoldsTotal = state.groupsOfFolds
55
+ gap1ndex: DatatypeElephino = state.gap1ndex
56
+ gap1ndexCeiling: DatatypeElephino = state.gap1ndexCeiling
57
+ indexDimension: DatatypeLeavesTotal = state.indexDimension
58
+ indexLeaf: DatatypeLeavesTotal = state.indexLeaf
59
+ indexMiniGap: DatatypeElephino = state.indexMiniGap
60
+ leaf1ndex: DatatypeLeavesTotal = state.leaf1ndex
61
+ leafConnectee: DatatypeLeavesTotal = state.leafConnectee
62
+ dimensionsUnconstrained: DatatypeLeavesTotal = state.dimensionsUnconstrained
63
+ countDimensionsGapped: Array1DLeavesTotal = state.countDimensionsGapped
64
+ gapRangeStart: Array1DElephino = state.gapRangeStart
65
+ gapsWhere: Array1DLeavesTotal = state.gapsWhere
66
+ leafAbove: Array1DLeavesTotal = state.leafAbove
67
+ leafBelow: Array1DLeavesTotal = state.leafBelow
68
+ connectionGraph: Array3DLeavesTotal = state.connectionGraph
69
+ dimensionsTotal: DatatypeLeavesTotal = state.dimensionsTotal
70
+ leavesTotal: DatatypeLeavesTotal = state.leavesTotal
71
+ groupsOfFolds, gap1ndex, gap1ndexCeiling, indexDimension, indexMiniGap, leaf1ndex, leafConnectee, dimensionsUnconstrained, countDimensionsGapped, gapRangeStart, gapsWhere, leafAbove, leafBelow, connectionGraph, dimensionsTotal, leavesTotal = count(groupsOfFolds, gap1ndex, gap1ndexCeiling, indexDimension, indexMiniGap, leaf1ndex, leafConnectee, dimensionsUnconstrained, countDimensionsGapped, gapRangeStart, gapsWhere, leafAbove, leafBelow, connectionGraph, dimensionsTotal, leavesTotal)
72
+ state = MapFoldingState(mapShape=mapShape, groupsOfFolds=groupsOfFolds, gap1ndex=gap1ndex, gap1ndexCeiling=gap1ndexCeiling, indexDimension=indexDimension, indexLeaf=indexLeaf, indexMiniGap=indexMiniGap, leaf1ndex=leaf1ndex, leafConnectee=leafConnectee, dimensionsUnconstrained=dimensionsUnconstrained, countDimensionsGapped=countDimensionsGapped, gapRangeStart=gapRangeStart, gapsWhere=gapsWhere, leafAbove=leafAbove, leafBelow=leafBelow)
73
+ return state
@@ -44,7 +44,7 @@ def count(state: MapFoldingState) -> MapFoldingState:
44
44
  state.groupsOfFolds *= 2
45
45
  return state
46
46
 
47
- def doTheNeedful(state: MapFoldingState, /) -> MapFoldingState:
47
+ def doTheNeedful(state: MapFoldingState) -> MapFoldingState:
48
48
  state = transitionOnGroupsOfFolds(state)
49
49
  state = count(state)
50
- return state
50
+ return state
@@ -32,15 +32,41 @@ from mapFolding.someAssemblyRequired.RecipeJob import RecipeJobTheorem2
32
32
  from mapFolding.someAssemblyRequired.toolkitNumba import parametersNumbaLight
33
33
  from mapFolding.syntheticModules.initializeState import transitionOnGroupsOfFolds
34
34
  from mapFolding.tests.conftest import registrarRecordsTemporaryFilesystemObject, standardizedEqualToCallableReturn
35
+ from numba.core.errors import NumbaPendingDeprecationWarning
35
36
  from pathlib import Path, PurePosixPath
36
37
  import importlib.util
37
38
  import multiprocessing
38
39
  import pytest
40
+ import warnings
39
41
 
40
42
  if __name__ == '__main__':
41
43
  multiprocessing.set_start_method('spawn')
42
44
 
43
- @pytest.mark.parametrize('flow', ['algorithm', 'asynchronous', 'asynchronousTheorem2', 'asynchronousTrimmed', 'numba', 'theorem2', 'theorem2Numba', 'theorem2Trimmed'])
45
+ @pytest.mark.parametrize('flow', ['elimination', 'eliminationParallel'])#, 'constraintPropagation']) # ortools requires pandas, which doesn't have Py 3.14 yet.
46
+ def test_A000136(flow: str) -> None:
47
+ """Test A000136 flow options.
48
+
49
+ Parameters
50
+ ----------
51
+ flow : str
52
+ The computational flow algorithm to validate.
53
+
54
+ """
55
+ oeisID = 'A000136'
56
+ CPUlimit = .5
57
+ oeis_n = 2
58
+ for oeis_n in dictionaryOEISMapFolding[oeisID]['valuesTestValidation']:
59
+ if oeis_n < 2:
60
+ continue
61
+
62
+ expected = dictionaryOEISMapFolding[oeisID]['valuesKnown'][oeis_n]
63
+
64
+ standardizedEqualToCallableReturn(
65
+ expected
66
+ , NOTcountingFolds, oeisID, oeis_n, flow, CPUlimit
67
+ )
68
+
69
+ @pytest.mark.parametrize('flow', ['algorithm', 'asynchronous', 'theorem2', 'theorem2Numba', 'theorem2Trimmed'])
44
70
  def test_A007822(flow: str) -> None:
45
71
  """Test A007822 flow options.
46
72
 
@@ -52,7 +78,7 @@ def test_A007822(flow: str) -> None:
52
78
  """
53
79
  oeisID = 'A007822'
54
80
  CPUlimit = .5
55
-
81
+ warnings.filterwarnings('ignore', category=NumbaPendingDeprecationWarning)
56
82
  oeis_n = 2
57
83
  for oeis_n in dictionaryOEIS[oeisID]['valuesTestValidation']:
58
84
  if oeis_n < 2:
@@ -88,7 +114,7 @@ def test_countFolds(mapShapeTestCountFolds: tuple[int, ...], flow: str) -> None:
88
114
  """
89
115
  standardizedEqualToCallableReturn(getFoldsTotalKnown(mapShapeTestCountFolds), countFolds, None, None, None, None, mapShapeTestCountFolds, flow)
90
116
 
91
- @pytest.mark.parametrize('flow', ['matrixNumPy', 'matrixPandas'])
117
+ @pytest.mark.parametrize('flow', ['matrixMeanders', 'matrixNumPy', 'matrixPandas'])
92
118
  def test_meanders(oeisIDmeanders: str, flow: str) -> None:
93
119
  """Verify Meanders OEIS sequence value calculations against known reference values.
94
120
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapFolding
3
- Version: 0.16.2
3
+ Version: 0.17.0
4
4
  Summary: Map folding, meanders, stamp folding, semi-meanders. Experiment with algorithm transformations, and analyze computational states.
5
5
  Author-email: Hunter Hogan <HunterHogan@pm.me>
6
6
  License: CC-BY-NC-4.0
@@ -31,36 +31,39 @@ Classifier: Topic :: Software Development :: Compilers
31
31
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
32
32
  Classifier: Topic :: Software Development :: Pre-processors
33
33
  Classifier: Typing :: Typed
34
- Requires-Python: >=3.12
34
+ Requires-Python: <3.14,>=3.12
35
35
  Description-Content-Type: text/markdown
36
36
  License-File: LICENSE
37
- Requires-Dist: astToolkit
38
- Requires-Dist: autoflake
39
- Requires-Dist: hunterMakesPy
40
- Requires-Dist: isort
37
+ Requires-Dist: astToolkit>=0.9.0
38
+ Requires-Dist: hunterMakesPy>=0.3.0
41
39
  Requires-Dist: numpy
42
40
  Requires-Dist: platformdirs
43
41
  Provides-Extra: development
42
+ Requires-Dist: ipykernel; extra == "development"
43
+ Requires-Dist: ipywidgets; extra == "development"
44
44
  Requires-Dist: memray; sys_platform == "linux" and extra == "development"
45
- Requires-Dist: mypy; extra == "development"
46
- Requires-Dist: pyupgrade; extra == "development"
47
45
  Requires-Dist: py-spy; extra == "development"
48
46
  Requires-Dist: setuptools-scm; extra == "development"
49
47
  Provides-Extra: numba
50
48
  Requires-Dist: numba; extra == "numba"
51
49
  Requires-Dist: numba_progress; extra == "numba"
52
50
  Provides-Extra: pandas
51
+ Requires-Dist: ortools; extra == "pandas"
53
52
  Requires-Dist: pandas; extra == "pandas"
54
53
  Requires-Dist: pyarrow; extra == "pandas"
55
54
  Requires-Dist: pyarrow-stubs; extra == "pandas"
55
+ Provides-Extra: sympy
56
+ Requires-Dist: sympy; extra == "sympy"
56
57
  Provides-Extra: testing
57
58
  Requires-Dist: numba; extra == "testing"
59
+ Requires-Dist: ortools; extra == "testing"
58
60
  Requires-Dist: pandas; extra == "testing"
59
61
  Requires-Dist: pyarrow; extra == "testing"
60
62
  Requires-Dist: pytest-cov; extra == "testing"
61
63
  Requires-Dist: pytest-env; extra == "testing"
62
64
  Requires-Dist: pytest-xdist; extra == "testing"
63
65
  Requires-Dist: pytest; extra == "testing"
66
+ Requires-Dist: sympy; extra == "testing"
64
67
  Dynamic: license-file
65
68
 
66
69
  # mapFolding
@@ -0,0 +1,107 @@
1
+ easyRun/A000682.py,sha256=VhzR_7ZqEkbDGug0AvW_TqS9W6a3t-ws572DqjZ_mqI,700
2
+ easyRun/A005316.py,sha256=WCIqsNSevjgUSnTe24d6zWKLZnJSoy14piSt6G26WuE,434
3
+ easyRun/NOTcountingFolds.py,sha256=da9U8q_D_YL94mLhlVSBjdKyKABzbi9nOw-oTeKh9O8,1161
4
+ easyRun/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ easyRun/countFolds.py,sha256=LF36qsSMvc9RwzE969kQrGHctRf3mMuCxBkjy-sn-q4,1461
6
+ easyRun/generateAllModules.py,sha256=xsXFs0BwQ_O5m5rqMjhgMOZ3lj9ssmc3Qdxazp7_uAI,622
7
+ easyRun/meanders.py,sha256=Npcq5RL7WR6mFEZYlHLaUzedULbQxkGT8i7ydbH8DCA,1827
8
+ mapFolding/__init__.py,sha256=ZVkNS11uN04EWDBazqkY4AeVZC9UOXV_W-1V9QZgnl0,1913
9
+ mapFolding/_theSSOT.py,sha256=QuyDsMCbqv3Au4RUgdYPcyR89JrT9WkzcauzybpgKzU,5384
10
+ mapFolding/_theTypes.py,sha256=0uf4x31ilFxIO6sbiSd39H5_7VWBKxColVmfy3oIafk,7376
11
+ mapFolding/basecamp.py,sha256=cNZ104ZbVjV_tagjzn6DuobLyLJpJs418_ew64xYORw,15788
12
+ mapFolding/beDRY.py,sha256=0vJwnsvz6_jR8gfuU38vW9KoMTnRqyaYaAwbJcKLhFI,12674
13
+ mapFolding/dataBaskets.py,sha256=K6M8NG8oqsTUpTR-S_VJFNeDfHV936q65PMtUMNVYrI,26484
14
+ mapFolding/filesystemToolkit.py,sha256=ic69Y043xrdoFjKqiB0YJ6Zp8oosBWwdXi_hmg79PVs,10134
15
+ mapFolding/oeis.py,sha256=2sqdFgYguB4sDpcYGYB_mJL57k9sHs7FUXF05pvIEak,17300
16
+ mapFolding/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ mapFolding/algorithms/A000136constraintPropagation.py,sha256=LJky_I57WIEVXkD8MGiD7bglgy9OvkxWisYrmwSyVAI,5443
18
+ mapFolding/algorithms/A000136elimination.py,sha256=M-kEYknUSdvoXpXrver6tq48MReUhEo_amNoIDKJBM4,5869
19
+ mapFolding/algorithms/A000136eliminationParallel.py,sha256=X3L3hOaqsu7uT9pcyCmKPHElXhoLC-YRGZo2IfpyZtQ,3081
20
+ mapFolding/algorithms/A086345.py,sha256=te3Zy76eJLE3dSFsK7hXTHJapewM1u43GBUV78fL2z8,2492
21
+ mapFolding/algorithms/__init__.py,sha256=gARPqfySaeSWMfApQ5wSxzy7ZdgLdKYsLqsRSEYWwWI,28
22
+ mapFolding/algorithms/daoOfMapFolding.py,sha256=ncTIiBfTsM8SNVx9qefZ0bBcBtviWLSk4iPv3Z9nGiE,5442
23
+ mapFolding/algorithms/matrixMeanders.py,sha256=g8h9sF1emt5OQCXe3EVA_g0FdhvNu7Wo1FI4kMFsqZY,5167
24
+ mapFolding/algorithms/matrixMeandersNumPyndas.py,sha256=giCqLNnxu4RbGERtyAJb5mbvMd1ZbzLR_EoRiEjCXUY,39140
25
+ mapFolding/algorithms/oeisIDbyFormula.py,sha256=jinaLXJb3annODlyidtNZkKIKUuFKp_yzjEZMHSMhQ0,11782
26
+ mapFolding/algorithms/symmetricFolds.py,sha256=g_3Xm3UQ4KwduDdsQJPwQxrIXdBmBjei2_idsLgIIZQ,1200
27
+ mapFolding/algorithms/zCuzDocStoopidoeisIDbyFormula.py,sha256=eGf_gvHUuHAPFFQZd3NIaozY2sQUGse_njtZ8_AyZ-U,2438
28
+ mapFolding/reference/A000682facts.py,sha256=wRg5uy72M-o-cYEF3waCa7NjTUZ3XOoD9dmkTaUiH0o,23510
29
+ mapFolding/reference/A005316facts.py,sha256=Cg2Pqtv3Dnk8IZOqer8Wu3Ie2uwJV_M0Kmr6_QXjKuQ,11768
30
+ mapFolding/reference/A086345Wu.py,sha256=3FJlvcVkrQL2hz4IN2NdzmdMW0weWfYh9l1pnXBTQnc,1110
31
+ mapFolding/reference/__init__.py,sha256=GKcSgYE49NcTISx-JZbELXyq-eRkMeTL5g4DXInWFw0,2206
32
+ mapFolding/reference/flattened.py,sha256=0eHgLFIeIeVUsI5zF5oSy5iWYrjOMzxr7KjDxiTe01k,16078
33
+ mapFolding/reference/hunterNumba.py,sha256=iLfyqwGdAh6c5GbapnKsWhAsNsR3O-fyGGHAdohluLw,7258
34
+ mapFolding/reference/irvineJavaPort.py,sha256=GcnFazAClLsgh4JoO1n-iCtO5aSKJB0SMsKu3RCV--4,3721
35
+ mapFolding/reference/jaxCount.py,sha256=t8ons45zyWNJQ-nmn1qbhNsTkTnRzf7ATauaYvIlkRI,14853
36
+ mapFolding/reference/lunnonNumpy.py,sha256=mMgrgbrBpe4nmo72ThEI-MGH0OwEHmfMPczSXHp2qKo,4357
37
+ mapFolding/reference/lunnonWhile.py,sha256=ZL8GAQtPs5nJZSgoDl5USrLSS_zs03y98y1Z9E4jOmQ,3799
38
+ mapFolding/reference/rotatedEntryPoint.py,sha256=3IJU7Hc2PDSE71wmSkDs4Z3t0Px9NBSzmCsVrgQuQyU,10274
39
+ mapFolding/reference/total_countPlus1vsPlusN.py,sha256=yJZAVLVdoXqHag2_N6_6CT-Q6HXBgRro-eny93-Rlpw,9307
40
+ mapFolding/reference/jobsCompleted/__init__.py,sha256=TU93ZGUW1xEkT6d9mQFn_rp5DvRy0ZslEB2Q6MF5ZDc,2596
41
+ mapFolding/reference/jobsCompleted/[2x19]/p2x19.py,sha256=_tvYtfzMWVo2VtUbIAieoscb4N8FFflgTdW4-ljBUuA,19626
42
+ mapFolding/reference/jobsCompleted/p2x19/p2x19.py,sha256=eZEw4Me4ocTt6VXoK2-Sbd5SowZtxRIbN9dZmc7OCVg,6395
43
+ mapFolding/reference/matrixMeandersAnalysis/__init__.py,sha256=FQbR63_z3_zd3HMrpUxx3_YIcn9znzA0RIggcMntSC8,35
44
+ mapFolding/reference/matrixMeandersAnalysis/prefixNotationNotes.py,sha256=R9MUdS0vLEyaVdCio2AAfxEpBz6FDp7cZotEE47nFdU,1001
45
+ mapFolding/reference/matrixMeandersAnalysis/signatures.py,sha256=6yHwW22032ysBgoG9LXxUyvWlKjQgxpB-f8lI213YZ0,20677
46
+ mapFolding/reference/meandersDumpingGround/A005316JavaPort.py,sha256=syMHicfioP-0GrOq7GnEpuAFSNvRwnbGim0mqV862sA,4885
47
+ mapFolding/reference/meandersDumpingGround/A005316imperative.py,sha256=UEbXPkORngVo0UrwS81SY2gwz1XWAaMZ0rgA7HMiVYk,3793
48
+ mapFolding/reference/meandersDumpingGround/A005316primitiveOptimized.py,sha256=iFig6Edv1E774xrlVUFLyscC40DqDhV-oh4hOnG2DLI,4116
49
+ mapFolding/reference/meandersDumpingGround/A005316redis.py,sha256=MPeiobrs3VsNZOOKYBg52oVp0OjVDzLEdsRKfrZ9LrU,4328
50
+ mapFolding/reference/meandersDumpingGround/A005316write2disk.py,sha256=NMVrdhe5KhnXQfaQ5Xr7Pwl5oXYEOM1DrMISDDOCVVw,5633
51
+ mapFolding/reference/meandersDumpingGround/matrixMeanders64retired.py,sha256=oRVgf6zkWRjk7dWR-Px41M_5spdvKy_Pich0qd7oxVA,9270
52
+ mapFolding/reference/meandersDumpingGround/matrixMeandersBaselineV2.py,sha256=VpRiIGhnk-DbxwsHwCeCwXqcKLSNyHl-iRGLDH9ZGMY,7674
53
+ mapFolding/reference/meandersDumpingGround/matrixMeandersNumPyV1finalForm.py,sha256=yMEF8GIz_1lMMkJiMk-5lek9TAAoqEzfkMbQP80dC_Y,24425
54
+ mapFolding/reference/meandersDumpingGround/matrixMeandersSlicePop.py,sha256=XyiesSQAH1dRplYx_CdR1FzcXvgmmxzj27V4aIqPp7o,5353
55
+ mapFolding/someAssemblyRequired/RecipeJob.py,sha256=8sIRcgP8yFeUplw4GgR5eN8CwVK1ELXPU2xaC2UCLvY,13102
56
+ mapFolding/someAssemblyRequired/__init__.py,sha256=tDDYGBKNhZgcVXZIW-HnUeyXAMdURTOKandc59dUZ7s,5835
57
+ mapFolding/someAssemblyRequired/_toolIfThis.py,sha256=QC2cmCea18BZ_WpoWoErYCWhROvmd40_i_nBO7YFRaE,6378
58
+ mapFolding/someAssemblyRequired/_toolkitContainers.py,sha256=r2Ll4ZW6dz_EDPW2IViYKggsNYbB5L0JfHLbcxXq7EI,14884
59
+ mapFolding/someAssemblyRequired/getLLVMforNoReason.py,sha256=tY0-2K0BFkwLAAjSrFJLPoG8CevDHOFc3OH3TxXANzg,2806
60
+ mapFolding/someAssemblyRequired/infoBooth.py,sha256=nkuBBb_owBCQijqum98QzeKjoIsFrHB5-1pIWObcH0E,2446
61
+ mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py,sha256=z_hXGdl6WbgTZXEKUWZ0FJ9yVfRxXhZyqzgbsLXD9Z4,18189
62
+ mapFolding/someAssemblyRequired/makeJobTheorem2codon.py,sha256=Y51NC5LkdieIjcCyVdeAaXrJzjYKfzNJlRZmlSSGDqk,10133
63
+ mapFolding/someAssemblyRequired/makingModules_count.py,sha256=qudUryuwExzD92_o14OaDg8_Gy3NaHDXLCGttG8hrNI,15068
64
+ mapFolding/someAssemblyRequired/makingModules_doTheNeedful.py,sha256=jp3OmAcTXifxL2XH3AfIMK30nE6Vg9kTCiSDLcUoSEI,3277
65
+ mapFolding/someAssemblyRequired/toolkitMakeModules.py,sha256=wdu-DBdevmoZKc8icl-lzDQ-q0-0iIbligwNYyMztcY,6854
66
+ mapFolding/someAssemblyRequired/toolkitNumba.py,sha256=ABmNjqMfDlUbHfo69eSoFzJRKPe3pkSrfd4YIeGFYdY,14947
67
+ mapFolding/someAssemblyRequired/transformationTools.py,sha256=UD0LIrJkEdvZMvJLbMWXfbXhVKG7oxsSPCmkfRrXXNA,11598
68
+ mapFolding/someAssemblyRequired/A007822/A007822rawMaterials.py,sha256=HbnYk4th5p_jCJI-WzIED8a35JZSLVpecZyTaSIfKXM,1609
69
+ mapFolding/someAssemblyRequired/A007822/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
70
+ mapFolding/someAssemblyRequired/A007822/_asynchronousAnnex.py,sha256=eGZrTkNWlMXgzMx86IQJk7-QH7UwYoBHXFfMZ_MYL6E,1727
71
+ mapFolding/someAssemblyRequired/A007822/makeA007822AsynchronousModules.py,sha256=qnLLG-uN6KMKxYCOrNsyDET6aYkT8HLXYuzYrK2vfTo,5621
72
+ mapFolding/someAssemblyRequired/A007822/makeA007822Modules.py,sha256=qDQDd_mT40Di56-Dg1iYoFiMXzbcupkF81T3CUAPboE,5193
73
+ mapFolding/someAssemblyRequired/mapFoldingModules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
+ mapFolding/someAssemblyRequired/mapFoldingModules/makeMapFoldingModules.py,sha256=braLUATAOUlsJyaVBQnLCSGDYAbwfS7UOkLd4BFhxbM,16355
75
+ mapFolding/someAssemblyRequired/meanders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
+ mapFolding/someAssemblyRequired/meanders/makeMeandersModules.py,sha256=fvIXxxJ6DLfsxgcOMJsht8_JxdbAKfltgQgA3PsYeBM,3444
77
+ mapFolding/syntheticModules/__init__.py,sha256=evVFqhCGa-WZKDiLcnQWjs-Bj34eRnfSLqz_d7dFYZY,83
78
+ mapFolding/syntheticModules/countParallelNumba.py,sha256=_-OoZ07-5oC3WeB603tXUGT9c9-kmsDVtcluMTM8y1U,7784
79
+ mapFolding/syntheticModules/daoOfMapFoldingNumba.py,sha256=OYaMwdyFzlll0OYlUwxQSvyLHgI4QzkDGkCPen1TFJ4,5946
80
+ mapFolding/syntheticModules/initializeState.py,sha256=54kXfjv6Fqv-yQij13736ixDcVzdMIakwlBqd_kN8mw,3122
81
+ mapFolding/syntheticModules/theorem2.py,sha256=QabuLPZ1q0_fK0lkNs1b2QqBbokUkUYGazoK-UF4ssM,3263
82
+ mapFolding/syntheticModules/theorem2Numba.py,sha256=WtEXVExU_ipBwSgztZCPjDayzmL4xd1AecIGenqX1o0,5656
83
+ mapFolding/syntheticModules/theorem2Trimmed.py,sha256=6vOlPYom9XsMyjyu8vIe9pvWbTlfpyow60x3iBvx8Ek,2931
84
+ mapFolding/syntheticModules/A007822/__init__.py,sha256=evVFqhCGa-WZKDiLcnQWjs-Bj34eRnfSLqz_d7dFYZY,83
85
+ mapFolding/syntheticModules/A007822/algorithm.py,sha256=rgdABvNKUVtHokn6IwDF_8-FdYsOUNka-rgK-v8PPXU,7020
86
+ mapFolding/syntheticModules/A007822/asynchronous.py,sha256=cHkhBTW4bjXbv1wGijZcjyps9KRNBHBgyq39-ZsvqrY,8523
87
+ mapFolding/syntheticModules/A007822/initializeState.py,sha256=is2AwFWZbTq1rHKRMSJN5pzAlMWu2dLgjw8o9nZwbvk,4059
88
+ mapFolding/syntheticModules/A007822/theorem2.py,sha256=hciTpia3zUZJfl0EqNvn7Sz3PGxPLNczST7fXWzz-JU,4216
89
+ mapFolding/syntheticModules/A007822/theorem2Numba.py,sha256=XyhYEVIl0Dyeu7sgtBDGMTOSZurQJyep1TlHYYdt3Hw,6932
90
+ mapFolding/syntheticModules/A007822/theorem2Trimmed.py,sha256=kZgAK2qka_xoC7H9UiLef0mrG31WRK4Hte2Nf4HiCuI,3884
91
+ mapFolding/syntheticModules/meanders/__init__.py,sha256=evVFqhCGa-WZKDiLcnQWjs-Bj34eRnfSLqz_d7dFYZY,83
92
+ mapFolding/syntheticModules/meanders/bigInt.py,sha256=He9Ty9XPQFyt33Ye-LQA2WbaQFRkGpG7SDL9m7IlTA0,4213
93
+ mapFolding/tests/__init__.py,sha256=QVCHSMFVvTxV3mAyYOLkMFAFyBJ514zdoVnDmpBJnTo,1336
94
+ mapFolding/tests/conftest.py,sha256=5vV_Vy5ZrV3uoP9bQ8B-Kqc0zMrL7KAhsPJwchMDb6w,15700
95
+ mapFolding/tests/test_computations.py,sha256=fnufZVKMXij4MMf_QdW1vkk1RVI-YYr0luRfIt5usMY,9419
96
+ mapFolding/tests/test_filesystem.py,sha256=0rYQ62f4e3HOoymXrxDWbqNEBJQ7DGN8RUOMI84tE2Q,3892
97
+ mapFolding/tests/test_oeis.py,sha256=M4Fb0e4_h9QTX9Oy6l5-M1UQfNqeonoGVOn0DJI9huE,4854
98
+ mapFolding/tests/test_other.py,sha256=ScBiJ78LnyAaW-RhxcouX6Xw10wgpSdqfvT4LO3WjnQ,4766
99
+ mapFolding/tests/test_tasks.py,sha256=_pr9JRWjjNKA7sww70XvkJJdGPruBVzubM63RmD_Du0,4013
100
+ mapFolding/zCuzDocStoopid/__init__.py,sha256=uKcGXsaYKH9kQUGHjaY0EtWtU6qybb9Fs09ZYKEFMNs,236
101
+ mapFolding/zCuzDocStoopid/makeDocstrings.py,sha256=cQl-B-RlAkFijATUTWfKCael46foH-ZsOp1EHoYxoGs,3212
102
+ mapfolding-0.17.0.dist-info/licenses/LICENSE,sha256=NxH5Y8BdC-gNU-WSMwim3uMbID2iNDXJz7fHtuTdXhk,19346
103
+ mapfolding-0.17.0.dist-info/METADATA,sha256=u8MLZMKsZA4wagvD749W_dpC3y89ghNnc7bt2kAhU_s,7737
104
+ mapfolding-0.17.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
105
+ mapfolding-0.17.0.dist-info/entry_points.txt,sha256=-mH9DjW9tDRMPaeoSWKKywG35cR28m12H_jtmrB4eY8,98
106
+ mapfolding-0.17.0.dist-info/top_level.txt,sha256=jNj7ccwEy_9uqs0hsQCO_rPXgaGn8-IMqXePQN6nZTY,19
107
+ mapfolding-0.17.0.dist-info/RECORD,,
@@ -1,68 +0,0 @@
1
- from collections.abc import Callable
2
- from mapFolding.dataBaskets import MapFoldingState
3
- from typing import Any
4
- import astToolkit
5
- import dataclasses
6
- import functools
7
- import inspect
8
-
9
- r"""Notes
10
- Goal: create a decorator, `unRePackMapFoldingState`, that will unpack `MapFoldingState`, pass only the parameters in the decorated function, receive the
11
- values returned by the function, and repack `MapFoldingState`.
12
-
13
- You must use dynamic programming. If the datatype or the field name changes, for example, that should not affect the decorator.
14
-
15
- To use in, for example, C:\apps\mapFolding\mapFolding\syntheticModules\A007822\theorem2Numba.py. Analogous to
16
- `Z0Z_tools.waveformSpectrogramWaveform`, see
17
- https://github.com/hunterhogan/Z0Z_tools/blob/2c393c2831382dfe6f3e742cf56db39e71126cbc/Z0Z_tools/ioAudio.py
18
-
19
- For examples of manipulating `dataclasses`, see also:
20
- C:\apps\mapFolding\mapFolding\someAssemblyRequired\_toolkitContainers.py and
21
- C:\apps\mapFolding\mapFolding\someAssemblyRequired\transformationTools.py
22
-
23
- - `TypeVar` may be useful.
24
-
25
- - `dataclasses` has inspection tools.
26
-
27
- - `return MapFoldingState(...` Check if the field is init=True
28
-
29
- Prototype. Eventual home will probably be "beDry.py".
30
- """
31
-
32
- def unRePackMapFoldingState[CallableTargetType: Callable[..., Any]](callableTarget: CallableTargetType) -> Callable[[MapFoldingState], MapFoldingState]:
33
- signatureTargetFunction: inspect.Signature = inspect.signature(callableTarget)
34
- parametersTargetFunction: list[str] = list(signatureTargetFunction.parameters.keys())
35
-
36
- fieldsMapFoldingState: tuple[dataclasses.Field[Any], ...] = dataclasses.fields(MapFoldingState)
37
-
38
- fieldsInitializable: dict[str, dataclasses.Field[Any]] = {field.name: field for field in fieldsMapFoldingState if field.init}
39
-
40
- @functools.wraps(callableTarget)
41
- def decoratedFunction(mapFoldingStateInstance: MapFoldingState, **additionalKeywordArguments: Any) -> MapFoldingState:
42
- dataclassAsDict: dict[str, Any] = dataclasses.asdict(mapFoldingStateInstance)
43
-
44
- argumentsForTargetFunction: list[Any] = []
45
- for parameterName in parametersTargetFunction:
46
- if parameterName in dataclassAsDict:
47
- argumentsForTargetFunction.append(dataclassAsDict[parameterName])
48
- elif parameterName in additionalKeywordArguments:
49
- argumentsForTargetFunction.append(additionalKeywordArguments[parameterName])
50
- else:
51
- errorMessage = f"Parameter '{parameterName}' not found in MapFoldingState or additional arguments"
52
- raise ValueError(errorMessage)
53
-
54
- returnedFromTargetFunction: Any = callableTarget(*argumentsForTargetFunction)
55
-
56
- argumentsForMapFoldingStateConstructor: dict[str, Any] = {fieldName: dataclassAsDict[fieldName] for fieldName in fieldsInitializable}
57
-
58
- if len(parametersTargetFunction) == 1:
59
- singleParameterName: str = parametersTargetFunction[0]
60
- if singleParameterName in fieldsInitializable:
61
- argumentsForMapFoldingStateConstructor[singleParameterName] = returnedFromTargetFunction
62
- elif isinstance(returnedFromTargetFunction, tuple) and len(returnedFromTargetFunction) == len(parametersTargetFunction):
63
- updatedFieldsFromReturn: dict[str, Any] = {parameterName: returnedValue for parameterName, returnedValue in zip(parametersTargetFunction, returnedFromTargetFunction, strict=True) if parameterName in fieldsInitializable}
64
- argumentsForMapFoldingStateConstructor.update(updatedFieldsFromReturn)
65
-
66
- return MapFoldingState(**argumentsForMapFoldingStateConstructor)
67
-
68
- return decoratedFunction