def parse(cls, func):
if isinstance(func, six.string_types):
func = func.lower().strip()
if func in [np.equal, '=', 'eq', '-eq', '==', 'is', 'equal', 'equal to']:
return cls.eq
elif func in [np.not_equal, '<>', 'ne', '-ne', '!=', 'not', 'not_equal', 'not equal to']:
return cls.ne
elif func in [np.greater, '>', 'gt', '-gt', 'above', 'after', 'greater', 'greater than']:
return cls.gt
elif func in [np.less, '<', 'lt', '-lt', 'below', 'before', 'less', 'less than']:
return cls.lt
elif func in [np.greater_equal, '>=', 'ge', '-ge', 'greater_equal', 'greater than or equal to']:
return cls.ge
elif func in [np.less_equal, '<=', 'le', '-le', 'less_equal', 'less than or equal to']:
return cls.le
raise ValueError('Invalid Comparison name: %s'%func)
#
### Control Condition classes
#
评论列表
文章目录