enterprise_code = u'9'的时候,会走正常预测,因为它有值not is_cancel
def _is_normal_predict(f_d_do, prob_maybe):
"""
符合正常预测条件
"""
is_cancel = f_d_do.is_cancel_maybe().get_or_else(False)
return not is_cancel and \
f_d_do.result_code == bC.DATA_STATE_NORMAL and \
prob_maybe.is_empty()
这个地方: f_d_do.is_cancel_maybe().get_or_else(False)这种连续调用剖析:
f_d_do.is_cancel_maybe()返回的是一个Maybe封装的实例对象,get_or_else()又是Maybe类的一个方法,所以可以直接调用
/home/sc/PycharmProjects/risk-model/common/utils/sub/maybe.py
def is_cancel_maybe(self):
"""
是否属于(已吊销,工商全库为停业,已告解散,"吊销","注销", "撤销")
"""
if self.__enterprise_code is not None:
return Maybe.some(BizConsts.ENTERPRISE_CODE_CANCEL == str(self.__enterprise_code))
else:
return Maybe.none()