lru-dict
Advanced tools
+12
-7
@@ -1,7 +0,7 @@ | ||
| Metadata-Version: 2.1 | ||
| Metadata-Version: 2.4 | ||
| Name: lru-dict | ||
| Version: 1.3.0 | ||
| Version: 1.4.1 | ||
| Summary: An Dict like LRU container. | ||
| Author: Amit Dev | ||
| License: MIT | ||
| License-Expression: MIT | ||
| Project-URL: Homepage, https://github.com/amitdev/lru-dict | ||
@@ -11,3 +11,2 @@ Keywords: lru,dict | ||
| Classifier: Intended Audience :: Developers | ||
| Classifier: License :: OSI Approved :: MIT License | ||
| Classifier: Operating System :: OS Independent | ||
@@ -17,3 +16,2 @@ Classifier: Operating System :: POSIX | ||
| Classifier: Programming Language :: Python :: 3 | ||
| Classifier: Programming Language :: Python :: 3.8 | ||
| Classifier: Programming Language :: Python :: 3.9 | ||
@@ -23,5 +21,7 @@ Classifier: Programming Language :: Python :: 3.10 | ||
| Classifier: Programming Language :: Python :: 3.12 | ||
| Classifier: Programming Language :: Python :: 3.13 | ||
| Classifier: Programming Language :: Python :: 3.14 | ||
| Classifier: Programming Language :: Python :: Implementation :: CPython | ||
| Classifier: Topic :: Software Development :: Libraries :: Python Modules | ||
| Requires-Python: >=3.8 | ||
| Requires-Python: >=3.9 | ||
| Description-Content-Type: text/x-rst | ||
@@ -31,2 +31,3 @@ License-File: LICENSE | ||
| Requires-Dist: pytest; extra == "test" | ||
| Dynamic: license-file | ||
@@ -39,2 +40,6 @@ .. image:: https://github.com/amitdev/lru-dict/actions/workflows/tests.yml/badge.svg | ||
| .. image:: https://img.shields.io/badge/maintainers-wanted-red.svg | ||
| **Note**: This project is stable and production ready, but looking for a lead maintainer. Preferably someone who uses this library and made contributions to it. | ||
| LRU Dict | ||
@@ -54,3 +59,3 @@ ======== | ||
| .. code:: python | ||
| .. code:: python3 | ||
@@ -57,0 +62,0 @@ from lru import LRU |
+15
-8
@@ -0,4 +1,8 @@ | ||
| [build-system] | ||
| requires = ["setuptools==80.9.0"] | ||
| build-backend = "setuptools.build_meta" | ||
| [project] | ||
| name = "lru-dict" | ||
| version = "1.3.0" | ||
| version = "1.4.1" | ||
| description = "An Dict like LRU container." | ||
@@ -9,5 +13,6 @@ authors = [ | ||
| dependencies = [] | ||
| requires-python = ">=3.8" | ||
| requires-python = ">=3.9" | ||
| readme = "README.rst" | ||
| license = {text = "MIT"} | ||
| license = "MIT" | ||
| license-files = ["LICENSE"] | ||
| keywords = ["lru", "dict"] | ||
@@ -17,3 +22,2 @@ classifiers = [ | ||
| "Intended Audience :: Developers", | ||
| "License :: OSI Approved :: MIT License", | ||
| "Operating System :: OS Independent", | ||
@@ -23,3 +27,2 @@ "Operating System :: POSIX", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3.8", | ||
| "Programming Language :: Python :: 3.9", | ||
@@ -29,2 +32,4 @@ "Programming Language :: Python :: 3.10", | ||
| "Programming Language :: Python :: 3.12", | ||
| "Programming Language :: Python :: 3.13", | ||
| "Programming Language :: Python :: 3.14", | ||
| "Programming Language :: Python :: Implementation :: CPython", | ||
@@ -40,4 +45,6 @@ "Topic :: Software Development :: Libraries :: Python Modules", | ||
| [build-system] | ||
| requires = ["setuptools>=61", "wheel"] | ||
| build-backend = "setuptools.build_meta" | ||
| [tool.cibuildwheel] | ||
| test-extras = ["test"] | ||
| test-sources = ["test"] | ||
| test-command = "python -m pytest -v" | ||
| xbuild-tools = [] |
+5
-1
@@ -7,2 +7,6 @@ .. image:: https://github.com/amitdev/lru-dict/actions/workflows/tests.yml/badge.svg | ||
| .. image:: https://img.shields.io/badge/maintainers-wanted-red.svg | ||
| **Note**: This project is stable and production ready, but looking for a lead maintainer. Preferably someone who uses this library and made contributions to it. | ||
| LRU Dict | ||
@@ -22,3 +26,3 @@ ======== | ||
| .. code:: python | ||
| .. code:: python3 | ||
@@ -25,0 +29,0 @@ from lru import LRU |
@@ -1,7 +0,7 @@ | ||
| Metadata-Version: 2.1 | ||
| Metadata-Version: 2.4 | ||
| Name: lru-dict | ||
| Version: 1.3.0 | ||
| Version: 1.4.1 | ||
| Summary: An Dict like LRU container. | ||
| Author: Amit Dev | ||
| License: MIT | ||
| License-Expression: MIT | ||
| Project-URL: Homepage, https://github.com/amitdev/lru-dict | ||
@@ -11,3 +11,2 @@ Keywords: lru,dict | ||
| Classifier: Intended Audience :: Developers | ||
| Classifier: License :: OSI Approved :: MIT License | ||
| Classifier: Operating System :: OS Independent | ||
@@ -17,3 +16,2 @@ Classifier: Operating System :: POSIX | ||
| Classifier: Programming Language :: Python :: 3 | ||
| Classifier: Programming Language :: Python :: 3.8 | ||
| Classifier: Programming Language :: Python :: 3.9 | ||
@@ -23,5 +21,7 @@ Classifier: Programming Language :: Python :: 3.10 | ||
| Classifier: Programming Language :: Python :: 3.12 | ||
| Classifier: Programming Language :: Python :: 3.13 | ||
| Classifier: Programming Language :: Python :: 3.14 | ||
| Classifier: Programming Language :: Python :: Implementation :: CPython | ||
| Classifier: Topic :: Software Development :: Libraries :: Python Modules | ||
| Requires-Python: >=3.8 | ||
| Requires-Python: >=3.9 | ||
| Description-Content-Type: text/x-rst | ||
@@ -31,2 +31,3 @@ License-File: LICENSE | ||
| Requires-Dist: pytest; extra == "test" | ||
| Dynamic: license-file | ||
@@ -39,2 +40,6 @@ .. image:: https://github.com/amitdev/lru-dict/actions/workflows/tests.yml/badge.svg | ||
| .. image:: https://img.shields.io/badge/maintainers-wanted-red.svg | ||
| **Note**: This project is stable and production ready, but looking for a lead maintainer. Preferably someone who uses this library and made contributions to it. | ||
| LRU Dict | ||
@@ -54,3 +59,3 @@ ======== | ||
| .. code:: python | ||
| .. code:: python3 | ||
@@ -57,0 +62,0 @@ from lru import LRU |
+21
-35
@@ -72,3 +72,3 @@ #include <Python.h> | ||
| assert(self->next == NULL); | ||
| PyObject_Del((PyObject*)self); | ||
| Py_TYPE(self)->tp_free((PyObject *)self); | ||
| } | ||
@@ -203,4 +203,4 @@ | ||
| if (self->callback) { | ||
| arglist = Py_BuildValue("OO", n->key, n->value); | ||
| lru_remove_node(self, n); | ||
| result = PyObject_CallObject(self->callback, arglist); | ||
@@ -210,8 +210,9 @@ Py_XDECREF(result); | ||
| } | ||
| lru_remove_node(self, n); | ||
| else { | ||
| lru_remove_node(self, n); | ||
| } | ||
| PUT_NODE(self->dict, n->key, NULL); | ||
| } | ||
| static Py_ssize_t | ||
| static inline Py_ssize_t | ||
| lru_length(LRU *self) | ||
@@ -225,7 +226,5 @@ { | ||
| { | ||
| if (PyDict_Contains(self->dict, key)) { | ||
| if (PyDict_Contains(self->dict, key)) | ||
| Py_RETURN_TRUE; | ||
| } else { | ||
| Py_RETURN_FALSE; | ||
| } | ||
| Py_RETURN_FALSE; | ||
| } | ||
@@ -287,5 +286,4 @@ | ||
| if (!default_obj) { | ||
| if (!default_obj) | ||
| Py_RETURN_NONE; | ||
| } | ||
@@ -457,11 +455,5 @@ Py_INCREF(default_obj); | ||
| { | ||
| if (self->first) { | ||
| PyObject *tuple = PyTuple_New(2); | ||
| Py_INCREF(self->first->key); | ||
| PyTuple_SET_ITEM(tuple, 0, self->first->key); | ||
| Py_INCREF(self->first->value); | ||
| PyTuple_SET_ITEM(tuple, 1, self->first->value); | ||
| return tuple; | ||
| } | ||
| else Py_RETURN_NONE; | ||
| if (self->first) | ||
| return Py_BuildValue("OO", self->first->key, self->first->value); | ||
| Py_RETURN_NONE; | ||
| } | ||
@@ -472,11 +464,5 @@ | ||
| { | ||
| if (self->last) { | ||
| PyObject *tuple = PyTuple_New(2); | ||
| Py_INCREF(self->last->key); | ||
| PyTuple_SET_ITEM(tuple, 0, self->last->key); | ||
| Py_INCREF(self->last->value); | ||
| PyTuple_SET_ITEM(tuple, 1, self->last->value); | ||
| return tuple; | ||
| } | ||
| else Py_RETURN_NONE; | ||
| if (self->last) | ||
| return Py_BuildValue("OO", self->last->key, self->last->value); | ||
| Py_RETURN_NONE; | ||
| } | ||
@@ -700,6 +686,6 @@ | ||
| LRU_clear(self); | ||
| Py_DECREF(self->dict); | ||
| Py_CLEAR(self->dict); | ||
| Py_XDECREF(self->callback); | ||
| } | ||
| PyObject_Del((PyObject*)self); | ||
| Py_TYPE(self)->tp_free((PyObject *)self); | ||
| } | ||
@@ -742,3 +728,3 @@ | ||
| 0, /* tp_as_buffer */ | ||
| Py_TPFLAGS_DEFAULT, /* tp_flags */ | ||
| Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ | ||
| lru_doc, /* tp_doc */ | ||
@@ -761,3 +747,3 @@ 0, /* tp_traverse */ | ||
| 0, /* tp_alloc */ | ||
| 0, /* tp_new */ | ||
| PyType_GenericNew, /* tp_new */ | ||
| }; | ||
@@ -784,7 +770,7 @@ | ||
| NodeType.tp_new = PyType_GenericNew; | ||
| LRUType.tp_base = &PyBaseObject_Type; | ||
| if (PyType_Ready(&NodeType) < 0) | ||
| return NULL; | ||
| LRUType.tp_new = PyType_GenericNew; | ||
| if (PyType_Ready(&LRUType) < 0) | ||
@@ -791,0 +777,0 @@ return NULL; |
+10
-0
@@ -377,4 +377,14 @@ import gc | ||
| def test_subclassing(self): | ||
| class LRUChild(LRU): | ||
| ... | ||
| l = LRUChild(1) | ||
| l['a'] = 1 | ||
| self.assertEqual(l['a'], 1) | ||
| self.assertEqual(l.keys(), ['a']) | ||
| self.assertEqual(l.values(), [1]) | ||
| if __name__ == '__main__': | ||
| unittest.main() |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
53091
1.52%402
2.03%