mirror of
https://github.com/explosion/spaCy.git
synced 2025-04-22 10:02:01 +03:00
Use try/except instead of inspect
This commit is contained in:
parent
53c801359e
commit
4c99c9310c
|
@ -579,9 +579,8 @@ copy_reg.pickle(Vocab, pickle_vocab, unpickle_vocab)
|
|||
|
||||
|
||||
def _get_lex_attr_value(vocab, func, string):
|
||||
if "vocab" in inspect.signature(func).parameters:
|
||||
value = func(vocab, string)
|
||||
else:
|
||||
# TODO: add deprecation warning
|
||||
value = func(string)
|
||||
return value
|
||||
try:
|
||||
return func(vocab, string)
|
||||
except TypeError:
|
||||
# TODO: some kind of setting or deprecation warning
|
||||
return func(string)
|
||||
|
|
Loading…
Reference in New Issue
Block a user