mirror of
https://github.com/fxsjy/jieba.git
synced 2025-07-24 00:00:05 +08:00
Merge pull request #53 from cloudaice/devbranch
Don't lose nformation about a function when using a decorator
This commit is contained in:
commit
0bda20db82
@ -10,6 +10,7 @@ import marshal
|
|||||||
from math import log
|
from math import log
|
||||||
import random
|
import random
|
||||||
import threading
|
import threading
|
||||||
|
from functools import wraps
|
||||||
|
|
||||||
DICTIONARY = "dict.txt"
|
DICTIONARY = "dict.txt"
|
||||||
DICT_LOCK = threading.RLock()
|
DICT_LOCK = threading.RLock()
|
||||||
@ -99,6 +100,7 @@ def initialize(*args):
|
|||||||
def require_initialized(fn):
|
def require_initialized(fn):
|
||||||
global initialized,DICTIONARY
|
global initialized,DICTIONARY
|
||||||
|
|
||||||
|
@wraps(fn)
|
||||||
def wrapped(*args, **kwargs):
|
def wrapped(*args, **kwargs):
|
||||||
if initialized:
|
if initialized:
|
||||||
return fn(*args, **kwargs)
|
return fn(*args, **kwargs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user