Skip to content
Snippets Groups Projects
Commit f68d4d8e authored by Brady James Garvin's avatar Brady James Garvin
Browse files

Updated codebase for 2019.

parent 3acba0b1
No related branches found
No related tags found
No related merge requests found
......@@ -2,5 +2,4 @@
*.pyo
.idea
.buildozer
bin
......@@ -3,14 +3,13 @@ from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
Persisted = declarative_base()
Persisted = declarative_base() # pylint: disable=invalid-name
class DietDatabase(object):
@staticmethod
def construct_mysql_url(authority, port, database, username, password):
return 'mysql+mysqlconnector://{username}:{password}@{authority}:{port}/{database}' \
.format(authority=authority, port=port, database=database, username=username, password=password)
return f'mysql+mysqlconnector://{username}:{password}@{authority}:{port}/{database}'
@staticmethod
def construct_in_memory_url():
......@@ -18,7 +17,7 @@ class DietDatabase(object):
def __init__(self, url):
self.engine = create_engine(url)
self.Session = sessionmaker()
self.Session = sessionmaker() # pylint: disable=invalid-name
self.Session.configure(bind=self.engine)
def ensure_tables_exist(self):
......
......
# -*- coding: utf-8; -*-
from sys import stderr
from sqlalchemy.exc import SQLAlchemyError
......@@ -10,7 +8,7 @@ from diet import DietDatabase
def add_starter_data(session):
pass # TODO: stub
pass
def main():
......@@ -25,7 +23,7 @@ def main():
print('Records created.')
except SQLAlchemyError as exception:
print('Database setup failed!', file=stderr)
print('Cause: {exception}'.format(exception=exception), file=stderr)
print(f'Cause: {exception}', file=stderr)
exit(1)
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment