From e56215235c1857cef0a9a8543b74a2c7f224d182 Mon Sep 17 00:00:00 2001 From: calvin Date: Fri, 3 Feb 2006 23:58:30 +0000 Subject: [PATCH] cleanup git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3058 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- linkcheck/decorators.py | 50 ++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/linkcheck/decorators.py b/linkcheck/decorators.py index 6dc4da5a..e07f3296 100644 --- a/linkcheck/decorators.py +++ b/linkcheck/decorators.py @@ -158,24 +158,24 @@ class memoized (object): not re-evaluated. """ - def __init__(self, func): - self.func = func - self.cache = {} + def __init__(self, func): + self.func = func + self.cache = {} - def __call__(self, *args): - try: - return self.cache[args] - except KeyError: - self.cache[args] = value = self.func(*args) - return value - except TypeError: - # uncachable -- for instance, passing a list as an argument. - # Better to not cache than to blow up entirely. - return self.func(*args) + def __call__(self, *args): + try: + return self.cache[args] + except KeyError: + self.cache[args] = value = self.func(*args) + return value + except TypeError: + # uncachable -- for instance, passing a list as an argument. + # Better to not cache than to blow up entirely. + return self.func(*args) - def __repr__(self): - """Return the function's docstring.""" - return self.func.__doc__ + def __repr__(self): + """Return the function's docstring.""" + return self.func.__doc__ class curried (object): @@ -185,14 +185,14 @@ class curried (object): evaluated. """ - def __init__(self, func, *a): - self.func = func - self.args = a + def __init__(self, func, *a): + self.func = func + self.args = a - def __call__(self, *a): - args = self.args + a - if len(args) < self.func.func_code.co_argcount: - return curried(self.func, *args) - else: - return self.func(*args) + def __call__(self, *a): + args = self.args + a + if len(args) < self.func.func_code.co_argcount: + return curried(self.func, *args) + else: + return self.func(*args)