Fix quoting in docstring, linting.

This commit is contained in:
Alexis Lahouze 2017-05-07 22:35:00 +02:00
parent b1d7e04a26
commit 16684a4938

View File

@ -21,7 +21,7 @@ from .operations import Operation
class Account(db.Model): class Account(db.Model):
"Model class to handle accounts." """Model class to handle accounts."""
# pylint: disable=invalid-name # pylint: disable=invalid-name
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(200), nullable=False) name = db.Column(db.String(200), nullable=False)
@ -33,7 +33,7 @@ class Account(db.Model):
@classmethod @classmethod
def query(cls, begin=None, end=None): def query(cls, begin=None, end=None):
"Return a query for this class method." """Return a query for this class method."""
return db.session.query( return db.session.query(
cls cls
).order_by( ).order_by(
@ -41,7 +41,7 @@ class Account(db.Model):
) )
def solds(self): def solds(self):
"Return the solds of this account." """Return the solds of this account."""
# TODO Alexis Lahouze 2017-05-04 Rename to "balances" # TODO Alexis Lahouze 2017-05-04 Rename to "balances"
return db.session.query( return db.session.query(
db.func.sum(Operation.value).label("future"), db.func.sum(Operation.value).label("future"),
@ -64,7 +64,7 @@ class Account(db.Model):
).one() ).one()
def balance(self, begin, end): def balance(self, begin, end):
"Return the balance for a specific time period." """Return the balance for a specific time period."""
# TODO Alexis Lahouze 2017-05-04 Rename to "flow" or "cash flow" # TODO Alexis Lahouze 2017-05-04 Rename to "flow" or "cash flow"
query = db.session.query( query = db.session.query(
db.func.sum( db.func.sum(
@ -93,8 +93,9 @@ class Account(db.Model):
return query.one() return query.one()
@db.validates('authorized_overdraft') @db.validates('authorized_overdraft')
# pylint: disable=no-self-use
def validate_authorized_overdraft(self, key, authorized_overdraft): def validate_authorized_overdraft(self, key, authorized_overdraft):
"Validator for authorized_overdraft : must be negative." """Validator for authorized_overdraft : must be negative."""
assert authorized_overdraft <= 0 assert authorized_overdraft <= 0
return authorized_overdraft return authorized_overdraft