Convert to black formatting

This commit is contained in:
Alan Pryor
2019-08-03 12:55:38 -04:00
parent 9bdaa8f161
commit 9b136b1ffa
59 changed files with 512 additions and 476 deletions

View File

@@ -1,3 +1 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .seed_command import SeedCommand

View File

@@ -19,30 +19,26 @@ def seed_things():
def seed_thing(cls):
things = [
{
'name': 'Pizza Slicer',
'purpose': 'Cut delicious pizza',
},
{
'name': 'Rolling Pin',
'purpose': 'Roll delicious pizza',
},
{
'name': 'Pizza Oven',
'purpose': 'Bake delicious pizza',
},
{"name": "Pizza Slicer", "purpose": "Cut delicious pizza"},
{"name": "Rolling Pin", "purpose": "Roll delicious pizza"},
{"name": "Pizza Oven", "purpose": "Bake delicious pizza"},
]
db.session.bulk_insert_mappings(cls, things)
class SeedCommand(Command):
""" Seed the DB."""
def run(self):
if input('Are you sure you want to drop all tables and recreate? (y/N)\n'
).lower() == 'y':
print('Dropping tables...')
if (
input(
"Are you sure you want to drop all tables and recreate? (y/N)\n"
).lower()
== "y"
):
print("Dropping tables...")
db.drop_all()
db.create_all()
seed_things()
db.session.commit()
print('DB successfully seeded.')
print("DB successfully seeded.")