我编写了一个带有参数'matcher'的规则引擎,它可以是一个字符串,一个正则表达式或一个函数.
当我测试并使用此匹配器时:
if hasattr(self.matcher, '__call__'): # ??
match_this_rule = self.matcher(input_msg)
Run Code Online (Sandbox Code Playgroud)
PyCharm在第二行给我一个警告,说'匹配器不可调用'.
我怎么能避免PyCharm显示这个?
我在一个小nodejs项目中使用Sequelize,使用mysql数据库.
使用findOrCreate,我可以找到现有对象并插入新对象,但是当新对象创建并返回时,主键是"未定义".
module.exports = function(sequelize, DataTypes) {
var Student = sequelize.define('Student', {
id : {
type : DataTypes.BIGINT,
primaryKey : true
},
wxid : DataTypes.STRING,
client : DataTypes.STRING,
nick : DataTypes.STRING,
wallet : {type: DataTypes.INTEGER, defaultValue: 0},
mcount : {type: DataTypes.INTEGER, defaultValue: 0},
qcount : {type: DataTypes.INTEGER, defaultValue: 0},
status : {type: DataTypes.INTEGER, defaultValue: 0},
premium_type : {type: DataTypes.INTEGER, defaultValue: 0},
createtime : DataTypes.DATE,
lastqtime : DataTypes.DATE,
lastmtime : DataTypes.DATE
}, {
freezeTableName : true,
timestamps : …Run Code Online (Sandbox Code Playgroud)