15
0
forked from pool/python-cachey

osc copypac from project:devel:languages:python:misc package:python-cachey revision:1

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cachey?expand=0&rev=1
This commit is contained in:
Tomáš Chvátal
2019-01-24 08:17:43 +00:00
committed by Git OBS Bridge
commit b72188ba45
6 changed files with 139 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

3
cachey-0.1.1.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:de1db64409158d40acdfdd869ccbca7ce90b2f2ba20d44fb68f32e72f5679f21
size 6058

22
fix_cache_clear.patch Normal file
View File

@@ -0,0 +1,22 @@
From 6d4aca78bdf846a4ab1d6755e58db3c671b4a3ea Mon Sep 17 00:00:00 2001
From: Dave Cole <david.cole@data61.csiro.au>
Date: Tue, 17 Jan 2017 14:42:53 +1100
Subject: [PATCH] Fix Cache.clear()
---
cachey/cache.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cachey/cache.py b/cachey/cache.py
index b8ad6bd..17442a5 100644
--- a/cachey/cache.py
+++ b/cachey/cache.py
@@ -142,7 +142,7 @@ def __contains__(self, key):
return key in self.data
def clear(self):
- while self:
+ while self.data:
self._shrink_one()
def __nonzero__(self):

6
python-cachey.changes Normal file
View File

@@ -0,0 +1,6 @@
-------------------------------------------------------------------
Mon May 22 19:12:01 UTC 2017 - toddrme2178@gmail.com
- Initial version
- Add fix_cache_clear.patch
Upstream patch to fix unit test error

84
python-cachey.spec Normal file
View File

@@ -0,0 +1,84 @@
#
# spec file for package python-cachey
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%bcond_without test
Name: python-cachey
Version: 0.1.1
Release: 0
Summary: Caching mindful of computation/storage costs
License: BSD-3-Clause
Group: Development/Languages/Python
Url: http://github.com/mrocklin/cachey/
Source: https://files.pythonhosted.org/packages/source/c/cachey/cachey-%{version}.tar.gz
# PATCH-FIX-UPSTREAM fix_cache_clear.patch - fix unit test error
Patch0: fix_cache_clear.patch
BuildRequires: %{python_module HeapDict}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
%if %{with test}
BuildRequires: %{python_module pytest}
%endif
Requires: python-HeapDict
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%python_subpackages
%description
Cachey tries to hold on to values that have the following characteristics
1. Expensive to recompute (in seconds)
2. Cheap to store (in bytes)
3. Frequently used
4. Recenty used
It accomplishes this by adding the following to each items score on each access
score += compute_time / num_bytes * (1 + eps) ** tick_time
For some small value of epsilon (which determines the memory halflife.) This
has units of inverse bandwidth, has exponential decay of old results and
roughly linear amplification of repeated results.
%prep
%setup -q -n cachey-%{version}
%patch0 -p1
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%if %{with test}
%check
%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitelib}
py.test-%{$python_bin_suffix}
}
%endif
%files %{python_files}
%defattr(-,root,root,-)
%doc LICENSE.txt README.md
%{python_sitelib}/*
%changelog