Browse Source

使用 callable 替代 isfunction

tags/v0.5.5
ChenXin 4 years ago
parent
commit
d2cc93cd6d
1 changed files with 1 additions and 2 deletions
  1. +1
    -2
      fastNLP/core/dataset.py

+ 1
- 2
fastNLP/core/dataset.py View File

@@ -288,7 +288,6 @@ __all__ = [
] ]


import _pickle as pickle import _pickle as pickle
from inspect import isfunction
from copy import deepcopy from copy import deepcopy


import numpy as np import numpy as np
@@ -874,7 +873,7 @@ class DataSet(object):
:return Dict[int:Field]: 返回一个字典 :return Dict[int:Field]: 返回一个字典
""" """
# 返回 dict , 检查是否一直相同 # 返回 dict , 检查是否一直相同
assert isfunction(func), "The func you provide is not callable."
assert callable(func), "The func you provide is not callable."
assert len(self) != 0, "Null DataSet cannot use apply()." assert len(self) != 0, "Null DataSet cannot use apply()."
idx = -1 idx = -1
try: try:


Loading…
Cancel
Save