circuitpython-functools 2.0.0.post0__tar.gz → 2.0.2__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.
- {circuitpython_functools-2.0.0.post0/circuitpython_functools.egg-info → circuitpython_functools-2.0.2}/PKG-INFO +2 -1
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2/circuitpython_functools.egg-info}/PKG-INFO +2 -1
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/circuitpython_functools.egg-info/requires.txt +1 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/circuitpython_functools.py +5 -23
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/optional_requirements.txt +2 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/pyproject.toml +1 -1
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/.github/workflows/build.yml +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/.github/workflows/failure-help-text.yml +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/.github/workflows/release_gh.yml +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/.github/workflows/release_pypi.yml +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/.gitignore +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/.pre-commit-config.yaml +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/.readthedocs.yaml +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/CODE_OF_CONDUCT.md +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/LICENSE-MIT +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/LICENSE-PSF +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/LICENSES/CC-BY-4.0.txt +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/LICENSES/MIT.txt +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/LICENSES/PSF-2.0.txt +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/LICENSES/Unlicense.txt +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/README.rst +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/README.rst.license +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/circuitpython_functools.egg-info/SOURCES.txt +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/circuitpython_functools.egg-info/dependency_links.txt +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/circuitpython_functools.egg-info/top_level.txt +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/docs/_static/favicon.ico +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/docs/_static/favicon.ico.license +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/docs/api.rst +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/docs/api.rst.license +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/docs/conf.py +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/docs/examples.rst +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/docs/examples.rst.license +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/docs/index.rst +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/docs/index.rst.license +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/docs/requirements.txt +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/examples/functools_simpletest.py +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/requirements.txt +0 -0
- {circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: circuitpython-functools
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: A CircuitPython implementation of CPython's functools library
|
|
5
5
|
Author-email: Alec Delaney <tekktrik@gmail.com>
|
|
6
6
|
License-Expression: MIT AND PSF-2.0
|
|
@@ -16,6 +16,7 @@ License-File: LICENSE-MIT
|
|
|
16
16
|
License-File: LICENSE-PSF
|
|
17
17
|
Requires-Dist: Adafruit-Blinka
|
|
18
18
|
Provides-Extra: optional
|
|
19
|
+
Requires-Dist: pre-commit~=4.1; extra == "optional"
|
|
19
20
|
Dynamic: license-file
|
|
20
21
|
|
|
21
22
|
Introduction
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: circuitpython-functools
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: A CircuitPython implementation of CPython's functools library
|
|
5
5
|
Author-email: Alec Delaney <tekktrik@gmail.com>
|
|
6
6
|
License-Expression: MIT AND PSF-2.0
|
|
@@ -16,6 +16,7 @@ License-File: LICENSE-MIT
|
|
|
16
16
|
License-File: LICENSE-PSF
|
|
17
17
|
Requires-Dist: Adafruit-Blinka
|
|
18
18
|
Provides-Extra: optional
|
|
19
|
+
Requires-Dist: pre-commit~=4.1; extra == "optional"
|
|
19
20
|
Dynamic: license-file
|
|
20
21
|
|
|
21
22
|
Introduction
|
{circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/circuitpython_functools.py
RENAMED
|
@@ -23,7 +23,7 @@ Implementation Notes
|
|
|
23
23
|
import gc
|
|
24
24
|
from collections import OrderedDict
|
|
25
25
|
|
|
26
|
-
__version__ = "2.0.
|
|
26
|
+
__version__ = "2.0.2"
|
|
27
27
|
__repo__ = "https://github.com/tekktrik/CircuitPython_functools.git"
|
|
28
28
|
|
|
29
29
|
_cache_records = {}
|
|
@@ -52,7 +52,7 @@ def _make_key(args, kwargs, kwd_mark=(_ObjectMark(),)):
|
|
|
52
52
|
return hash(key)
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
class
|
|
55
|
+
class _CachedFunc:
|
|
56
56
|
"""Wrapped unbounded cache function."""
|
|
57
57
|
|
|
58
58
|
def __init__(self, maxsize, user_func):
|
|
@@ -107,27 +107,9 @@ class CachedFunc:
|
|
|
107
107
|
gc.collect()
|
|
108
108
|
|
|
109
109
|
|
|
110
|
-
class LRUCachedFunc:
|
|
111
|
-
"""Wrapped LRU cache function."""
|
|
112
|
-
|
|
113
|
-
def __init__(self, wrapped_func, maxsize):
|
|
114
|
-
"""Initialize the wrapped LRU cache function."""
|
|
115
|
-
self._maxsize = maxsize
|
|
116
|
-
self._wrapped_func = wrapped_func
|
|
117
|
-
|
|
118
|
-
def __call__(self, *args, **kwargs):
|
|
119
|
-
"""Call the wrapped function."""
|
|
120
|
-
print(type(self._wrapped_func))
|
|
121
|
-
return self._wrapped_func(*args, **kwargs)
|
|
122
|
-
|
|
123
|
-
def cache_clear(self):
|
|
124
|
-
"""Clear the LRU cache."""
|
|
125
|
-
return self.cache_clear()
|
|
126
|
-
|
|
127
|
-
|
|
128
110
|
def cache(user_function):
|
|
129
111
|
"""Create an unbounded cache."""
|
|
130
|
-
return
|
|
112
|
+
return _CachedFunc(-1, user_function)
|
|
131
113
|
|
|
132
114
|
|
|
133
115
|
def lru_cache(*args, **kwargs):
|
|
@@ -139,13 +121,13 @@ def lru_cache(*args, **kwargs):
|
|
|
139
121
|
if len(args) == 1 and isinstance(args[0], int):
|
|
140
122
|
maxsize = args[0]
|
|
141
123
|
elif len(args) == 1 and str(type(args[0]) == "<class 'function'>"):
|
|
142
|
-
return
|
|
124
|
+
return _CachedFunc(128, args[0])
|
|
143
125
|
elif "maxsize" in kwargs:
|
|
144
126
|
maxsize = kwargs["maxsize"]
|
|
145
127
|
else:
|
|
146
128
|
raise SyntaxError("lru_cache syntax incorrect")
|
|
147
129
|
|
|
148
|
-
return partial(
|
|
130
|
+
return partial(_CachedFunc, maxsize)
|
|
149
131
|
|
|
150
132
|
|
|
151
133
|
# Partial ported from the MicroPython library
|
|
@@ -12,7 +12,7 @@ requires = [
|
|
|
12
12
|
[project]
|
|
13
13
|
name = "circuitpython-functools"
|
|
14
14
|
description = "A CircuitPython implementation of CPython's functools library"
|
|
15
|
-
version = "2.0.
|
|
15
|
+
version = "2.0.2"
|
|
16
16
|
readme = "README.rst"
|
|
17
17
|
authors = [
|
|
18
18
|
{name = "Alec Delaney", email = "tekktrik@gmail.com"}
|
|
File without changes
|
{circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/.github/workflows/build.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/.pre-commit-config.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/LICENSES/CC-BY-4.0.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/LICENSES/Unlicense.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/docs/_static/favicon.ico
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/docs/examples.rst.license
RENAMED
|
File without changes
|
|
File without changes
|
{circuitpython_functools-2.0.0.post0 → circuitpython_functools-2.0.2}/docs/index.rst.license
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|