[Python-modules-commits] r8254 - in packages/python-whoosh/trunk/debian/patches (1 file)
odd_bloke-guest at users.alioth.debian.org
odd_bloke-guest at users.alioth.debian.org
Tue Apr 14 11:38:31 UTC 2009
Date: Tuesday, April 14, 2009 @ 11:38:30
Author: odd_bloke-guest
Revision: 8254
Even more Python 2.4 fixes.
Modified:
packages/python-whoosh/trunk/debian/patches/02-python2.4-fixes.diff
Modified: packages/python-whoosh/trunk/debian/patches/02-python2.4-fixes.diff
===================================================================
--- packages/python-whoosh/trunk/debian/patches/02-python2.4-fixes.diff 2009-04-14 11:05:43 UTC (rev 8253)
+++ packages/python-whoosh/trunk/debian/patches/02-python2.4-fixes.diff 2009-04-14 11:38:30 UTC (rev 8254)
@@ -74,3 +74,114 @@
from collections import defaultdict
from math import log
+Index: Whoosh-0.1.13/src/whoosh/fields.py
+===================================================================
+--- Whoosh-0.1.13.orig/src/whoosh/fields.py 2009-04-14 12:16:13.000000000 +0100
++++ Whoosh-0.1.13/src/whoosh/fields.py 2009-04-14 12:36:20.000000000 +0100
+@@ -20,9 +20,8 @@
+
+ """
+
+-from collections import defaultdict
+-
+ from whoosh.analysis import unstopped, IDAnalyzer, KeywordAnalyzer, StandardAnalyzer, NgramAnalyzer
++from whoosh.support.defaultdict import defaultdict
+
+ # Exceptions
+
+@@ -31,6 +30,16 @@
+ class UnknownFieldError(Exception):
+ pass
+
++try:
++ any
++except:
++ def any(iterable):
++ for element in iterable:
++ if element:
++ return True
++ return False
++
++
+ # Field Types
+
+ class FieldType(object):
+Index: Whoosh-0.1.13/src/whoosh/support/defaultdict.py
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ Whoosh-0.1.13/src/whoosh/support/defaultdict.py 2009-04-14 12:26:56.000000000 +0100
+@@ -0,0 +1,37 @@
++try:
++ from collections import defaultdict
++except:
++ class defaultdict(dict):
++ def __init__(self, default_factory=None, *a, **kw):
++ if (default_factory is not None and
++ not hasattr(default_factory, '__call__')):
++ raise TypeError('first argument must be callable')
++ dict.__init__(self, *a, **kw)
++ self.default_factory = default_factory
++ def __getitem__(self, key):
++ try:
++ return dict.__getitem__(self, key)
++ except KeyError:
++ return self.__missing__(key)
++ def __missing__(self, key):
++ if self.default_factory is None:
++ raise KeyError(key)
++ self[key] = value = self.default_factory()
++ return value
++ def __reduce__(self):
++ if self.default_factory is None:
++ args = tuple()
++ else:
++ args = self.default_factory,
++ return type(self), args, None, None, self.items()
++ def copy(self):
++ return self.__copy__()
++ def __copy__(self):
++ return type(self)(self.default_factory, self)
++ def __deepcopy__(self, memo):
++ import copy
++ return type(self)(self.default_factory,
++ copy.deepcopy(self.items()))
++ def __repr__(self):
++ return 'defaultdict(%s, %s)' % (self.default_factory,
++ dict.__repr__(self))
+Index: Whoosh-0.1.13/src/whoosh/writing.py
+===================================================================
+--- Whoosh-0.1.13.orig/src/whoosh/writing.py 2009-04-14 12:28:04.000000000 +0100
++++ Whoosh-0.1.13/src/whoosh/writing.py 2009-04-14 12:29:16.000000000 +0100
+@@ -19,11 +19,11 @@
+ """
+
+ from array import array
+-from collections import defaultdict
+ from tempfile import TemporaryFile
+
+ from whoosh import index, postpool, reading, structfile, tables
+ from whoosh.fields import UnknownFieldError
++from whoosh.support.defaultdict import defaultdict
+ from whoosh.util import fib
+
+ # Exceptions
+Index: Whoosh-0.1.13/src/whoosh/util.py
+===================================================================
+--- Whoosh-0.1.13.orig/src/whoosh/util.py 2009-04-14 12:33:53.000000000 +0100
++++ Whoosh-0.1.13/src/whoosh/util.py 2009-04-14 12:34:09.000000000 +0100
+@@ -18,7 +18,6 @@
+ Miscellaneous utility functions and classes.
+ """
+
+-from functools import wraps
+ from heapq import heappush, heapreplace
+
+ from whoosh.support.bitvector import BitVector
+@@ -171,7 +170,6 @@
+ have 'is_closed' and '_sync_lock' attributes.
+ """
+
+- @wraps(func)
+ def wrapper(self, *args, **kwargs):
+ if self.is_closed:
+ raise Exception("This object has been closed")
More information about the Python-modules-commits
mailing list