mapFolding 0.3.5__tar.gz → 0.3.6__tar.gz
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-0.3.5 → mapfolding-0.3.6}/PKG-INFO +3 -2
- mapfolding-0.3.6/mapFolding/citations/updateCitation.py +116 -0
- mapfolding-0.3.6/mapFolding/citations/updateCitationgpt.py +125 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/mapFolding.egg-info/PKG-INFO +3 -2
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/mapFolding.egg-info/SOURCES.txt +4 -3
- mapfolding-0.3.6/mapFolding/someAssemblyRequired/__init__.py +1 -0
- mapfolding-0.3.6/mapFolding/someAssemblyRequired/makeJob.py +34 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/someAssemblyRequired/synthesizeModuleJob.py +26 -39
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/someAssemblyRequired/synthesizeModules.py +15 -43
- mapfolding-0.3.5/mapFolding/syntheticModules/countInitialize.py → mapfolding-0.3.6/mapFolding/syntheticModules/Initialize.py +7 -6
- mapfolding-0.3.5/mapFolding/syntheticModules/countParallel.py → mapfolding-0.3.6/mapFolding/syntheticModules/Parallel.py +5 -4
- mapfolding-0.3.5/mapFolding/syntheticModules/countSequential.py → mapfolding-0.3.6/mapFolding/syntheticModules/Sequential.py +6 -5
- mapfolding-0.3.6/mapFolding/syntheticModules/__init__.py +4 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/pyproject.toml +4 -3
- mapfolding-0.3.5/mapFolding/citations/updateCitation.py +0 -67
- mapfolding-0.3.5/mapFolding/someAssemblyRequired/__init__.py +0 -2
- mapfolding-0.3.5/mapFolding/someAssemblyRequired/makeJob.py +0 -21
- mapfolding-0.3.5/mapFolding/syntheticModules/__init__.py +0 -3
- {mapfolding-0.3.5 → mapfolding-0.3.6}/README.md +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/benchmarks/benchmarking.py +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/mapFolding.egg-info/dependency_links.txt +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/mapFolding.egg-info/entry_points.txt +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/mapFolding.egg-info/requires.txt +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/mapFolding.egg-info/top_level.txt +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/reference/flattened.py +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/reference/hunterNumba.py +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/reference/irvineJavaPort.py +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/reference/jax.py +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/reference/lunnan.py +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/reference/lunnanNumpy.py +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/reference/lunnanWhile.py +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/reference/rotatedEntryPoint.py +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/reference/total_countPlus1vsPlusN.py +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/someAssemblyRequired/generalizeSourceCode.py +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/someAssemblyRequired/getLLVMforNoReason.py +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/setup.cfg +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/tests/test_oeis.py +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/tests/test_other.py +0 -0
- {mapfolding-0.3.5 → mapfolding-0.3.6}/tests/test_tasks.py +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: mapFolding
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.6
|
|
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
|
|
7
|
-
Project-URL:
|
|
7
|
+
Project-URL: homepage, https://github.com/hunterhogan/mapFolding
|
|
8
8
|
Project-URL: Donate, https://www.patreon.com/integrated
|
|
9
|
+
Project-URL: repository, https://github.com/hunterhogan/mapFolding.git
|
|
9
10
|
Keywords: A001415,A001416,A001417,A001418,A195646,folding,map folding,OEIS,stamp folding
|
|
10
11
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
12
|
Classifier: Environment :: Console
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
from cffconvert.cli.create_citation import create_citation
|
|
2
|
+
from cffconvert.cli.validate_or_write_output import validate_or_write_output
|
|
3
|
+
from typing import Any, Dict
|
|
4
|
+
import cffconvert
|
|
5
|
+
import pathlib
|
|
6
|
+
import packaging.metadata
|
|
7
|
+
import tomli
|
|
8
|
+
import inspect
|
|
9
|
+
import json
|
|
10
|
+
import ruamel.yaml
|
|
11
|
+
import packaging
|
|
12
|
+
from packaging.metadata import Metadata as PyPAMetadata
|
|
13
|
+
import packaging.utils
|
|
14
|
+
import packaging.version
|
|
15
|
+
|
|
16
|
+
def addPypaMetadata(citation: cffconvert.Citation, metadata: PyPAMetadata) -> cffconvert.Citation:
|
|
17
|
+
# https://github.com/citation-file-format/cff-initializer-javascript
|
|
18
|
+
"""
|
|
19
|
+
keywords: pathFilenamePackageSSOT; packaging.metadata.Metadata.keywords
|
|
20
|
+
license: pathFilenamePackageSSOT; packaging.metadata.Metadata.license_expression
|
|
21
|
+
title: pathFilenamePackageSSOT; packaging.metadata.Metadata.name
|
|
22
|
+
url: pathFilenamePackageSSOT; packaging.metadata.Metadata.project_urls: homepage
|
|
23
|
+
repository: pathFilenamePackageSSOT; packaging.metadata.Metadata.project_urls: repository
|
|
24
|
+
version: pathFilenamePackageSSOT; packaging.metadata.Metadata.version
|
|
25
|
+
"""
|
|
26
|
+
return citation
|
|
27
|
+
|
|
28
|
+
def getPypaMetadata(packageData: Dict[str, Any]) -> PyPAMetadata:
|
|
29
|
+
# https://packaging.python.org/en/latest/specifications/core-metadata/
|
|
30
|
+
dictionaryProjectURLs = {}
|
|
31
|
+
for urlKey, urlValue in packageData.get('urls', {}).items():
|
|
32
|
+
if urlKey.lower() in ('homepage', 'repository'):
|
|
33
|
+
dictionaryProjectURLs[urlKey] = urlValue
|
|
34
|
+
|
|
35
|
+
metadataRaw = packaging.metadata.RawMetadata(
|
|
36
|
+
keywords=packageData.get('keywords', []),
|
|
37
|
+
license_expression=packageData.get('license', {}).get('text', ''),
|
|
38
|
+
metadata_version='2.4',
|
|
39
|
+
name=packaging.utils.canonicalize_name(packageData.get('name', None), validate=True),
|
|
40
|
+
project_urls=dictionaryProjectURLs,
|
|
41
|
+
version=packageData.get('version', None),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
metadata = PyPAMetadata().from_raw(metadataRaw)
|
|
45
|
+
return metadata
|
|
46
|
+
|
|
47
|
+
"""
|
|
48
|
+
Tentative plan:
|
|
49
|
+
- Commit and push to GitHub
|
|
50
|
+
- GitHub Action gathers information from the sources of truth
|
|
51
|
+
- If the citation needs to be updated, write to both
|
|
52
|
+
- pathFilenameCitationSSOT
|
|
53
|
+
- pathFilenameCitationDOTcffRepo
|
|
54
|
+
- Commit and push to GitHub
|
|
55
|
+
- this complicates things
|
|
56
|
+
- I want the updated citation to be in the `commit` field of itself
|
|
57
|
+
"""
|
|
58
|
+
"""cffconvert.Citation fields and the source of truth
|
|
59
|
+
abstract: pathFilenameCitationSSOT
|
|
60
|
+
authors: pathFilenamePackageSSOT
|
|
61
|
+
cff-version: pathFilenameCitationSSOT
|
|
62
|
+
commit: workflows['Make GitHub Release']
|
|
63
|
+
contact: pathFilenamePackageSSOT
|
|
64
|
+
date-released: workflows['Make GitHub Release']
|
|
65
|
+
doi: pathFilenameCitationSSOT
|
|
66
|
+
identifiers: workflows['Make GitHub Release']
|
|
67
|
+
license-url: pathFilenamePackageSSOT
|
|
68
|
+
message: pathFilenameCitationSSOT
|
|
69
|
+
preferred-citation: pathFilenameCitationSSOT
|
|
70
|
+
references: to be determined
|
|
71
|
+
repository-artifact: (https://pypi.org/pypi/{package_name}/json').json()['releases']
|
|
72
|
+
repository-code: workflows['Make GitHub Release']
|
|
73
|
+
type: pathFilenameCitationSSOT
|
|
74
|
+
|
|
75
|
+
keywords: pathFilenamePackageSSOT; packaging.metadata.Metadata.keywords
|
|
76
|
+
license: pathFilenamePackageSSOT; packaging.metadata.Metadata.license_expression
|
|
77
|
+
title: pathFilenamePackageSSOT; packaging.metadata.Metadata.name
|
|
78
|
+
url: pathFilenamePackageSSOT; packaging.metadata.Metadata.project_urls: homepage
|
|
79
|
+
repository: pathFilenamePackageSSOT; packaging.metadata.Metadata.project_urls: repository
|
|
80
|
+
version: pathFilenamePackageSSOT; packaging.metadata.Metadata.version
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
def logistics():
|
|
84
|
+
# Prefer reliable, dynamic values over hardcoded ones
|
|
85
|
+
packageName: str = 'mapFolding'
|
|
86
|
+
pathRepoRoot = pathlib.Path(__file__).parent.parent.parent
|
|
87
|
+
pathFilenamePackageSSOT = pathRepoRoot / 'pyproject.toml'
|
|
88
|
+
filenameGitHubAction = 'updateCitation.yml'
|
|
89
|
+
pathFilenameGitHubAction = pathRepoRoot / '.github' / 'workflows' / filenameGitHubAction
|
|
90
|
+
|
|
91
|
+
filenameCitationDOTcff = 'CITATION.cff'
|
|
92
|
+
pathCitations = pathRepoRoot / packageName / 'citations'
|
|
93
|
+
pathFilenameCitationSSOT = pathCitations / filenameCitationDOTcff
|
|
94
|
+
pathFilenameCitationDOTcffRepo = pathRepoRoot / filenameCitationDOTcff
|
|
95
|
+
|
|
96
|
+
citationObject: cffconvert.Citation = create_citation(infile=pathFilenameCitationSSOT, url=None)
|
|
97
|
+
print(citationObject._parse().as_cff())
|
|
98
|
+
|
|
99
|
+
tomlPackageData: Dict[str, Any] = tomli.loads(pathFilenamePackageSSOT.read_text())['project']
|
|
100
|
+
# https://packaging.python.org/en/latest/specifications/pyproject-toml/
|
|
101
|
+
pypaMetadata: PyPAMetadata = getPypaMetadata(tomlPackageData)
|
|
102
|
+
|
|
103
|
+
validate_or_write_output(outfile=pathFilenameCitationSSOT, outputformat='cff', validate_only=False, citation=citationObject)
|
|
104
|
+
validate_or_write_output(outfile=pathFilenameCitationDOTcffRepo, outputformat='cff', validate_only=False, citation=citationObject)
|
|
105
|
+
|
|
106
|
+
if __name__ == '__main__':
|
|
107
|
+
logistics()
|
|
108
|
+
|
|
109
|
+
# print(f"{pypaMetadata.name=}, {pypaMetadata.version=}, {pypaMetadata.keywords=}, {pypaMetadata.license_expression=}, {pypaMetadata.project_urls=}")
|
|
110
|
+
# path_cffconvert = pathlib.Path(inspect.getfile(cffconvert)).parent
|
|
111
|
+
# pathFilenameSchema = path_cffconvert / "schemas/1.2.0/schema.json"
|
|
112
|
+
# scheme: Dict[str, Any] = json.loads(pathFilenameSchema.read_text())
|
|
113
|
+
# schemaSpecifications: Dict[str, Any] = scheme['properties']
|
|
114
|
+
|
|
115
|
+
# for property, subProperties in schemaSpecifications.items():
|
|
116
|
+
# print(property, subProperties.get('items', None))
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
from cffconvert.cli.create_citation import create_citation
|
|
2
|
+
from cffconvert.cli.validate_or_write_output import validate_or_write_output
|
|
3
|
+
from typing import Any, Dict
|
|
4
|
+
import cffconvert
|
|
5
|
+
import pathlib
|
|
6
|
+
import packaging.metadata
|
|
7
|
+
import tomli
|
|
8
|
+
import ruamel.yaml
|
|
9
|
+
import packaging
|
|
10
|
+
from packaging.metadata import Metadata as PyPAMetadata
|
|
11
|
+
import packaging.utils
|
|
12
|
+
import packaging.version
|
|
13
|
+
|
|
14
|
+
def addPypaMetadata(citation: cffconvert.Citation, metadata: PyPAMetadata) -> cffconvert.Citation:
|
|
15
|
+
"""
|
|
16
|
+
Map the PyPA metadata to the citation's internal representation.
|
|
17
|
+
|
|
18
|
+
Mapping:
|
|
19
|
+
- title: metadata.name
|
|
20
|
+
- version: metadata.version (converted to string)
|
|
21
|
+
- keywords: metadata.keywords
|
|
22
|
+
- license: metadata.license_expression
|
|
23
|
+
- url: from project URLs (homepage)
|
|
24
|
+
- repository: from project URLs (repository)
|
|
25
|
+
"""
|
|
26
|
+
# Access the internal dictionary (used for conversion)
|
|
27
|
+
citationData: Dict[str, Any] = citation._cffobj
|
|
28
|
+
|
|
29
|
+
# Update title from PyPA metadata name
|
|
30
|
+
if metadata.name:
|
|
31
|
+
citationData["title"] = metadata.name
|
|
32
|
+
|
|
33
|
+
# Update version from PyPA metadata version
|
|
34
|
+
if metadata.version:
|
|
35
|
+
citationData["version"] = str(metadata.version)
|
|
36
|
+
|
|
37
|
+
# Update keywords from PyPA metadata keywords
|
|
38
|
+
if metadata.keywords:
|
|
39
|
+
citationData["keywords"] = metadata.keywords
|
|
40
|
+
|
|
41
|
+
# Update license from PyPA metadata license_expression
|
|
42
|
+
if metadata.license_expression:
|
|
43
|
+
citationData["license"] = metadata.license_expression
|
|
44
|
+
|
|
45
|
+
# Retrieve the project URLs that were attached in getPypaMetadata
|
|
46
|
+
projectURLs: Dict[str, str] = getattr(metadata, "_project_urls", {})
|
|
47
|
+
|
|
48
|
+
# Update the homepage URL
|
|
49
|
+
if "homepage" in projectURLs:
|
|
50
|
+
citationData["url"] = projectURLs["homepage"]
|
|
51
|
+
|
|
52
|
+
# Update the repository URL
|
|
53
|
+
if "repository" in projectURLs:
|
|
54
|
+
citationData["repository"] = projectURLs["repository"]
|
|
55
|
+
|
|
56
|
+
return citation
|
|
57
|
+
|
|
58
|
+
def getPypaMetadata(packageData: Dict[str, Any]) -> PyPAMetadata:
|
|
59
|
+
"""
|
|
60
|
+
Create a PyPA metadata object (version 2.4) from packageData.
|
|
61
|
+
|
|
62
|
+
Mapping for project URLs:
|
|
63
|
+
- 'homepage' and 'repository' are accepted from packageData['urls'].
|
|
64
|
+
"""
|
|
65
|
+
dictionaryProjectURLs: Dict[str, str] = {}
|
|
66
|
+
for urlKey, urlValue in packageData.get("urls", {}).items():
|
|
67
|
+
lowerUrlKey = urlKey.lower()
|
|
68
|
+
if lowerUrlKey in ("homepage", "repository"):
|
|
69
|
+
dictionaryProjectURLs[lowerUrlKey] = urlValue
|
|
70
|
+
|
|
71
|
+
metadataRaw = packaging.metadata.RawMetadata(
|
|
72
|
+
keywords=packageData.get("keywords", []),
|
|
73
|
+
license_expression=packageData.get("license", {}).get("text", ""),
|
|
74
|
+
metadata_version="2.4",
|
|
75
|
+
name=packaging.utils.canonicalize_name(packageData.get("name", None), validate=True),
|
|
76
|
+
project_urls=dictionaryProjectURLs,
|
|
77
|
+
version=packageData.get("version", None),
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
metadata = PyPAMetadata().from_raw(metadataRaw)
|
|
81
|
+
# Attach the project URLs dictionary so it can be used later.
|
|
82
|
+
setattr(metadata, "_project_urls", dictionaryProjectURLs)
|
|
83
|
+
return metadata
|
|
84
|
+
|
|
85
|
+
def logistics():
|
|
86
|
+
# Determine paths from your SSOT.
|
|
87
|
+
packageName: str = "mapFolding"
|
|
88
|
+
pathRepoRoot = pathlib.Path(__file__).parent.parent.parent
|
|
89
|
+
pathFilenamePackageSSOT = pathRepoRoot / "pyproject.toml"
|
|
90
|
+
filenameGitHubAction = "updateCitation.yml"
|
|
91
|
+
pathFilenameGitHubAction = pathRepoRoot / ".github" / "workflows" / filenameGitHubAction
|
|
92
|
+
|
|
93
|
+
filenameCitationDOTcff = "CITATION.cff"
|
|
94
|
+
pathCitations = pathRepoRoot / packageName / "citations"
|
|
95
|
+
pathFilenameCitationSSOT = pathCitations / filenameCitationDOTcff
|
|
96
|
+
pathFilenameCitationDOTcffRepo = pathRepoRoot / filenameCitationDOTcff
|
|
97
|
+
|
|
98
|
+
# Create a citation object from the SSOT citation file.
|
|
99
|
+
citationObject: cffconvert.Citation = create_citation(infile=pathFilenameCitationSSOT, url=None)
|
|
100
|
+
# Print the current citation in CFF format (for debugging) using the as_cff method.
|
|
101
|
+
print(citationObject.as_cff())
|
|
102
|
+
|
|
103
|
+
# Load package metadata from pyproject.toml.
|
|
104
|
+
tomlPackageData: Dict[str, Any] = tomli.loads(pathFilenamePackageSSOT.read_text())["project"]
|
|
105
|
+
pypaMetadata: PyPAMetadata = getPypaMetadata(tomlPackageData)
|
|
106
|
+
|
|
107
|
+
# Map the PyPA metadata into the citation's internal representation.
|
|
108
|
+
citationObject = addPypaMetadata(citation=citationObject, metadata=pypaMetadata)
|
|
109
|
+
|
|
110
|
+
# Validate and write out the updated citation file in both locations.
|
|
111
|
+
# validate_or_write_output(
|
|
112
|
+
# outfile=pathFilenameCitationSSOT,
|
|
113
|
+
# outputformat="cff",
|
|
114
|
+
# validate_only=False,
|
|
115
|
+
# citation=citationObject,
|
|
116
|
+
# )
|
|
117
|
+
validate_or_write_output(
|
|
118
|
+
outfile=pathFilenameCitationDOTcffRepo,
|
|
119
|
+
outputformat="cff",
|
|
120
|
+
validate_only=False,
|
|
121
|
+
citation=citationObject,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
if __name__ == "__main__":
|
|
125
|
+
logistics()
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: mapFolding
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.6
|
|
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
|
|
7
|
-
Project-URL:
|
|
7
|
+
Project-URL: homepage, https://github.com/hunterhogan/mapFolding
|
|
8
8
|
Project-URL: Donate, https://www.patreon.com/integrated
|
|
9
|
+
Project-URL: repository, https://github.com/hunterhogan/mapFolding.git
|
|
9
10
|
Keywords: A001415,A001416,A001417,A001418,A195646,folding,map folding,OEIS,stamp folding
|
|
10
11
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
12
|
Classifier: Environment :: Console
|
|
@@ -2,6 +2,7 @@ README.md
|
|
|
2
2
|
pyproject.toml
|
|
3
3
|
mapFolding/benchmarks/benchmarking.py
|
|
4
4
|
mapFolding/citations/updateCitation.py
|
|
5
|
+
mapFolding/citations/updateCitationgpt.py
|
|
5
6
|
mapFolding/mapFolding.egg-info/PKG-INFO
|
|
6
7
|
mapFolding/mapFolding.egg-info/SOURCES.txt
|
|
7
8
|
mapFolding/mapFolding.egg-info/dependency_links.txt
|
|
@@ -23,10 +24,10 @@ mapFolding/someAssemblyRequired/getLLVMforNoReason.py
|
|
|
23
24
|
mapFolding/someAssemblyRequired/makeJob.py
|
|
24
25
|
mapFolding/someAssemblyRequired/synthesizeModuleJob.py
|
|
25
26
|
mapFolding/someAssemblyRequired/synthesizeModules.py
|
|
27
|
+
mapFolding/syntheticModules/Initialize.py
|
|
28
|
+
mapFolding/syntheticModules/Parallel.py
|
|
29
|
+
mapFolding/syntheticModules/Sequential.py
|
|
26
30
|
mapFolding/syntheticModules/__init__.py
|
|
27
|
-
mapFolding/syntheticModules/countInitialize.py
|
|
28
|
-
mapFolding/syntheticModules/countParallel.py
|
|
29
|
-
mapFolding/syntheticModules/countSequential.py
|
|
30
31
|
tests/test_oeis.py
|
|
31
32
|
tests/test_other.py
|
|
32
33
|
tests/test_tasks.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .makeJob import makeStateJob
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from mapFolding import getPathFilenameFoldsTotal, computationState
|
|
2
|
+
from mapFolding import outfitCountFolds
|
|
3
|
+
from typing import Any, Literal, Optional, Sequence, Type, overload
|
|
4
|
+
import pathlib
|
|
5
|
+
import pickle
|
|
6
|
+
|
|
7
|
+
@overload
|
|
8
|
+
def makeStateJob(listDimensions: Sequence[int], writeJob: Literal[True] = True
|
|
9
|
+
, **keywordArguments: Optional[Type[Any]]) -> pathlib.Path:
|
|
10
|
+
...
|
|
11
|
+
|
|
12
|
+
@overload
|
|
13
|
+
def makeStateJob(listDimensions: Sequence[int], writeJob: Literal[False] = False
|
|
14
|
+
, **keywordArguments: Optional[Type[Any]]) -> computationState:
|
|
15
|
+
...
|
|
16
|
+
|
|
17
|
+
def makeStateJob(listDimensions: Sequence[int], writeJob: bool = True, **keywordArguments: Optional[Type[Any]]) -> computationState | pathlib.Path:
|
|
18
|
+
|
|
19
|
+
stateUniversal: computationState = outfitCountFolds(listDimensions, computationDivisions=None, CPUlimit=None, **keywordArguments)
|
|
20
|
+
|
|
21
|
+
from mapFolding.syntheticModules import countInitialize
|
|
22
|
+
countInitialize(stateUniversal['connectionGraph'], stateUniversal['gapsWhere'], stateUniversal['my'], stateUniversal['track'])
|
|
23
|
+
|
|
24
|
+
if not writeJob:
|
|
25
|
+
return stateUniversal
|
|
26
|
+
|
|
27
|
+
pathFilenameChopChop = getPathFilenameFoldsTotal(stateUniversal['mapShape'])
|
|
28
|
+
suffix = pathFilenameChopChop.suffix
|
|
29
|
+
pathJob = pathlib.Path(str(pathFilenameChopChop)[0:-len(suffix)])
|
|
30
|
+
pathJob.mkdir(parents=True, exist_ok=True)
|
|
31
|
+
pathFilenameJob = pathJob / 'stateJob.pkl'
|
|
32
|
+
|
|
33
|
+
pathFilenameJob.write_bytes(pickle.dumps(stateUniversal))
|
|
34
|
+
return pathFilenameJob
|
{mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/someAssemblyRequired/synthesizeModuleJob.py
RENAMED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
from mapFolding import getPathFilenameFoldsTotal
|
|
1
|
+
from mapFolding import getPathFilenameFoldsTotal, indexMy, indexTrack
|
|
2
2
|
from mapFolding import make_dtype, datatypeLargeDEFAULT, datatypeMediumDEFAULT, datatypeSmallDEFAULT, datatypeModuleDEFAULT
|
|
3
|
-
from mapFolding import computationState
|
|
4
3
|
from someAssemblyRequired import makeStateJob
|
|
5
4
|
from typing import Optional
|
|
6
|
-
import more_itertools
|
|
7
|
-
import inspect
|
|
8
5
|
import importlib
|
|
9
6
|
import importlib.util
|
|
7
|
+
import inspect
|
|
8
|
+
import more_itertools
|
|
10
9
|
import numpy
|
|
11
10
|
import pathlib
|
|
12
|
-
import pickle
|
|
13
11
|
import python_minifier
|
|
14
12
|
|
|
15
13
|
identifierCallableLaunch = "goGoGadgetAbsurdity"
|
|
@@ -52,33 +50,15 @@ def writeModuleWithNumba(listDimensions, **keywordArguments: Optional[str]) -> p
|
|
|
52
50
|
dtypeMedium = make_dtype(datatypeMedium, datatypeModule) # type: ignore
|
|
53
51
|
dtypeSmall = make_dtype(datatypeSmall, datatypeModule) # type: ignore
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
pathFilenameFoldsTotal = getPathFilenameFoldsTotal(stateJob['mapShape'], pathFilenameJob.parent)
|
|
53
|
+
stateJob = makeStateJob(listDimensions, writeJob=False, dtypeLarge = dtypeLarge, dtypeMedium = dtypeMedium, dtypeSmall = dtypeSmall)
|
|
54
|
+
pathFilenameFoldsTotal = getPathFilenameFoldsTotal(stateJob['mapShape'])
|
|
58
55
|
|
|
59
56
|
from syntheticModules import countSequential
|
|
60
57
|
algorithmSource = countSequential
|
|
61
58
|
codeSource = inspect.getsource(algorithmSource)
|
|
62
59
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
cache=True, \
|
|
66
|
-
nopython=True, \
|
|
67
|
-
fastmath=True, \
|
|
68
|
-
forceinline=True, \
|
|
69
|
-
inline='always', \
|
|
70
|
-
looplift=False, \
|
|
71
|
-
_nrt=True, \
|
|
72
|
-
error_model='numpy', \
|
|
73
|
-
parallel=False, \
|
|
74
|
-
boundscheck=False, \
|
|
75
|
-
no_cfunc_wrapper=False, \
|
|
76
|
-
no_cpython_wrapper=False, \
|
|
77
|
-
"
|
|
78
|
-
# no_cfunc_wrapper=True, \
|
|
79
|
-
# no_cpython_wrapper=True, \
|
|
80
|
-
|
|
81
|
-
lineNumba = f"@numba.jit({parametersNumba})"
|
|
60
|
+
if datatypeLarge:
|
|
61
|
+
lineNumba = f"@numba.jit(numba.types.{datatypeLarge}(), cache=True, nopython=True, fastmath=True, forceinline=True, inline='always', looplift=False, _nrt=True, error_model='numpy', parallel=False, boundscheck=False, no_cfunc_wrapper=True, no_cpython_wrapper=False)"
|
|
82
62
|
|
|
83
63
|
linesImport = "\n".join([
|
|
84
64
|
"import numpy"
|
|
@@ -88,8 +68,8 @@ no_cpython_wrapper=False, \
|
|
|
88
68
|
ImaIndent = ' '
|
|
89
69
|
linesDataDynamic = """"""
|
|
90
70
|
linesDataDynamic = "\n".join([linesDataDynamic
|
|
91
|
-
, ImaIndent + f"foldsTotal = numba.types.{datatypeLarge}(0)"
|
|
92
|
-
, ImaIndent + makeStrRLEcompacted(stateJob['foldGroups'], 'foldGroups')
|
|
71
|
+
# , ImaIndent + f"foldsTotal = numba.types.{datatypeLarge}(0)"
|
|
72
|
+
# , ImaIndent + makeStrRLEcompacted(stateJob['foldGroups'], 'foldGroups')
|
|
93
73
|
, ImaIndent + makeStrRLEcompacted(stateJob['gapsWhere'], 'gapsWhere')
|
|
94
74
|
])
|
|
95
75
|
|
|
@@ -112,14 +92,22 @@ no_cpython_wrapper=False, \
|
|
|
112
92
|
, linesDataDynamic
|
|
113
93
|
, linesDataStatic
|
|
114
94
|
])
|
|
95
|
+
elif 'taskIndex' in lineSource:
|
|
96
|
+
continue
|
|
115
97
|
elif 'my[indexMy.' in lineSource:
|
|
98
|
+
if 'dimensionsTotal' in lineSource:
|
|
99
|
+
continue
|
|
116
100
|
# leaf1ndex = my[indexMy.leaf1ndex.value]
|
|
117
101
|
identifier, statement = lineSource.split('=')
|
|
118
|
-
lineSource = ImaIndent + identifier.strip() +
|
|
102
|
+
lineSource = ImaIndent + identifier.strip() + f"=numba.types.{datatypeSmall}({str(eval(statement.strip()))})"
|
|
119
103
|
elif 'track[indexTrack.' in lineSource:
|
|
120
104
|
# leafAbove = track[indexTrack.leafAbove.value]
|
|
121
105
|
identifier, statement = lineSource.split('=')
|
|
122
106
|
lineSource = ImaIndent + makeStrRLEcompacted(eval(statement.strip()), identifier.strip())
|
|
107
|
+
elif 'foldGroups[-1]' in lineSource:
|
|
108
|
+
lineSource = lineSource.replace('foldGroups[-1]', str(stateJob['foldGroups'][-1]))
|
|
109
|
+
elif 'dimensionsTotal' in lineSource:
|
|
110
|
+
lineSource = lineSource.replace('dimensionsTotal', str(stateJob['my'][indexMy.dimensionsTotal]))
|
|
123
111
|
|
|
124
112
|
linesAlgorithm = "\n".join([linesAlgorithm
|
|
125
113
|
, lineSource
|
|
@@ -135,11 +123,11 @@ if __name__ == '__main__':
|
|
|
135
123
|
|
|
136
124
|
linesWriteFoldsTotal = """"""
|
|
137
125
|
linesWriteFoldsTotal = "\n".join([linesWriteFoldsTotal
|
|
138
|
-
, "
|
|
139
|
-
, " print(
|
|
126
|
+
, f" groupsOfFolds *= {str(stateJob['foldGroups'][-1])}"
|
|
127
|
+
, " print(groupsOfFolds)"
|
|
140
128
|
, " with numba.objmode():"
|
|
141
|
-
, f" open('{pathFilenameFoldsTotal.as_posix()}', 'w').write(str(
|
|
142
|
-
, " return
|
|
129
|
+
, f" open('{pathFilenameFoldsTotal.as_posix()}', 'w').write(str(groupsOfFolds))"
|
|
130
|
+
, " return groupsOfFolds"
|
|
143
131
|
])
|
|
144
132
|
|
|
145
133
|
linesAll = "\n".join([
|
|
@@ -149,7 +137,7 @@ if __name__ == '__main__':
|
|
|
149
137
|
, linesLaunch
|
|
150
138
|
])
|
|
151
139
|
|
|
152
|
-
pathFilenameDestination =
|
|
140
|
+
pathFilenameDestination = pathFilenameFoldsTotal.with_suffix(".py")
|
|
153
141
|
pathFilenameDestination.write_text(linesAll)
|
|
154
142
|
|
|
155
143
|
return pathFilenameDestination
|
|
@@ -160,11 +148,10 @@ if __name__ == '__main__':
|
|
|
160
148
|
datatypeMedium = 'uint8'
|
|
161
149
|
datatypeSmall = datatypeMedium
|
|
162
150
|
pathFilenameModule = writeModuleWithNumba(listDimensions, datatypeLarge=datatypeLarge, datatypeMedium=datatypeMedium, datatypeSmall=datatypeSmall)
|
|
151
|
+
|
|
163
152
|
# Induce numba.jit compilation
|
|
164
153
|
moduleSpec = importlib.util.spec_from_file_location(pathFilenameModule.stem, pathFilenameModule)
|
|
165
|
-
if moduleSpec is None:
|
|
166
|
-
raise ImportError(f"Could not load module specification from {pathFilenameModule}")
|
|
154
|
+
if moduleSpec is None: raise ImportError(f"Could not load module specification from {pathFilenameModule}")
|
|
167
155
|
module = importlib.util.module_from_spec(moduleSpec)
|
|
168
|
-
if moduleSpec.loader is None:
|
|
169
|
-
raise ImportError(f"Could not load module from {moduleSpec}")
|
|
156
|
+
if moduleSpec.loader is None: raise ImportError(f"Could not load module from {moduleSpec}")
|
|
170
157
|
moduleSpec.loader.exec_module(module)
|
|
@@ -82,7 +82,10 @@ def decorateCallableWithNumba(astCallable: ast.FunctionDef, parallel: bool=False
|
|
|
82
82
|
|
|
83
83
|
astArgsNumbaSignature = ast.Tuple(elts=listNumbaParameterSignature, ctx=ast.Load())
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
if astCallable.name == 'countInitialize':
|
|
86
|
+
parametersNumba = {}
|
|
87
|
+
else:
|
|
88
|
+
parametersNumba = parametersNumbaDEFAULT if not parallel else ParametersNumba({**parametersNumbaDEFAULT, 'parallel': True})
|
|
86
89
|
listKeywordsNumbaSignature = [ast.keyword(arg=parameterName, value=ast.Constant(value=parameterValue)) for parameterName, parameterValue in parametersNumba.items()]
|
|
87
90
|
|
|
88
91
|
astDecoratorNumba = ast.Call(func=ast.Attribute(value=ast.Name(id='numba', ctx=ast.Load()), attr='jit', ctx=ast.Load()), args=[astArgsNumbaSignature], keywords=listKeywordsNumbaSignature)
|
|
@@ -117,10 +120,7 @@ class UnpackArrayAccesses(ast.NodeTransformer):
|
|
|
117
120
|
return ast.Name(id=member_name, ctx=node.ctx)
|
|
118
121
|
elif isinstance(node, ast.Tuple):
|
|
119
122
|
# Handle tuple slices by transforming each element
|
|
120
|
-
return ast.Tuple(
|
|
121
|
-
elts=cast(List[ast.expr], [self.transform_slice_element(elt) for elt in node.elts]),
|
|
122
|
-
ctx=node.ctx
|
|
123
|
-
)
|
|
123
|
+
return ast.Tuple(elts=cast(List[ast.expr], [self.transform_slice_element(elt) for elt in node.elts]), ctx=node.ctx)
|
|
124
124
|
elif isinstance(node, ast.Attribute):
|
|
125
125
|
member_name = self.extract_member_name(node)
|
|
126
126
|
if member_name:
|
|
@@ -131,7 +131,6 @@ class UnpackArrayAccesses(ast.NodeTransformer):
|
|
|
131
131
|
# Recursively visit any nested subscripts in value or slice
|
|
132
132
|
node.value = self.visit(node.value)
|
|
133
133
|
node.slice = self.visit(node.slice)
|
|
134
|
-
|
|
135
134
|
# If node.value is not our arrayName, just return node
|
|
136
135
|
if not (isinstance(node.value, ast.Name) and node.value.id == self.arrayName):
|
|
137
136
|
return node
|
|
@@ -152,11 +151,7 @@ class UnpackArrayAccesses(ast.NodeTransformer):
|
|
|
152
151
|
self.substitutions[memberName] = ('array', node)
|
|
153
152
|
if len(sliceRemainder) == 0:
|
|
154
153
|
return ast.Name(id=memberName, ctx=ast.Load())
|
|
155
|
-
return ast.Subscript(
|
|
156
|
-
value=ast.Name(id=memberName, ctx=ast.Load()),
|
|
157
|
-
slice=ast.Tuple(elts=sliceRemainder, ctx=ast.Load()) if len(sliceRemainder) > 1 else sliceRemainder[0],
|
|
158
|
-
ctx=ast.Load()
|
|
159
|
-
)
|
|
154
|
+
return ast.Subscript(value=ast.Name(id=memberName, ctx=ast.Load()), slice=ast.Tuple(elts=sliceRemainder, ctx=ast.Load()) if len(sliceRemainder) > 1 else sliceRemainder[0], ctx=ast.Load())
|
|
160
155
|
|
|
161
156
|
# If single-element tuple, unwrap
|
|
162
157
|
if isinstance(node.slice, ast.Tuple) and len(node.slice.elts) == 1:
|
|
@@ -170,44 +165,20 @@ class UnpackArrayAccesses(ast.NodeTransformer):
|
|
|
170
165
|
initializations = []
|
|
171
166
|
for name, (kind, original_node) in self.substitutions.items():
|
|
172
167
|
if kind == 'scalar':
|
|
173
|
-
initializations.append(
|
|
174
|
-
ast.Assign(
|
|
175
|
-
targets=[ast.Name(id=name, ctx=ast.Store())],
|
|
176
|
-
value=original_node
|
|
177
|
-
)
|
|
178
|
-
)
|
|
168
|
+
initializations.append(ast.Assign(targets=[ast.Name(id=name, ctx=ast.Store())], value=original_node))
|
|
179
169
|
else: # array
|
|
180
170
|
initializations.append(
|
|
181
171
|
ast.Assign(
|
|
182
172
|
targets=[ast.Name(id=name, ctx=ast.Store())],
|
|
183
|
-
value=ast.Subscript(
|
|
184
|
-
|
|
185
|
-
slice=ast.Attribute(
|
|
186
|
-
value=ast.Attribute(
|
|
173
|
+
value=ast.Subscript(value=ast.Name(id=self.arrayName, ctx=ast.Load()),
|
|
174
|
+
slice=ast.Attribute(value=ast.Attribute(
|
|
187
175
|
value=ast.Name(id=self.enumIndexClass.__name__, ctx=ast.Load()),
|
|
188
|
-
attr=name,
|
|
189
|
-
ctx=ast.Load()
|
|
190
|
-
),
|
|
191
|
-
attr='value',
|
|
192
|
-
ctx=ast.Load()
|
|
193
|
-
),
|
|
194
|
-
ctx=ast.Load()
|
|
195
|
-
)
|
|
196
|
-
)
|
|
197
|
-
)
|
|
176
|
+
attr=name, ctx=ast.Load()), attr='value', ctx=ast.Load()), ctx=ast.Load())))
|
|
198
177
|
|
|
199
178
|
node.body = initializations + node.body
|
|
200
179
|
return node
|
|
201
180
|
|
|
202
|
-
def getDictionaryEnumValues() -> Dict[str, int]:
|
|
203
|
-
dictionaryEnumValues = {}
|
|
204
|
-
for enumIndex in [indexMy, indexTrack]:
|
|
205
|
-
for memberName, memberValue in enumIndex._member_map_.items():
|
|
206
|
-
dictionaryEnumValues[f"{enumIndex.__name__}.{memberName}.value"] = memberValue.value
|
|
207
|
-
return dictionaryEnumValues
|
|
208
|
-
|
|
209
181
|
def inlineMapFoldingNumba(**keywordArguments: Optional[str]):
|
|
210
|
-
dictionaryEnumValues = getDictionaryEnumValues()
|
|
211
182
|
codeSource = inspect.getsource(algorithmSource)
|
|
212
183
|
pathFilenameAlgorithm = pathlib.Path(inspect.getfile(algorithmSource))
|
|
213
184
|
|
|
@@ -233,11 +204,12 @@ def inlineMapFoldingNumba(**keywordArguments: Optional[str]):
|
|
|
233
204
|
callableDecorated = cast(ast.FunctionDef, trackUnpacker.visit(callableDecorated))
|
|
234
205
|
ast.fix_missing_locations(callableDecorated)
|
|
235
206
|
|
|
236
|
-
|
|
237
|
-
|
|
207
|
+
moduleAST = ast.Module(body=cast(List[ast.stmt], list(codeSourceImportStatements) + [callableDecorated]), type_ignores=[])
|
|
208
|
+
ast.fix_missing_locations(moduleAST)
|
|
209
|
+
moduleSource = ast.unparse(moduleAST)
|
|
238
210
|
|
|
239
|
-
pathFilenameDestination = pathFilenameAlgorithm.parent / "syntheticModules" / pathFilenameAlgorithm.with_stem(callableTarget).name
|
|
240
|
-
pathFilenameDestination.write_text(
|
|
211
|
+
pathFilenameDestination = pathFilenameAlgorithm.parent / "syntheticModules" / pathFilenameAlgorithm.with_stem(callableTarget).name[5:None]
|
|
212
|
+
pathFilenameDestination.write_text(moduleSource)
|
|
241
213
|
listPathFilenamesDestination.append(pathFilenameDestination)
|
|
242
214
|
|
|
243
215
|
if __name__ == '__main__':
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import numpy
|
|
2
|
-
from typing import Any, Tuple
|
|
3
|
-
from mapFolding import indexMy, indexTrack
|
|
4
1
|
import numba
|
|
5
2
|
from numpy import integer
|
|
6
|
-
|
|
3
|
+
from mapFolding import indexMy, indexTrack
|
|
4
|
+
import numpy
|
|
5
|
+
from typing import Any, Tuple
|
|
6
|
+
|
|
7
|
+
@numba.jit((numba.uint8[:, :, ::1], numba.uint8[::1], numba.uint8[::1], numba.uint8[:, ::1]))
|
|
7
8
|
def countInitialize(connectionGraph: numpy.ndarray[Tuple[int, int, int], numpy.dtype[integer[Any]]], gapsWhere: numpy.ndarray[Tuple[int], numpy.dtype[integer[Any]]], my: numpy.ndarray[Tuple[int], numpy.dtype[integer[Any]]], track: numpy.ndarray[Tuple[int, int], numpy.dtype[integer[Any]]]):
|
|
8
|
-
while my[indexMy.leaf1ndex.value]
|
|
9
|
+
while my[indexMy.leaf1ndex.value]:
|
|
9
10
|
if my[indexMy.leaf1ndex.value] <= 1 or track[indexTrack.leafBelow.value, 0] == 1:
|
|
10
11
|
my[indexMy.dimensionsUnconstrained.value] = my[indexMy.dimensionsTotal.value]
|
|
11
12
|
my[indexMy.gap1ndexCeiling.value] = track[indexTrack.gapRangeStart.value, my[indexMy.leaf1ndex.value] - 1]
|
|
@@ -35,7 +36,7 @@ def countInitialize(connectionGraph: numpy.ndarray[Tuple[int, int, int], numpy.d
|
|
|
35
36
|
my[indexMy.gap1ndex.value] += 1
|
|
36
37
|
track[indexTrack.countDimensionsGapped.value, gapsWhere[my[indexMy.indexMiniGap.value]]] = 0
|
|
37
38
|
my[indexMy.indexMiniGap.value] += 1
|
|
38
|
-
if my[indexMy.leaf1ndex.value]
|
|
39
|
+
if my[indexMy.leaf1ndex.value]:
|
|
39
40
|
my[indexMy.gap1ndex.value] -= 1
|
|
40
41
|
track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]] = gapsWhere[my[indexMy.gap1ndex.value]]
|
|
41
42
|
track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]] = track[indexTrack.leafBelow.value, track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]]
|
|
@@ -3,15 +3,16 @@ from typing import Any, Tuple
|
|
|
3
3
|
import numba
|
|
4
4
|
from mapFolding import indexMy, indexTrack
|
|
5
5
|
import numpy
|
|
6
|
+
|
|
6
7
|
@numba.jit((numba.uint8[:, :, ::1], numba.int64[::1], numba.uint8[::1], numba.uint8[::1], numba.uint8[:, ::1]), _nrt=True, boundscheck=False, cache=True, error_model='numpy', fastmath=True, forceinline=False, inline='never', looplift=False, no_cfunc_wrapper=True, no_cpython_wrapper=True, nopython=True, parallel=True)
|
|
7
8
|
def countParallel(connectionGraph: numpy.ndarray[Tuple[int, int, int], numpy.dtype[integer[Any]]], foldGroups: numpy.ndarray[Tuple[int], numpy.dtype[integer[Any]]], gapsWherePARALLEL: numpy.ndarray[Tuple[int], numpy.dtype[integer[Any]]], myPARALLEL: numpy.ndarray[Tuple[int], numpy.dtype[integer[Any]]], trackPARALLEL: numpy.ndarray[Tuple[int, int], numpy.dtype[integer[Any]]]):
|
|
8
9
|
for indexSherpa in numba.prange(myPARALLEL[indexMy.taskDivisions.value]):
|
|
9
|
-
groupsOfFolds
|
|
10
|
+
groupsOfFolds = numba.types.int64(0)
|
|
10
11
|
gapsWhere = gapsWherePARALLEL.copy()
|
|
11
12
|
my = myPARALLEL.copy()
|
|
12
13
|
my[indexMy.taskIndex.value] = indexSherpa
|
|
13
14
|
track = trackPARALLEL.copy()
|
|
14
|
-
while my[indexMy.leaf1ndex.value]
|
|
15
|
+
while my[indexMy.leaf1ndex.value]:
|
|
15
16
|
if my[indexMy.leaf1ndex.value] <= 1 or track[indexTrack.leafBelow.value, 0] == 1:
|
|
16
17
|
if my[indexMy.leaf1ndex.value] > foldGroups[-1]:
|
|
17
18
|
groupsOfFolds += 1
|
|
@@ -39,11 +40,11 @@ def countParallel(connectionGraph: numpy.ndarray[Tuple[int, int, int], numpy.dty
|
|
|
39
40
|
my[indexMy.gap1ndex.value] += 1
|
|
40
41
|
track[indexTrack.countDimensionsGapped.value, gapsWhere[my[indexMy.indexMiniGap.value]]] = 0
|
|
41
42
|
my[indexMy.indexMiniGap.value] += 1
|
|
42
|
-
while my[indexMy.leaf1ndex.value]
|
|
43
|
+
while my[indexMy.leaf1ndex.value] and my[indexMy.gap1ndex.value] == track[indexTrack.gapRangeStart.value, my[indexMy.leaf1ndex.value] - 1]:
|
|
43
44
|
my[indexMy.leaf1ndex.value] -= 1
|
|
44
45
|
track[indexTrack.leafBelow.value, track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]] = track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]]
|
|
45
46
|
track[indexTrack.leafAbove.value, track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]]] = track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]
|
|
46
|
-
if my[indexMy.leaf1ndex.value]
|
|
47
|
+
if my[indexMy.leaf1ndex.value]:
|
|
47
48
|
my[indexMy.gap1ndex.value] -= 1
|
|
48
49
|
track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]] = gapsWhere[my[indexMy.gap1ndex.value]]
|
|
49
50
|
track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]] = track[indexTrack.leafBelow.value, track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]]
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
from numpy import integer
|
|
2
|
-
from typing import Any, Tuple
|
|
3
2
|
import numba
|
|
3
|
+
from typing import Any, Tuple
|
|
4
4
|
from mapFolding import indexMy, indexTrack
|
|
5
5
|
import numpy
|
|
6
|
+
|
|
6
7
|
@numba.jit((numba.uint8[:, :, ::1], numba.int64[::1], numba.uint8[::1], numba.uint8[::1], numba.uint8[:, ::1]), _nrt=True, boundscheck=False, cache=True, error_model='numpy', fastmath=True, forceinline=False, inline='never', looplift=False, no_cfunc_wrapper=True, no_cpython_wrapper=True, nopython=True, parallel=False)
|
|
7
8
|
def countSequential(connectionGraph: numpy.ndarray[Tuple[int, int, int], numpy.dtype[integer[Any]]], foldGroups: numpy.ndarray[Tuple[int], numpy.dtype[integer[Any]]], gapsWhere: numpy.ndarray[Tuple[int], numpy.dtype[integer[Any]]], my: numpy.ndarray[Tuple[int], numpy.dtype[integer[Any]]], track: numpy.ndarray[Tuple[int, int], numpy.dtype[integer[Any]]]):
|
|
8
9
|
leafBelow = track[indexTrack.leafBelow.value]
|
|
@@ -18,9 +19,9 @@ def countSequential(connectionGraph: numpy.ndarray[Tuple[int, int, int], numpy.d
|
|
|
18
19
|
indexMiniGap = my[indexMy.indexMiniGap.value]
|
|
19
20
|
gap1ndex = my[indexMy.gap1ndex.value]
|
|
20
21
|
taskIndex = my[indexMy.taskIndex.value]
|
|
21
|
-
groupsOfFolds
|
|
22
|
+
groupsOfFolds = numba.types.int64(0)
|
|
22
23
|
doFindGaps = True
|
|
23
|
-
while leaf1ndex
|
|
24
|
+
while leaf1ndex:
|
|
24
25
|
if (doFindGaps := (leaf1ndex <= 1 or leafBelow[0] == 1)) and leaf1ndex > foldGroups[-1]:
|
|
25
26
|
groupsOfFolds += 1
|
|
26
27
|
elif doFindGaps:
|
|
@@ -46,11 +47,11 @@ def countSequential(connectionGraph: numpy.ndarray[Tuple[int, int, int], numpy.d
|
|
|
46
47
|
gap1ndex += 1
|
|
47
48
|
countDimensionsGapped[gapsWhere[indexMiniGap]] = 0
|
|
48
49
|
indexMiniGap += 1
|
|
49
|
-
while leaf1ndex
|
|
50
|
+
while leaf1ndex and gap1ndex == gapRangeStart[leaf1ndex - 1]:
|
|
50
51
|
leaf1ndex -= 1
|
|
51
52
|
leafBelow[leafAbove[leaf1ndex]] = leafBelow[leaf1ndex]
|
|
52
53
|
leafAbove[leafBelow[leaf1ndex]] = leafAbove[leaf1ndex]
|
|
53
|
-
if leaf1ndex
|
|
54
|
+
if leaf1ndex:
|
|
54
55
|
gap1ndex -= 1
|
|
55
56
|
leafAbove[leaf1ndex] = gapsWhere[gap1ndex]
|
|
56
57
|
leafBelow[leaf1ndex] = leafBelow[leafAbove[leaf1ndex]]
|
|
@@ -28,7 +28,8 @@ keywords = [
|
|
|
28
28
|
"map folding",
|
|
29
29
|
"OEIS",
|
|
30
30
|
"stamp folding",]
|
|
31
|
-
license = { text = "CC-BY-NC-4.0" }
|
|
31
|
+
license = { 'text' = "CC-BY-NC-4.0" }
|
|
32
|
+
maintainers = []
|
|
32
33
|
name = "mapFolding"
|
|
33
34
|
optional-dependencies = { benchmark = [
|
|
34
35
|
"ipywidgets",
|
|
@@ -47,8 +48,8 @@ optional-dependencies = { benchmark = [
|
|
|
47
48
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
48
49
|
requires-python = ">=3.10,<3.14"
|
|
49
50
|
scripts = { getOEISids = "mapFolding.oeis:getOEISids", clearOEIScache = "mapFolding.oeis:clearOEIScache", OEIS_for_n = "mapFolding.oeis:OEIS_for_n" }
|
|
50
|
-
urls = {
|
|
51
|
-
version = "0.3.
|
|
51
|
+
urls = { homepage = "https://github.com/hunterhogan/mapFolding", Donate = "https://www.patreon.com/integrated", repository = "https://github.com/hunterhogan/mapFolding.git" }
|
|
52
|
+
version = "0.3.6"
|
|
52
53
|
|
|
53
54
|
[tool.coverage]
|
|
54
55
|
report = { exclude_lines = [
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
from cffconvert.cli.create_citation import create_citation
|
|
2
|
-
from typing import Any, Dict
|
|
3
|
-
import cffconvert
|
|
4
|
-
import pathlib
|
|
5
|
-
import tomli
|
|
6
|
-
import inspect
|
|
7
|
-
import json
|
|
8
|
-
|
|
9
|
-
"""
|
|
10
|
-
Tentative plan:
|
|
11
|
-
- Commit and push to GitHub
|
|
12
|
-
- GitHub Action gathers information from the sources of truth
|
|
13
|
-
- If the citation needs to be updated, write to both
|
|
14
|
-
- pathFilenameCitationSSOT
|
|
15
|
-
- pathFilenameCitationDOTcffRepo
|
|
16
|
-
- Commit and push to GitHub
|
|
17
|
-
- this complicates things
|
|
18
|
-
- I want the updated citation to be in the `commit` field of itself
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
"""cffconvert.Citation fields and the source of truth
|
|
22
|
-
abstract: pathFilenameCitationSSOT
|
|
23
|
-
authors: pathFilenamePackageSSOT
|
|
24
|
-
cff-version: pathFilenameCitationSSOT
|
|
25
|
-
commit: workflows['Make GitHub Release']
|
|
26
|
-
contact: pathFilenamePackageSSOT
|
|
27
|
-
date-released: workflows['Make GitHub Release']
|
|
28
|
-
doi: pathFilenameCitationSSOT
|
|
29
|
-
identifiers: workflows['Make GitHub Release']
|
|
30
|
-
keywords: pathFilenamePackageSSOT
|
|
31
|
-
license: pathFilenamePackageSSOT
|
|
32
|
-
license-url: pathFilenamePackageSSOT
|
|
33
|
-
message: pathFilenameCitationSSOT
|
|
34
|
-
preferred-citation: pathFilenameCitationSSOT
|
|
35
|
-
references: to be determined
|
|
36
|
-
repository: pathFilenamePackageSSOT
|
|
37
|
-
repository-artifact: (https://pypi.org/pypi/{package_name}/json').json()['releases']
|
|
38
|
-
repository-code: workflows['Make GitHub Release']
|
|
39
|
-
title: pathFilenamePackageSSOT
|
|
40
|
-
type: pathFilenameCitationSSOT
|
|
41
|
-
url: pathFilenamePackageSSOT
|
|
42
|
-
version: pathFilenamePackageSSOT
|
|
43
|
-
"""
|
|
44
|
-
# Prefer reliable, dynamic values over hardcoded ones
|
|
45
|
-
packageName: str = 'mapFolding'
|
|
46
|
-
pathRepoRoot = pathlib.Path(__file__).parent.parent.parent
|
|
47
|
-
pathFilenamePackageSSOT = pathRepoRoot / 'pyproject.toml'
|
|
48
|
-
|
|
49
|
-
filenameGitHubAction = 'updateCitation.yml'
|
|
50
|
-
pathFilenameGitHubAction = pathRepoRoot / '.github' / 'workflows' / filenameGitHubAction
|
|
51
|
-
|
|
52
|
-
filenameCitationDOTcff = 'CITATION.cff'
|
|
53
|
-
pathCitations = pathRepoRoot / packageName / 'citations'
|
|
54
|
-
pathFilenameCitationSSOT = pathCitations / filenameCitationDOTcff
|
|
55
|
-
pathFilenameCitationDOTcffRepo = pathRepoRoot / filenameCitationDOTcff
|
|
56
|
-
|
|
57
|
-
tomlPackageData: Dict[str, Any] = tomli.loads(pathFilenamePackageSSOT.read_text())['project']
|
|
58
|
-
|
|
59
|
-
citationObject: cffconvert.Citation = create_citation(infile=pathFilenameCitationSSOT, url=None)
|
|
60
|
-
|
|
61
|
-
path_cffconvert = pathlib.Path(inspect.getfile(cffconvert)).parent
|
|
62
|
-
pathFilenameSchema = path_cffconvert / "schemas/1.2.0/schema.json"
|
|
63
|
-
scheme: Dict[str, Any] = json.loads(pathFilenameSchema.read_text())
|
|
64
|
-
schemaSpecifications: Dict[str, Any] = scheme['properties']
|
|
65
|
-
|
|
66
|
-
for property, subProperties in schemaSpecifications.items():
|
|
67
|
-
print(property, subProperties.get('items', None))
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
from mapFolding import getPathFilenameFoldsTotal
|
|
2
|
-
from mapFolding import outfitCountFolds
|
|
3
|
-
from typing import Any, Optional, Sequence, Type
|
|
4
|
-
import pathlib
|
|
5
|
-
import pickle
|
|
6
|
-
|
|
7
|
-
def makeStateJob(listDimensions: Sequence[int], **keywordArguments: Optional[Type[Any]]) -> pathlib.Path:
|
|
8
|
-
|
|
9
|
-
stateUniversal = outfitCountFolds(listDimensions, computationDivisions=None, CPUlimit=None, **keywordArguments)
|
|
10
|
-
|
|
11
|
-
from syntheticModules import countInitialize
|
|
12
|
-
countInitialize(stateUniversal['connectionGraph'], stateUniversal['gapsWhere'], stateUniversal['my'], stateUniversal['track'])
|
|
13
|
-
|
|
14
|
-
pathFilenameChopChop = getPathFilenameFoldsTotal(stateUniversal['mapShape'])
|
|
15
|
-
suffix = pathFilenameChopChop.suffix
|
|
16
|
-
pathJob = pathlib.Path(str(pathFilenameChopChop)[0:-len(suffix)])
|
|
17
|
-
pathJob.mkdir(parents=True, exist_ok=True)
|
|
18
|
-
pathFilenameJob = pathJob / 'stateJob.pkl'
|
|
19
|
-
|
|
20
|
-
pathFilenameJob.write_bytes(pickle.dumps(stateUniversal))
|
|
21
|
-
return pathFilenameJob
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mapfolding-0.3.5 → mapfolding-0.3.6}/mapFolding/someAssemblyRequired/generalizeSourceCode.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|