mirror of
https://github.com/fxsjy/jieba.git
synced 2025-07-10 00:01:33 +08:00
Don't lose nformation about a function when using a decorator
This commit is contained in:
parent
df8e0ab44d
commit
dfc807e65b
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user