diff --git a/accountant/run.py b/accountant/run.py index b069fc8..327337c 100644 --- a/accountant/run.py +++ b/accountant/run.py @@ -30,6 +30,6 @@ def add(email, password): user.email = email user.password = User.hash_password(password) - db.session.add(user) + db.session.add(user) # pylint: disable=no-member click.echo("User '%s' successfully added." % email) diff --git a/accountant/views/accounts.py b/accountant/views/accounts.py index 09980cb..46a4c4d 100644 --- a/accountant/views/accounts.py +++ b/accountant/views/accounts.py @@ -116,8 +116,10 @@ range_parser.add_argument( location='args', help='End date of the time period' ) +# pylint: enable=invalid-name +# pylint: disable=no-self-use @ns.route('/') @ns.doc( security='apikey', @@ -156,10 +158,10 @@ class AccountListResource(Resource): account = Account(**data) # Add new account in session. - db.session.add(account) + db.session.add(account) # pylint: disable=no-member # Flush session to have id in account. - db.session.flush() + db.session.flush() # pylint: disable=no-member # Return account. return account, 201 @@ -226,7 +228,7 @@ class AccountResource(Resource): for k, v in data.items(): setattr(account, k, v) - db.session.merge(account) + db.session.merge(account) # pylint: disable=no-member # Return account. return account, 200 @@ -246,7 +248,7 @@ class AccountResource(Resource): error_message='Account with id %d not found.' % account_id ) - db.session.delete(account) + db.session.delete(account) # pylint: disable=no-member return None, 204 diff --git a/accountant/views/operations.py b/accountant/views/operations.py index 08cf746..a9a7fd8 100644 --- a/accountant/views/operations.py +++ b/accountant/views/operations.py @@ -86,8 +86,10 @@ account_range_parser.add_argument( location='args', help='Id of the account' ) +# pylint: enable=invalid-name +# pylint: disable=no-self-use @ns.route('/') @ns.doc( security='apikey', @@ -141,7 +143,7 @@ class OperationListResource(Resource): operation = Operation(**data) - db.session.add(operation) + db.session.add(operation) # pylint: disable=no-member return operation, 201 @@ -165,7 +167,9 @@ class OperationResource(Resource): def get(self, operation_id): """Get operation.""" + # pylint: disable=no-member operation = db.session.query(Operation).get(operation_id) + # pylint: enable=no-member if not operation: ns.abort( @@ -192,7 +196,9 @@ class OperationResource(Resource): error_message='Id must not be provided or changed on update.' ) + # pylint: disable=no-member operation = db.session.query(Operation).get(operation_id) + # pylint: enable=no-member if not operation: ns.abort( @@ -206,7 +212,7 @@ class OperationResource(Resource): for k, v in data.items(): setattr(operation, k, v) - db.session.merge(operation) + db.session.merge(operation) # pylint: disable=no-member return operation, 200 @@ -216,7 +222,9 @@ class OperationResource(Resource): def delete(self, operation_id): """Delete an operation.""" + # pylint: disable=no-member operation = db.session.query(Operation).get(operation_id) + # pylint: enable=no-member if not operation: ns.abort( @@ -224,6 +232,6 @@ class OperationResource(Resource): error_message='Operation with id %d not found.' % operation_id ) - db.session.delete(operation) + db.session.delete(operation) # pylint: disable=no-member return None, 204 diff --git a/accountant/views/scheduled_operations.py b/accountant/views/scheduled_operations.py index 7aa2c12..7e9ce90 100644 --- a/accountant/views/scheduled_operations.py +++ b/accountant/views/scheduled_operations.py @@ -64,8 +64,10 @@ account_id_parser.add_argument( location='args', help='Id of the account' ) +# pylint: enable=invalid-name +# pylint: disable=no-self-use @ns.route('/') @ns.doc( security='apikey', @@ -115,11 +117,11 @@ class ScheduledOperationListResource(Resource): scheduled_operation = ScheduledOperation(**data) - db.session.add(scheduled_operation) + db.session.add(scheduled_operation) # pylint: disable=no-member scheduled_operation.reschedule() - db.session.flush() + db.session.flush() # pylint: disable=no-member return scheduled_operation, 201 @@ -187,11 +189,11 @@ class ScheduledOperationResource(Resource): for k, v in data.items(): setattr(scheduled_operation, k, v) - db.session.merge(scheduled_operation) + db.session.merge(scheduled_operation) # pylint: disable=no-member scheduled_operation.reschedule() - db.session.flush() + db.session.flush() # pylint: disable=no-member return scheduled_operation, 200 @@ -225,6 +227,6 @@ class ScheduledOperationResource(Resource): # Delete unconfirmed operations scheduled_operation.operations.delete() - db.session.delete(scheduled_operation) + db.session.delete(scheduled_operation) # pylint: disable=no-member return None, 204 diff --git a/accountant/views/users.py b/accountant/views/users.py index f7489ad..5088eb7 100644 --- a/accountant/views/users.py +++ b/accountant/views/users.py @@ -46,8 +46,10 @@ user_model = ns.model('User', { readonly=True, description='Active state of the user') }) +# pylint: enable=invalid-name +# pylint: disable=no-self-use @ns.route('/login') class LoginResource(Resource): """Resource to handle login operations."""