lru-dict
Advanced tools
+1
-1
@@ -1,2 +0,2 @@ | ||
| Copyright (c) 2013-2014 Amit Dev R | ||
| Copyright (c) Amit Dev R | ||
@@ -3,0 +3,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
| Metadata-Version: 1.1 | ||
| Name: lru-dict | ||
| Version: 1.1.3 | ||
| Summary: An Dict like LRU container. | ||
| Version: 1.1.4 | ||
| Summary: A fast and memory efficient LRU cache. | ||
| Home-page: https://github.com/amitdev/lru-dict | ||
@@ -55,2 +55,6 @@ Author: Amit Dev | ||
| # Would print 3 | ||
| print l.has_key(5) | ||
| # Would print True | ||
| print 2 in l | ||
| # Would print True | ||
@@ -57,0 +61,0 @@ l.get_stats() |
| LICENSE | ||
| MANIFEST | ||
| MANIFEST.in | ||
@@ -4,0 +3,0 @@ README.rst |
+34
-6
@@ -185,8 +185,4 @@ #include <Python.h> | ||
| static PyObject * | ||
| LRU_contains(LRU *self, PyObject *args) | ||
| LRU_contains_key(LRU *self, PyObject *key) | ||
| { | ||
| PyObject *key; | ||
| if (!PyArg_ParseTuple(args, "O", &key)) | ||
| return NULL; | ||
| if (PyDict_Contains(self->dict, key)) { | ||
@@ -200,2 +196,17 @@ Py_RETURN_TRUE; | ||
| static PyObject * | ||
| LRU_contains(LRU *self, PyObject *args) | ||
| { | ||
| PyObject *key; | ||
| if (!PyArg_ParseTuple(args, "O", &key)) | ||
| return NULL; | ||
| return LRU_contains_key(self, key); | ||
| } | ||
| static int | ||
| LRU_seq_contains(LRU *self, PyObject *key) | ||
| { | ||
| return PyDict_Contains(self->dict, key); | ||
| } | ||
| static PyObject * | ||
| lru_subscript(LRU *self, register PyObject *key) | ||
@@ -409,3 +420,20 @@ { | ||
| /* Hack to implement "key in lru" */ | ||
| static PySequenceMethods lru_as_sequence = { | ||
| 0, /* sq_length */ | ||
| 0, /* sq_concat */ | ||
| 0, /* sq_repeat */ | ||
| 0, /* sq_item */ | ||
| 0, /* sq_slice */ | ||
| 0, /* sq_ass_item */ | ||
| 0, /* sq_ass_slice */ | ||
| (objobjproc) LRU_seq_contains, /* sq_contains */ | ||
| 0, /* sq_inplace_concat */ | ||
| 0, /* sq_inplace_repeat */ | ||
| }; | ||
| static PyMethodDef LRU_methods[] = { | ||
| {"__contains__", (PyCFunction)LRU_contains_key, METH_O | METH_COEXIST, | ||
| PyDoc_STR("L.__contains__(key) -> Check if key is there in L")}, | ||
| {"keys", (PyCFunction)LRU_keys, METH_NOARGS, | ||
@@ -491,3 +519,3 @@ PyDoc_STR("L.keys() -> list of L's keys in MRU order")}, | ||
| 0, /* tp_as_number */ | ||
| 0, /* tp_as_sequence */ | ||
| &lru_as_sequence, /* tp_as_sequence */ | ||
| &LRU_as_mapping, /* tp_as_mapping */ | ||
@@ -494,0 +522,0 @@ 0, /* tp_hash */ |
+6
-2
| Metadata-Version: 1.1 | ||
| Name: lru-dict | ||
| Version: 1.1.3 | ||
| Summary: An Dict like LRU container. | ||
| Version: 1.1.4 | ||
| Summary: A fast and memory efficient LRU cache. | ||
| Home-page: https://github.com/amitdev/lru-dict | ||
@@ -55,2 +55,6 @@ Author: Amit Dev | ||
| # Would print 3 | ||
| print l.has_key(5) | ||
| # Would print True | ||
| print 2 in l | ||
| # Would print True | ||
@@ -57,0 +61,0 @@ l.get_stats() |
+4
-0
@@ -47,2 +47,6 @@ LRU Dict | ||
| # Would print 3 | ||
| print l.has_key(5) | ||
| # Would print True | ||
| print 2 in l | ||
| # Would print True | ||
@@ -49,0 +53,0 @@ l.get_stats() |
+2
-2
@@ -7,4 +7,4 @@ from setuptools import setup, Extension | ||
| setup (name = 'lru-dict', | ||
| version = '1.1.3', | ||
| description = 'An Dict like LRU container.', | ||
| version = '1.1.4', | ||
| description = 'A fast and memory efficient LRU cache.', | ||
| long_description = open('README.rst').read(), | ||
@@ -11,0 +11,0 @@ author='Amit Dev', |
+8
-0
@@ -90,2 +90,10 @@ import gc | ||
| def test_contains(self): | ||
| for size in SIZES: | ||
| l = LRU(size) | ||
| for i in range(size): | ||
| l[i] = str(i) | ||
| for i in range(size): | ||
| self.assertTrue(i in l) | ||
| def test_access(self): | ||
@@ -92,0 +100,0 @@ for size in SIZES: |
-8
| # file GENERATED by distutils, do NOT edit | ||
| LICENSE | ||
| MANIFEST | ||
| MANIFEST.in | ||
| README.rst | ||
| lru.c | ||
| setup.py | ||
| test/test_lru.py |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
35909
4.07%229
3.15%12
-7.69%