我收到以下错误:
class Validator {
constructor (body) {
this._body = body;
}
selector(str) {
this._selector = str;
return this;
}
minLength(num) {
this._minLength = num;
return this;
}
maxLength(num) {
this._maxLength = num;
return this;
}
validate() {
// run your validation logic here and return true or false accordingly
return true
}
}
const req = { body: 'body' };
const test = new Validator(req.body);
const myBoolean = test
.selector('firstName')
.minLength(2)
.maxLength(5)
.validate();
console.log('rules:');
console.log(test);
console.log(`result: ${myBoolean}`);
尽管,此错误已在
中解决。AttributeError: cannot assign module before Module.__init__() call
通过在类中包含AttributeError: cannot assign module before Module.__init__() call
方法,即使使用了建议的解决方案,我仍然继续收到相同的错误。
以下是我开发的课程:
super().__init__()