mapFolding 0.6.0__py3-none-any.whl → 0.7.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. mapFolding/__init__.py +6 -104
  2. mapFolding/basecamp.py +12 -8
  3. mapFolding/beDRY.py +103 -286
  4. mapFolding/filesystem.py +95 -0
  5. mapFolding/noHomeYet.py +20 -0
  6. mapFolding/oeis.py +46 -39
  7. mapFolding/reference/flattened.py +377 -0
  8. mapFolding/reference/hunterNumba.py +132 -0
  9. mapFolding/reference/irvineJavaPort.py +120 -0
  10. mapFolding/reference/jax.py +208 -0
  11. mapFolding/reference/lunnan.py +153 -0
  12. mapFolding/reference/lunnanNumpy.py +123 -0
  13. mapFolding/reference/lunnanWhile.py +121 -0
  14. mapFolding/reference/rotatedEntryPoint.py +240 -0
  15. mapFolding/reference/total_countPlus1vsPlusN.py +211 -0
  16. mapFolding/someAssemblyRequired/Z0Z_workbench.py +33 -0
  17. mapFolding/someAssemblyRequired/__init__.py +16 -0
  18. mapFolding/someAssemblyRequired/getLLVMforNoReason.py +21 -0
  19. mapFolding/someAssemblyRequired/ingredientsNumba.py +100 -0
  20. mapFolding/someAssemblyRequired/synthesizeCountingFunctions.py +7 -0
  21. mapFolding/someAssemblyRequired/synthesizeDataConverters.py +135 -0
  22. mapFolding/someAssemblyRequired/synthesizeNumba.py +91 -0
  23. mapFolding/someAssemblyRequired/synthesizeNumbaJob.py +417 -0
  24. mapFolding/someAssemblyRequired/synthesizeNumbaModules.py +91 -0
  25. mapFolding/someAssemblyRequired/transformationTools.py +425 -0
  26. mapFolding/someAssemblyRequired/whatWillBe.py +357 -0
  27. mapFolding/syntheticModules/__init__.py +0 -0
  28. mapFolding/syntheticModules/dataNamespaceFlattened.py +30 -0
  29. mapFolding/syntheticModules/multiprocessingCount_doTheNeedful.py +216 -0
  30. mapFolding/syntheticModules/numbaCount.py +90 -0
  31. mapFolding/syntheticModules/numbaCountExample.py +158 -0
  32. mapFolding/syntheticModules/numbaCountSequential.py +111 -0
  33. mapFolding/syntheticModules/numbaCount_doTheNeedful.py +13 -0
  34. mapFolding/syntheticModules/numba_doTheNeedful.py +12 -0
  35. mapFolding/syntheticModules/numba_doTheNeedfulExample.py +13 -0
  36. mapFolding/theDao.py +216 -229
  37. mapFolding/theSSOT.py +269 -101
  38. {mapfolding-0.6.0.dist-info → mapfolding-0.7.1.dist-info}/METADATA +7 -6
  39. mapfolding-0.7.1.dist-info/RECORD +51 -0
  40. {mapfolding-0.6.0.dist-info → mapfolding-0.7.1.dist-info}/WHEEL +1 -1
  41. {mapfolding-0.6.0.dist-info → mapfolding-0.7.1.dist-info}/top_level.txt +1 -0
  42. tests/__init__.py +0 -0
  43. tests/conftest.py +278 -0
  44. tests/test_computations.py +53 -0
  45. tests/test_filesystem.py +52 -0
  46. tests/test_oeis.py +128 -0
  47. tests/test_other.py +84 -0
  48. tests/test_tasks.py +56 -0
  49. mapFolding/theConfiguration.py +0 -58
  50. mapFolding/theSSOTdatatypes.py +0 -155
  51. mapFolding/theWrongWay.py +0 -7
  52. mapfolding-0.6.0.dist-info/RECORD +0 -16
  53. {mapfolding-0.6.0.dist-info → mapfolding-0.7.1.dist-info}/LICENSE +0 -0
  54. {mapfolding-0.6.0.dist-info → mapfolding-0.7.1.dist-info}/entry_points.txt +0 -0
@@ -1,58 +0,0 @@
1
- from types import ModuleType
2
- from mapFolding.theWrongWay import *
3
- from sys import modules as sysModules
4
- from pathlib import Path
5
- from importlib import import_module as importlib_import_module
6
- from inspect import getfile as inspect_getfile
7
- from typing import Final
8
- """
9
- evaluateWhenPACKAGING
10
- evaluateWhenINSTALLING
11
- """
12
- try:
13
- import tomli
14
- TRYmyPackageNameIs: str = tomli.load(Path("../pyproject.toml").open('rb'))["project"]["name"]
15
- except Exception:
16
- TRYmyPackageNameIs: str = myPackageNameIsPACKAGING
17
-
18
- myPackageNameIs: Final[str] = TRYmyPackageNameIs
19
-
20
- def getPathPackageINSTALLING() -> Path:
21
- pathPackage = Path(inspect_getfile(importlib_import_module(myPackageNameIs)))
22
- if pathPackage.is_file():
23
- pathPackage: Path = pathPackage.parent
24
- return pathPackage
25
-
26
- pathPackage: Path = getPathPackageINSTALLING()
27
-
28
- moduleOfSyntheticModules: Final[str] = "syntheticModules"
29
- formatNameModule = "numba_{callableTarget}"
30
- formatFilenameModule = formatNameModule + ".py"
31
- dispatcherCallableName = "doTheNeedful"
32
- nameModuleDispatcher: str = formatNameModule.format(callableTarget=dispatcherCallableName)
33
- Z0Z_filenameModuleWrite = 'numbaCount.py'
34
- Z0Z_filenameWriteElseCallableTarget: str = 'count'
35
-
36
- def getDispatcherCallable():
37
- logicalPathModule: str = f"{myPackageNameIs}.{moduleOfSyntheticModules}.{nameModuleDispatcher}"
38
- moduleImported: ModuleType = importlib_import_module(logicalPathModule)
39
- return getattr(moduleImported, dispatcherCallableName)
40
-
41
- def getAlgorithmSource() -> ModuleType:
42
- logicalPathModule: str = f"{myPackageNameIs}.{algorithmSourcePACKAGING}"
43
- moduleImported: ModuleType = importlib_import_module(logicalPathModule)
44
- return moduleImported
45
- # from mapFolding import theDao
46
- # return theDao
47
-
48
- # TODO learn how to see this from the user's perspective
49
- def getPathJobRootDEFAULT() -> Path:
50
- if 'google.colab' in sysModules:
51
- pathJobDEFAULT: Path = Path("/content/drive/MyDrive") / "jobs"
52
- else:
53
- pathJobDEFAULT = pathPackage / "jobs"
54
- return pathJobDEFAULT
55
-
56
- listCallablesDispatchees: list[str] = listCallablesDispatcheesHARDCODED
57
-
58
- additional_importsHARDCODED.append(myPackageNameIs)
@@ -1,155 +0,0 @@
1
- from mapFolding.theConfiguration import *
2
- from collections import defaultdict
3
- from typing import Any, cast, Final
4
- import enum
5
- import numba # type: ignore
6
- import numpy # type: ignore
7
-
8
- class EnumIndices(enum.IntEnum):
9
- @staticmethod
10
- def _generate_next_value_(name: str, start: int, count: int, last_values: list[Any]) -> int:
11
- """0-indexed."""
12
- return count
13
-
14
- def __index__(self) -> int:
15
- """Adapt enum to the ultra-rare event of indexing a NumPy 'ndarray', which is not the
16
- same as `array.array`. See NumPy.org; I think it will be very popular someday."""
17
- return self.value
18
-
19
- class indexMy(EnumIndices):
20
- """Indices for scalar values."""
21
- dimensionsTotal = enum.auto()
22
- dimensionsUnconstrained = enum.auto()
23
- gap1ndex = enum.auto()
24
- gap1ndexCeiling = enum.auto()
25
- indexDimension = enum.auto()
26
- indexLeaf = enum.auto()
27
- indexMiniGap = enum.auto()
28
- leaf1ndex = enum.auto()
29
- leafConnectee = enum.auto()
30
- taskDivisions = enum.auto()
31
- taskIndex = enum.auto()
32
-
33
- class indexTrack(EnumIndices):
34
- """Indices for state tracking array."""
35
- leafAbove = enum.auto()
36
- leafBelow = enum.auto()
37
- countDimensionsGapped = enum.auto()
38
- gapRangeStart = enum.auto()
39
-
40
- _datatypeDefault: Final[dict[str, str]] = {
41
- 'elephino': 'uint16',
42
- 'foldsTotal': 'int64',
43
- 'leavesTotal': 'uint16',
44
- }
45
- _datatypeModule: str = ''
46
- _registryOfDatatypes: dict[str, str] = defaultdict(str)
47
-
48
- def reportDatatypeLimit(identifier: str, datatype: str, sourGrapes: bool | None = False) -> str:
49
- global _registryOfDatatypes
50
- if not _registryOfDatatypes[identifier]:
51
- _registryOfDatatypes[identifier] = datatype
52
- elif _registryOfDatatypes[identifier] == datatype:
53
- pass
54
- elif sourGrapes:
55
- raise Exception(f"Datatype is '{_registryOfDatatypes[identifier]}' not '{datatype}', so you can take your ball and go home.")
56
- return _registryOfDatatypes[identifier]
57
-
58
- def setDatatypeModule(datatypeModule: str, sourGrapes: bool | None = False) -> str:
59
- global _datatypeModule
60
- if not _datatypeModule:
61
- _datatypeModule = datatypeModule
62
- elif _datatypeModule == datatypeModule:
63
- pass
64
- elif sourGrapes:
65
- raise Exception(f"Datatype module is '{_datatypeModule}' not '{datatypeModule}', so you can take your ball and go home.")
66
- return _datatypeModule
67
-
68
- def setDatatypeElephino(datatype: str, sourGrapes: bool | None = False) -> str:
69
- return reportDatatypeLimit('elephino', datatype, sourGrapes)
70
-
71
- def setDatatypeFoldsTotal(datatype: str, sourGrapes: bool | None = False) -> str:
72
- return reportDatatypeLimit('foldsTotal', datatype, sourGrapes)
73
-
74
- def setDatatypeLeavesTotal(datatype: str, sourGrapes: bool | None = False) -> str:
75
- return reportDatatypeLimit('leavesTotal', datatype, sourGrapes)
76
-
77
- def _get_datatype(identifier: str) -> str:
78
- global _registryOfDatatypes
79
- if not _registryOfDatatypes[identifier]:
80
- if identifier in indexMy._member_names_:
81
- _registryOfDatatypes[identifier] = _datatypeDefault.get(identifier) or _get_datatype('elephino')
82
- elif identifier in indexTrack._member_names_:
83
- _registryOfDatatypes[identifier] = _datatypeDefault.get(identifier) or _get_datatype('elephino')
84
- else:
85
- _registryOfDatatypes[identifier] = _datatypeDefault.get(identifier) or _get_datatype('foldsTotal')
86
- return _registryOfDatatypes[identifier]
87
-
88
- def getDatatypeModule() -> str:
89
- global _datatypeModule
90
- if not _datatypeModule:
91
- _datatypeModule = datatypeModulePACKAGING
92
- return _datatypeModule
93
-
94
- def setInStone(identifier: str) -> type[Any]:
95
- datatypeModule: str = getDatatypeModule()
96
- datatypeStr: str = _get_datatype(identifier)
97
- return cast(type[Any], getattr(eval(datatypeModule), datatypeStr))
98
-
99
- def hackSSOTdtype(identifier: str) -> type[Any]:
100
- _hackSSOTdtype: dict[str, str]={
101
- 'connectionGraph': 'dtypeLeavesTotal',
102
- 'dtypeElephino': 'dtypeElephino',
103
- 'dtypeFoldsTotal': 'dtypeFoldsTotal',
104
- 'dtypeLeavesTotal': 'dtypeLeavesTotal',
105
- 'foldGroups': 'dtypeFoldsTotal',
106
- 'gapsWhere': 'dtypeLeavesTotal',
107
- 'mapShape': 'dtypeLeavesTotal',
108
- 'my': 'dtypeElephino',
109
- 'track': 'dtypeElephino',
110
- }
111
- RubeGoldBerg: str = _hackSSOTdtype[identifier]
112
- if RubeGoldBerg == 'dtypeElephino':
113
- return setInStone('elephino')
114
- elif RubeGoldBerg == 'dtypeFoldsTotal':
115
- return setInStone('foldsTotal')
116
- elif RubeGoldBerg == 'dtypeLeavesTotal':
117
- return setInStone('leavesTotal')
118
- raise Exception("Dude, you forgot to set a value in `hackSSOTdtype`.")
119
-
120
- def hackSSOTdatatype(identifier: str) -> str:
121
- _hackSSOTdatatype: dict[str, str]={
122
- 'connectionGraph': 'datatypeLeavesTotal',
123
- 'countDimensionsGapped': 'datatypeLeavesTotal',
124
- 'datatypeElephino': 'datatypeElephino',
125
- 'datatypeFoldsTotal': 'datatypeFoldsTotal',
126
- 'datatypeLeavesTotal': 'datatypeLeavesTotal',
127
- 'dimensionsTotal': 'datatypeLeavesTotal',
128
- 'dimensionsUnconstrained': 'datatypeLeavesTotal',
129
- 'foldGroups': 'datatypeFoldsTotal',
130
- 'gap1ndex': 'datatypeLeavesTotal',
131
- 'gap1ndexCeiling': 'datatypeElephino',
132
- 'gapRangeStart': 'datatypeElephino',
133
- 'gapsWhere': 'datatypeLeavesTotal',
134
- 'groupsOfFolds': 'datatypeFoldsTotal',
135
- 'indexDimension': 'datatypeLeavesTotal',
136
- 'indexLeaf': 'datatypeLeavesTotal',
137
- 'indexMiniGap': 'datatypeElephino',
138
- 'leaf1ndex': 'datatypeLeavesTotal',
139
- 'leafAbove': 'datatypeLeavesTotal',
140
- 'leafBelow': 'datatypeLeavesTotal',
141
- 'leafConnectee': 'datatypeLeavesTotal',
142
- 'mapShape': 'datatypeLeavesTotal',
143
- 'my': 'datatypeElephino',
144
- 'taskDivisions': 'datatypeLeavesTotal',
145
- 'taskIndex': 'datatypeLeavesTotal',
146
- 'track': 'datatypeElephino',
147
- }
148
- RubeGoldBerg: str = _hackSSOTdatatype[identifier]
149
- if RubeGoldBerg == 'datatypeElephino':
150
- return _get_datatype('elephino')
151
- elif RubeGoldBerg == 'datatypeFoldsTotal':
152
- return _get_datatype('foldsTotal')
153
- elif RubeGoldBerg == 'datatypeLeavesTotal':
154
- return _get_datatype('leavesTotal')
155
- raise Exception("Dude, you forgot to set a value in `hackSSOTdatatype`.")
mapFolding/theWrongWay.py DELETED
@@ -1,7 +0,0 @@
1
- from typing import Final
2
-
3
- datatypeModulePACKAGING: Final[str] = 'numpy'
4
- myPackageNameIsPACKAGING: str = "mapFolding"
5
- listCallablesDispatcheesHARDCODED: list[str] = ['countInitialize', 'countParallel', 'countSequential']
6
- additional_importsHARDCODED: list[str] = ['numba']
7
- algorithmSourcePACKAGING: str = 'theDao'
@@ -1,16 +0,0 @@
1
- mapFolding/__init__.py,sha256=pggwv9wBf1jqZUxp8qO1Si1LswyTGZQLoRqdO0ptiS4,2707
2
- mapFolding/basecamp.py,sha256=Y2yBE89IviRcVOvLM1mRWocqPHVkmZ2awAZVkDTDTAo,3571
3
- mapFolding/beDRY.py,sha256=5D-9AwbtBULTQ4N5WX57ZXqw6mCmPa31eCU2xpQXlf4,15750
4
- mapFolding/oeis.py,sha256=qxNrmEfx5IYc5tw312J3Jk3xO-nAeaM8unxmxM7R8Cs,11924
5
- mapFolding/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- mapFolding/theConfiguration.py,sha256=vKLwflVNzthbZlOWTwEC4xqh0rp9Xoyz-hUAT7a5CSA,2098
7
- mapFolding/theDao.py,sha256=A-cDyixGLROAehYxf4k0srVjoe4aSeXJK_k40irfndU,12626
8
- mapFolding/theSSOT.py,sha256=55sy05nmAaPpDAiuA6t27u20obHMzY8NTD_XR2Ffgos,4940
9
- mapFolding/theSSOTdatatypes.py,sha256=V5G99QwMMaZV-J3EIPAKIKorV3fz0LHUgwErF9MP01E,5854
10
- mapFolding/theWrongWay.py,sha256=p7nL3JM9t4mbF1xBn1gZzG1jGs9KRkyGP3XliUPkm-4,312
11
- mapfolding-0.6.0.dist-info/LICENSE,sha256=NxH5Y8BdC-gNU-WSMwim3uMbID2iNDXJz7fHtuTdXhk,19346
12
- mapfolding-0.6.0.dist-info/METADATA,sha256=cnO-gz66V3NnAdUIAgKKIsT8PgVxqD4I726HqgYVGSc,7768
13
- mapfolding-0.6.0.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
14
- mapfolding-0.6.0.dist-info/entry_points.txt,sha256=F3OUeZR1XDTpoH7k3wXuRb3KF_kXTTeYhu5AGK1SiOQ,146
15
- mapfolding-0.6.0.dist-info/top_level.txt,sha256=aG3bjFBoxxuaV3Iu1wZAd241Ubs3cdaJtKYBQBDIjsg,11
16
- mapfolding-0.6.0.dist-info/RECORD,,