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):
"Model class to handle accounts."
"""Model class to handle accounts."""
# pylint: disable=invalid-name
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(200), nullable=False)
@ -33,7 +33,7 @@ class Account(db.Model):
@classmethod
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(
cls
).order_by(
@ -41,7 +41,7 @@ class Account(db.Model):
)
def solds(self):
"Return the solds of this account."
"""Return the solds of this account."""
# TODO Alexis Lahouze 2017-05-04 Rename to "balances"
return db.session.query(
db.func.sum(Operation.value).label("future"),
@ -64,7 +64,7 @@ class Account(db.Model):
).one()
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"
query = db.session.query(
db.func.sum(
@ -93,8 +93,9 @@ class Account(db.Model):
return query.one()
@db.validates('authorized_overdraft')
# pylint: disable=no-self-use
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
return authorized_overdraft