summaryrefslogtreecommitdiff
path: root/django/core/management/commands/createcachetable.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-03-28 18:33:29 -0400
committerTim Graham <timograham@gmail.com>2016-04-08 09:51:06 -0400
commitdf8d8d4292684d6ffa7474f1e201aed486f02b53 (patch)
treec661bf9b33de5288afe4f63347a2a9c768ef98eb /django/core/management/commands/createcachetable.py
parent2956e2f5e3f63d279f5dae2a995265364d3e6db1 (diff)
Fixed E128 flake8 warnings in django/.
Diffstat (limited to 'django/core/management/commands/createcachetable.py')
-rw-r--r--django/core/management/commands/createcachetable.py30
1 files changed, 17 insertions, 13 deletions
diff --git a/django/core/management/commands/createcachetable.py b/django/core/management/commands/createcachetable.py
index 4a6456b536..f80fa8834e 100644
--- a/django/core/management/commands/createcachetable.py
+++ b/django/core/management/commands/createcachetable.py
@@ -15,16 +15,20 @@ class Command(BaseCommand):
requires_system_checks = False
def add_arguments(self, parser):
- parser.add_argument('args', metavar='table_name', nargs='*',
- help='Optional table names. Otherwise, settings.CACHES is used to '
- 'find cache tables.')
- parser.add_argument('--database', action='store', dest='database',
+ parser.add_argument(
+ 'args', metavar='table_name', nargs='*',
+ help='Optional table names. Otherwise, settings.CACHES is used to find cache tables.',
+ )
+ parser.add_argument(
+ '--database', action='store', dest='database',
default=DEFAULT_DB_ALIAS,
help='Nominates a database onto which the cache tables will be '
- 'installed. Defaults to the "default" database.')
- parser.add_argument('--dry-run', action='store_true', dest='dry_run',
- help='Does not create the table, just prints the SQL that would '
- 'be run.')
+ 'installed. Defaults to the "default" database.',
+ )
+ parser.add_argument(
+ '--dry-run', action='store_true', dest='dry_run',
+ help='Does not create the table, just prints the SQL that would be run.',
+ )
def handle(self, *tablenames, **options):
db = options['database']
@@ -72,9 +76,10 @@ class Command(BaseCommand):
field_output.append("UNIQUE")
if f.db_index:
unique = "UNIQUE " if f.unique else ""
- index_output.append("CREATE %sINDEX %s ON %s (%s);" %
- (unique, qn('%s_%s' % (tablename, f.name)), qn(tablename),
- qn(f.name)))
+ index_output.append(
+ "CREATE %sINDEX %s ON %s (%s);" %
+ (unique, qn('%s_%s' % (tablename, f.name)), qn(tablename), qn(f.name))
+ )
table_output.append(" ".join(field_output))
full_statement = ["CREATE TABLE %s (" % qn(tablename)]
for i, line in enumerate(table_output):
@@ -89,8 +94,7 @@ class Command(BaseCommand):
self.stdout.write(statement)
return
- with transaction.atomic(using=database,
- savepoint=connection.features.can_rollback_ddl):
+ with transaction.atomic(using=database, savepoint=connection.features.can_rollback_ddl):
with connection.cursor() as curs:
try:
curs.execute(full_statement)