Skip to content

Commit

Permalink
appease pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
nphilipp committed Nov 11, 2013
1 parent ffa90df commit 1a1fab0
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 24 deletions.
13 changes: 6 additions & 7 deletions alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def run_migrations_offline():
with context.begin_transaction():
context.run_migrations()


def run_migrations_online():
"""Run migrations in 'online' mode.
Expand All @@ -52,15 +53,14 @@ def run_migrations_online():
"""
engine = engine_from_config(
config.get_section(config.config_ini_section),
prefix='sqlalchemy.',
poolclass=pool.NullPool)
config.get_section(config.config_ini_section),
prefix='sqlalchemy.',
poolclass=pool.NullPool)

connection = engine.connect()
context.configure(
connection=connection,
target_metadata=target_metadata
)
connection=connection,
target_metadata=target_metadata)

trans = connection.begin()
try:
Expand All @@ -79,4 +79,3 @@ def run_migrations_online():
run_migrations_offline()
else:
run_migrations_online()

9 changes: 5 additions & 4 deletions alembic/versions/24282792d72a_add_created_by_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@


def upgrade():
op.add_column('invitations',
sa.Column('created_by', sa.Unicode(128), sa.ForeignKey('persons.id'),
nullable=False)
)
op.add_column(
'invitations',
sa.Column(
'created_by', sa.Unicode(128),
sa.ForeignKey('persons.id'), nullable=False))


def downgrade():
Expand Down
2 changes: 0 additions & 2 deletions alembic/versions/3c7fd5b4e2c2_add_two_new_columns_.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ def upgrade():
session.commit()




def downgrade():
op.drop_column(u'persons', 'opt_out')
op.drop_column(u'persons', 'created_on')
4 changes: 3 additions & 1 deletion alembic/versions/4099fa344171_add_last_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('persons', sa.Column('last_login', sa.DateTime(), nullable=True))
op.add_column(
'persons',
sa.Column('last_login', sa.DateTime(), nullable=True))
### end Alembic commands ###


Expand Down
6 changes: 3 additions & 3 deletions alembic/versions/420c02357a1b_add_created_on_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@


def upgrade():
op.add_column('badges', sa.Column('created_on', sa.DateTime,
nullable=False)
)
op.add_column(
'badges',
sa.Column('created_on', sa.DateTime, nullable=False))


def downgrade():
Expand Down
6 changes: 3 additions & 3 deletions alembic/versions/fa1d309e8c3_add_created_on_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@


def upgrade():
op.add_column('issuers', sa.Column('created_on', sa.DateTime,
nullable=False)
)
op.add_column(
'issuers',
sa.Column('created_on', sa.DateTime, nullable=False))


def downgrade():
Expand Down
7 changes: 3 additions & 4 deletions tahrir_api/dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from utils import autocommit
from model import Badge, Invitation, Issuer, Assertion, Person
from sqlalchemy import create_engine, func, and_
from sqlalchemy import create_engine, func, and_, not_
from sqlalchemy.orm import sessionmaker, scoped_session
from datetime import (
datetime,
Expand Down Expand Up @@ -682,7 +682,7 @@ def _make_leaderboard(self, start=None, stop=None):

leaderboard = leaderboard\
.order_by('count_1 desc')\
.filter(Person.opt_out == False)\
.filter(not_(Person.opt_out))\
.group_by(Person)\
.all()

Expand Down Expand Up @@ -711,7 +711,6 @@ def _make_leaderboard(self, start=None, stop=None):
prev_badges = badges
user_to_rank[user] = {
'badges': badges,
'rank': rank
}
'rank': rank}

return user_to_rank

0 comments on commit 1a1fab0

Please sign in to comment.