From dfc807e65b810033389fa0a72a82e12e06309abc Mon Sep 17 00:00:00 2001 From: cloudaice Date: Thu, 23 May 2013 00:25:45 +0200 Subject: [PATCH] Don't lose nformation about a function when using a decorator --- jieba/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jieba/__init__.py b/jieba/__init__.py index d30a021..0666724 100644 --- a/jieba/__init__.py +++ b/jieba/__init__.py @@ -10,6 +10,7 @@ import marshal from math import log import random import threading +from functools import wraps DICTIONARY = "dict.txt" DICT_LOCK = threading.RLock() @@ -98,7 +99,8 @@ def initialize(*args): def require_initialized(fn): global initialized,DICTIONARY - + + @wraps(fn) def wrapped(*args, **kwargs): if initialized: return fn(*args, **kwargs)