cachehash 1.0.1__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.
- cachehash-1.0.1/.editorconfig +11 -0
- cachehash-1.0.1/.flake8 +15 -0
- cachehash-1.0.1/.github/.tmp/.generated-actions/run-pypi-publish-in-docker-container/action.yml +1 -0
- cachehash-1.0.1/.github/PULL_REQUEST_TEMPLATE.md +16 -0
- cachehash-1.0.1/.github/dependabot.yml +14 -0
- cachehash-1.0.1/.github/workflows/release.yml +105 -0
- cachehash-1.0.1/.gitignore +162 -0
- cachehash-1.0.1/LICENSE +87 -0
- cachehash-1.0.1/PKG-INFO +24 -0
- cachehash-1.0.1/README.md +2 -0
- cachehash-1.0.1/VERSION +1 -0
- cachehash-1.0.1/VERSION.py +1 -0
- cachehash-1.0.1/make_version.py +21 -0
- cachehash-1.0.1/pyproject.toml +47 -0
- cachehash-1.0.1/pytest.ini +6 -0
- cachehash-1.0.1/requirements.txt +7 -0
- cachehash-1.0.1/src/cachehash/__init__.py +0 -0
- cachehash-1.0.1/src/cachehash/main.py +103 -0
- cachehash-1.0.1/src/cachehash/sql/delete_record.sql +2 -0
- cachehash-1.0.1/src/cachehash/sql/get_record.sql +3 -0
- cachehash-1.0.1/src/cachehash/sql/insert_record.sql +1 -0
- cachehash-1.0.1/src/cachehash/sql/make_table.sql +5 -0
- cachehash-1.0.1/test/test_basic.py +24 -0
cachehash-1.0.1/.flake8
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[flake8]
|
|
2
|
+
per-file-ignores =
|
|
3
|
+
# line too long
|
|
4
|
+
src/verinfast/agent.py: E501, E722, W605
|
|
5
|
+
src/verinfast/cloud/aws/blocks.py: E501
|
|
6
|
+
src/verinfast/dependencies/walkers/gemwalker.py: E501
|
|
7
|
+
VERSION.py: W292
|
|
8
|
+
exclude =
|
|
9
|
+
build
|
|
10
|
+
__pycache__
|
|
11
|
+
manage.py
|
|
12
|
+
settings.py
|
|
13
|
+
env
|
|
14
|
+
.env
|
|
15
|
+
VERSION.py
|
cachehash-1.0.1/.github/.tmp/.generated-actions/run-pypi-publish-in-docker-container/action.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name": "🏃", "description": "Run Docker container to upload Python distribution packages to PyPI", "inputs": {"user": {"description": "PyPI user", "required": false}, "password": {"description": "Password for your PyPI user or an access token", "required": false}, "repository-url": {"description": "The repository URL to use", "required": false}, "packages-dir": {"description": "The target directory for distribution", "required": false}, "verify-metadata": {"description": "Check metadata before uploading", "required": false}, "skip-existing": {"description": "Do not fail if a Python package distribution exists in the target package index", "required": false}, "verbose": {"description": "Show verbose output.", "required": false}, "print-hash": {"description": "Show hash values of files to be uploaded", "required": false}, "attestations": {"description": "[EXPERIMENTAL] Enable experimental support for PEP 740 attestations. Only works with PyPI and TestPyPI via Trusted Publishing.", "required": false}}, "runs": {"using": "docker", "image": "docker://ghcr.io/pypa/gh-action-pypi-publish:release-v1"}}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!-- Thank you for your contribution! -->
|
|
2
|
+
|
|
3
|
+
<!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. -->
|
|
4
|
+
|
|
5
|
+
## Why are these changes needed?
|
|
6
|
+
|
|
7
|
+
<!-- Please give a short summary of the change and the problem this solves. -->
|
|
8
|
+
|
|
9
|
+
## Related issue number
|
|
10
|
+
|
|
11
|
+
<!-- For example: "Closes #1234" -->
|
|
12
|
+
|
|
13
|
+
## Checks
|
|
14
|
+
|
|
15
|
+
- [ ] I've added tests (if relevant) corresponding to the changes introduced in this PR.
|
|
16
|
+
- [ ] I've made sure all auto checks have passed.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
updates:
|
|
8
|
+
- package-ecosystem: "pip" # See documentation for possible values
|
|
9
|
+
directory: "/" # Location of package manifests
|
|
10
|
+
schedule:
|
|
11
|
+
interval: "daily"
|
|
12
|
+
ignore:
|
|
13
|
+
- dependency-name: "*"
|
|
14
|
+
update-types: ["version-update:semver-patch"]
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
name: "Python Release"
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- main
|
|
6
|
+
pull_request:
|
|
7
|
+
branches:
|
|
8
|
+
- main
|
|
9
|
+
release:
|
|
10
|
+
types: [created]
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
inputs:
|
|
13
|
+
logLevel:
|
|
14
|
+
description: 'Log level'
|
|
15
|
+
required: true
|
|
16
|
+
default: 'warning'
|
|
17
|
+
type: choice
|
|
18
|
+
options:
|
|
19
|
+
- info
|
|
20
|
+
- warning
|
|
21
|
+
- debug
|
|
22
|
+
jobs:
|
|
23
|
+
unit-tests:
|
|
24
|
+
permissions:
|
|
25
|
+
contents: 'read'
|
|
26
|
+
id-token: 'write'
|
|
27
|
+
strategy:
|
|
28
|
+
matrix:
|
|
29
|
+
os: [ubuntu-latest, macos-latest]
|
|
30
|
+
runs-on: ${{ matrix.os }}
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v4
|
|
33
|
+
|
|
34
|
+
- name: Set up Python
|
|
35
|
+
uses: actions/setup-python@v5
|
|
36
|
+
with:
|
|
37
|
+
python-version: "3.12"
|
|
38
|
+
- name: Set up Node
|
|
39
|
+
uses: actions/setup-node@v4
|
|
40
|
+
with:
|
|
41
|
+
node-version: 20
|
|
42
|
+
- name: Install pypa/build
|
|
43
|
+
run: >-
|
|
44
|
+
python3 -m
|
|
45
|
+
pip install
|
|
46
|
+
build hatchling setuptools
|
|
47
|
+
--user
|
|
48
|
+
- name: Make VERSION
|
|
49
|
+
run: python make_version.py
|
|
50
|
+
- name: install self
|
|
51
|
+
run: pip install -e .
|
|
52
|
+
- name: Unit Tests
|
|
53
|
+
run: |
|
|
54
|
+
echo "Attempting PyTest"
|
|
55
|
+
pytest
|
|
56
|
+
- name: Upload coverage to Codecov
|
|
57
|
+
uses: codecov/codecov-action@v4
|
|
58
|
+
with:
|
|
59
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
60
|
+
- name: Style Guide
|
|
61
|
+
run: flake8
|
|
62
|
+
build-and-publish:
|
|
63
|
+
permissions:
|
|
64
|
+
contents: 'read'
|
|
65
|
+
id-token: 'write'
|
|
66
|
+
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
|
|
67
|
+
needs: unit-tests
|
|
68
|
+
runs-on: ubuntu-latest
|
|
69
|
+
steps:
|
|
70
|
+
- uses: actions/checkout@v4
|
|
71
|
+
- name: Set up Python
|
|
72
|
+
uses: actions/setup-python@v5
|
|
73
|
+
with:
|
|
74
|
+
python-version: "3.12"
|
|
75
|
+
- name: Install pypa/build
|
|
76
|
+
run: >-
|
|
77
|
+
python3 -m
|
|
78
|
+
pip install
|
|
79
|
+
build
|
|
80
|
+
--user
|
|
81
|
+
- name: Make VERSION
|
|
82
|
+
run: python make_version.py
|
|
83
|
+
- name: Build a binary wheel and a source tarball
|
|
84
|
+
run: >-
|
|
85
|
+
python3 -m
|
|
86
|
+
build
|
|
87
|
+
--sdist
|
|
88
|
+
--wheel
|
|
89
|
+
--outdir dist/
|
|
90
|
+
.
|
|
91
|
+
- name: Publish distribution 📦 to Test PyPI
|
|
92
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
93
|
+
with:
|
|
94
|
+
repository-url: https://test.pypi.org/legacy/
|
|
95
|
+
- name: Build a binary wheel and a source tarball
|
|
96
|
+
run: >-
|
|
97
|
+
rm -rf dist && python3 -m
|
|
98
|
+
build
|
|
99
|
+
--sdist
|
|
100
|
+
--wheel
|
|
101
|
+
--outdir dist/
|
|
102
|
+
.
|
|
103
|
+
- name: Publish distribution 📦 to PyPI
|
|
104
|
+
if: startsWith(github.ref, 'refs/tags')
|
|
105
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
110
|
+
.pdm.toml
|
|
111
|
+
.pdm-python
|
|
112
|
+
.pdm-build/
|
|
113
|
+
|
|
114
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
115
|
+
__pypackages__/
|
|
116
|
+
|
|
117
|
+
# Celery stuff
|
|
118
|
+
celerybeat-schedule
|
|
119
|
+
celerybeat.pid
|
|
120
|
+
|
|
121
|
+
# SageMath parsed files
|
|
122
|
+
*.sage.py
|
|
123
|
+
|
|
124
|
+
# Environments
|
|
125
|
+
.env
|
|
126
|
+
.venv
|
|
127
|
+
env/
|
|
128
|
+
venv/
|
|
129
|
+
ENV/
|
|
130
|
+
env.bak/
|
|
131
|
+
venv.bak/
|
|
132
|
+
|
|
133
|
+
# Spyder project settings
|
|
134
|
+
.spyderproject
|
|
135
|
+
.spyproject
|
|
136
|
+
|
|
137
|
+
# Rope project settings
|
|
138
|
+
.ropeproject
|
|
139
|
+
|
|
140
|
+
# mkdocs documentation
|
|
141
|
+
/site
|
|
142
|
+
|
|
143
|
+
# mypy
|
|
144
|
+
.mypy_cache/
|
|
145
|
+
.dmypy.json
|
|
146
|
+
dmypy.json
|
|
147
|
+
|
|
148
|
+
# Pyre type checker
|
|
149
|
+
.pyre/
|
|
150
|
+
|
|
151
|
+
# pytype static type analyzer
|
|
152
|
+
.pytype/
|
|
153
|
+
|
|
154
|
+
# Cython debug symbols
|
|
155
|
+
cython_debug/
|
|
156
|
+
|
|
157
|
+
# PyCharm
|
|
158
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
159
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
160
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
161
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
162
|
+
#.idea/
|
cachehash-1.0.1/LICENSE
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Creative Commons Attribution-NonCommercial 4.0 International Public License
|
|
2
|
+
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
|
|
3
|
+
|
|
4
|
+
Section 1 – Definitions.
|
|
5
|
+
|
|
6
|
+
Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
|
|
7
|
+
Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
|
|
8
|
+
Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
|
|
9
|
+
Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
|
|
10
|
+
Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
|
|
11
|
+
Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
|
|
12
|
+
Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
|
|
13
|
+
Licensor means the individual(s) or entity(ies) granting rights under this Public License.
|
|
14
|
+
NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
|
|
15
|
+
Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
|
|
16
|
+
Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
|
|
17
|
+
You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
|
|
18
|
+
Section 2 – Scope.
|
|
19
|
+
|
|
20
|
+
License grant.
|
|
21
|
+
Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
|
|
22
|
+
reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
|
|
23
|
+
produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
|
|
24
|
+
Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
|
|
25
|
+
Term. The term of this Public License is specified in Section 6(a).
|
|
26
|
+
Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
|
|
27
|
+
Downstream recipients.
|
|
28
|
+
Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
|
|
29
|
+
No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
|
|
30
|
+
No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
|
|
31
|
+
Other rights.
|
|
32
|
+
|
|
33
|
+
Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
|
|
34
|
+
Patent and trademark rights are not licensed under this Public License.
|
|
35
|
+
To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
|
|
36
|
+
Section 3 – License Conditions.
|
|
37
|
+
|
|
38
|
+
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
|
|
39
|
+
|
|
40
|
+
Attribution.
|
|
41
|
+
|
|
42
|
+
If You Share the Licensed Material (including in modified form), You must:
|
|
43
|
+
|
|
44
|
+
retain the following if it is supplied by the Licensor with the Licensed Material:
|
|
45
|
+
identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
|
|
46
|
+
a copyright notice;
|
|
47
|
+
a notice that refers to this Public License;
|
|
48
|
+
a notice that refers to the disclaimer of warranties;
|
|
49
|
+
a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
|
|
50
|
+
indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
|
|
51
|
+
indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
|
|
52
|
+
You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
|
|
53
|
+
If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
|
|
54
|
+
If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.
|
|
55
|
+
Section 4 – Sui Generis Database Rights.
|
|
56
|
+
|
|
57
|
+
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
|
|
58
|
+
|
|
59
|
+
for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
|
|
60
|
+
if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
|
|
61
|
+
You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
|
|
62
|
+
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
|
|
63
|
+
Section 5 – Disclaimer of Warranties and Limitation of Liability.
|
|
64
|
+
|
|
65
|
+
Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
|
|
66
|
+
To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
|
|
67
|
+
The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
|
|
68
|
+
Section 6 – Term and Termination.
|
|
69
|
+
|
|
70
|
+
This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
|
|
71
|
+
Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
|
|
72
|
+
|
|
73
|
+
automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
|
|
74
|
+
upon express reinstatement by the Licensor.
|
|
75
|
+
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
|
|
76
|
+
For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
|
|
77
|
+
Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
|
|
78
|
+
Section 7 – Other Terms and Conditions.
|
|
79
|
+
|
|
80
|
+
The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
|
|
81
|
+
Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
|
|
82
|
+
Section 8 – Interpretation.
|
|
83
|
+
|
|
84
|
+
For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
|
|
85
|
+
To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
|
|
86
|
+
No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
|
|
87
|
+
Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
|
cachehash-1.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: cachehash
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: This tool memoizes data to sqlite.
|
|
5
|
+
Project-URL: Homepage, https://github.com/VerinFast/cachehash
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/VerinFast/cachehash/issues
|
|
7
|
+
Project-URL: Source, https://github.com/VerinFast/cachehash
|
|
8
|
+
Author-email: Jason Nichols <github@verinfast.com>, Sean Conrad <github@verinfast.com>
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: License :: Free for non-commercial use
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Requires-Python: <3.13,>=3.10
|
|
14
|
+
Requires-Dist: coverage~=7.6.4
|
|
15
|
+
Requires-Dist: flake8-pytest-style~=2.0.0
|
|
16
|
+
Requires-Dist: flake8~=7.1.1
|
|
17
|
+
Requires-Dist: pytest-cov~=6.0.0
|
|
18
|
+
Requires-Dist: pytest-xdist~=3.6.1
|
|
19
|
+
Requires-Dist: pytest~=8.3.3
|
|
20
|
+
Requires-Dist: xxhash>=3.5.0
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# cachehash
|
|
24
|
+
A python library for storing data about files in sqlite
|
cachehash-1.0.1/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.0.1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '1.0.1'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import datetime
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# Get the version from the git tag, and write to VERSION.
|
|
6
|
+
ref = None
|
|
7
|
+
if "GITHUB_REF" in os.environ:
|
|
8
|
+
ref = os.environ["GITHUB_REF"]
|
|
9
|
+
|
|
10
|
+
if ref and ref is not None and ref.startswith("refs/tags/"):
|
|
11
|
+
version = ref.replace("refs/tags/", "")
|
|
12
|
+
else:
|
|
13
|
+
version = datetime.datetime.now().strftime("%Y.%m.%d%H%M%S")
|
|
14
|
+
|
|
15
|
+
print(version)
|
|
16
|
+
|
|
17
|
+
with open("VERSION", "w") as f:
|
|
18
|
+
f.write(version)
|
|
19
|
+
|
|
20
|
+
with open("VERSION.py", "w") as f:
|
|
21
|
+
f.write("__version__ = '" + str(version) + "'")
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [
|
|
3
|
+
"hatchling",
|
|
4
|
+
"setuptools",
|
|
5
|
+
"setuptools_scm[toml]>=6.0",
|
|
6
|
+
"build",
|
|
7
|
+
"hatch-requirements-txt"
|
|
8
|
+
]
|
|
9
|
+
build-backend = "hatchling.build"
|
|
10
|
+
|
|
11
|
+
[project]
|
|
12
|
+
name = "cachehash"
|
|
13
|
+
authors = [
|
|
14
|
+
{ name="Jason Nichols", email="github@verinfast.com" },
|
|
15
|
+
{ name="Sean Conrad", email="github@verinfast.com"}
|
|
16
|
+
]
|
|
17
|
+
description = "This tool memoizes data to sqlite."
|
|
18
|
+
readme = "README.md"
|
|
19
|
+
requires-python = ">=3.10,<3.13"
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"License :: Free for non-commercial use",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
]
|
|
25
|
+
dynamic = ["dependencies", "version"]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
"Homepage" = "https://github.com/VerinFast/cachehash"
|
|
29
|
+
"Bug Tracker" = "https://github.com/VerinFast/cachehash/issues"
|
|
30
|
+
"Source" = "https://github.com/VerinFast/cachehash"
|
|
31
|
+
|
|
32
|
+
# [project.scripts]
|
|
33
|
+
# verinfast = "cachehash.main:main"
|
|
34
|
+
|
|
35
|
+
[tool.pytest.ini_options]
|
|
36
|
+
addopts = [
|
|
37
|
+
"--import-mode=importlib",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[tool.setuptools.packages.find]
|
|
41
|
+
where = ["src"]
|
|
42
|
+
|
|
43
|
+
[tool.hatch.version]
|
|
44
|
+
path = "VERSION.py"
|
|
45
|
+
|
|
46
|
+
[tool.hatch.metadata.hooks.requirements_txt]
|
|
47
|
+
files = ["requirements.txt"]
|
|
File without changes
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import sqlite3
|
|
3
|
+
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from xxhash import xxh32 as xh
|
|
7
|
+
|
|
8
|
+
default_path = Path('./temp.db')
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Cache:
|
|
12
|
+
# BUF_SIZE is totally arbitrary
|
|
13
|
+
BUF_SIZE = 65536 # default 64kb chunks
|
|
14
|
+
|
|
15
|
+
def __init__(self, path: Path = default_path, table: str = "cachehash"):
|
|
16
|
+
self.db_path = path
|
|
17
|
+
self.db = sqlite3.connect(path)
|
|
18
|
+
|
|
19
|
+
def dict_factory(cursor, row):
|
|
20
|
+
d = {}
|
|
21
|
+
for idx, col in enumerate(cursor.description):
|
|
22
|
+
d[col[0]] = row[idx]
|
|
23
|
+
return d
|
|
24
|
+
|
|
25
|
+
self.db.row_factory = dict_factory
|
|
26
|
+
self.cur = self.db.cursor()
|
|
27
|
+
self.table_name = table
|
|
28
|
+
self.query("make_table")
|
|
29
|
+
|
|
30
|
+
def query(self, file_name: str, parameters=None):
|
|
31
|
+
cur_path = Path(__file__).parent.resolve().absolute()
|
|
32
|
+
path = Path(f'{cur_path}/sql/{file_name}.sql')
|
|
33
|
+
with open(path, "r") as f:
|
|
34
|
+
query = f.read()
|
|
35
|
+
query = query.replace("<table_name>", f'"{self.table_name}"')
|
|
36
|
+
if parameters is not None:
|
|
37
|
+
return self.cur.execute(query, parameters)
|
|
38
|
+
else:
|
|
39
|
+
return self.cur.execute(query)
|
|
40
|
+
|
|
41
|
+
def hash_file(self, fp: Path) -> str:
|
|
42
|
+
h = xh()
|
|
43
|
+
with open(fp, 'rb') as f:
|
|
44
|
+
while True:
|
|
45
|
+
data = f.read(self.BUF_SIZE)
|
|
46
|
+
if not data:
|
|
47
|
+
break
|
|
48
|
+
h.update(data)
|
|
49
|
+
return h.hexdigest()
|
|
50
|
+
|
|
51
|
+
def get(
|
|
52
|
+
self, file_path: str | Path,
|
|
53
|
+
only_valid: bool = True
|
|
54
|
+
) -> str | None:
|
|
55
|
+
fp: str
|
|
56
|
+
if type(file_path) is str:
|
|
57
|
+
fp = file_path
|
|
58
|
+
file_path = Path(file_path)
|
|
59
|
+
else:
|
|
60
|
+
fp = str(file_path)
|
|
61
|
+
|
|
62
|
+
if not file_path.exists():
|
|
63
|
+
raise ValueError(f"{file_path} does not exist")
|
|
64
|
+
hash = self.hash_file(file_path)
|
|
65
|
+
row = self.query(
|
|
66
|
+
'get_record',
|
|
67
|
+
{
|
|
68
|
+
"key": fp,
|
|
69
|
+
}).fetchone()
|
|
70
|
+
if row is None:
|
|
71
|
+
return None
|
|
72
|
+
else:
|
|
73
|
+
if row["hash"] == hash or not only_valid:
|
|
74
|
+
return json.loads(row["val"])
|
|
75
|
+
else:
|
|
76
|
+
return None
|
|
77
|
+
|
|
78
|
+
def set(self, file_path: str | Path, values: dict):
|
|
79
|
+
fp: str
|
|
80
|
+
if type(file_path) is str:
|
|
81
|
+
fp = file_path
|
|
82
|
+
file_path = Path(file_path)
|
|
83
|
+
elif type(file_path) is Path:
|
|
84
|
+
fp = str(file_path)
|
|
85
|
+
else:
|
|
86
|
+
raise ValueError("Invalid file_path")
|
|
87
|
+
if not file_path.exists():
|
|
88
|
+
raise ValueError(f"{file_path} does not exist")
|
|
89
|
+
|
|
90
|
+
if isinstance(values, dict):
|
|
91
|
+
values = json.dumps(values, indent=4)
|
|
92
|
+
else:
|
|
93
|
+
raise ValueError("Must pass values as a dict")
|
|
94
|
+
|
|
95
|
+
hash = self.hash_file(file_path)
|
|
96
|
+
self.query(
|
|
97
|
+
"insert_record",
|
|
98
|
+
{
|
|
99
|
+
"key": fp,
|
|
100
|
+
"hash": str(hash),
|
|
101
|
+
"value": values,
|
|
102
|
+
}
|
|
103
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
insert into <table_name> values (:key, :hash, json(:value))
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import datetime
|
|
3
|
+
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from time import sleep
|
|
6
|
+
|
|
7
|
+
from cachehash.main import Cache
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_basics():
|
|
11
|
+
test_db = Path("test.db")
|
|
12
|
+
assert not test_db.exists(), "Test DB exists"
|
|
13
|
+
cache = Cache("test.db")
|
|
14
|
+
now = str(datetime.datetime.now())
|
|
15
|
+
sleep(0.1)
|
|
16
|
+
this_file = os.path.abspath(__file__)
|
|
17
|
+
cache.set(this_file, {"now": now})
|
|
18
|
+
sleep(0.1)
|
|
19
|
+
new_now = cache.get(this_file)["now"]
|
|
20
|
+
|
|
21
|
+
assert test_db.exists(), "Test DB not created"
|
|
22
|
+
assert now == new_now, "Invalid 'now"
|
|
23
|
+
os.remove(test_db)
|
|
24
|
+
assert not test_db.exists(), "Test DB not removed"
|