方法返回类的实例,可以继续调用类下面的其他方法,形如:is_cancel = f_d_do.is_cancel_maybe().get_or_else(False)

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()
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值