diff options
author | emkael <emkael@tlen.pl> | 2014-10-07 11:00:51 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2014-10-07 11:00:51 +0200 |
commit | 6298e63ddb46d01d9e272f8830186d1d7482751a (patch) | |
tree | 46d873294c03483859fb357be2d1663fa230ed87 | |
parent | 7127fd85771045a62030dc9cef840a347b639308 (diff) |
* isort-ed imports
-rwxr-xr-x | elo.py | 11 | ||||
-rw-r--r-- | f1elo/db.py | 8 | ||||
-rw-r--r-- | f1elo/elo.py | 6 | ||||
-rw-r--r-- | f1elo/model.py | 6 | ||||
-rw-r--r-- | import-csv.py | 7 |
5 files changed, 19 insertions, 19 deletions
@@ -1,10 +1,12 @@ #!/usr/bin/env python +import argparse +import datetime + +import dateutil.parser +import dateutil.relativedelta from f1elo.db import Session -from f1elo.model import * from f1elo.elo import Elo -import dateutil.parser, dateutil.relativedelta -import datetime -import argparse +from f1elo.model import * session = Session() elo = Elo(session) @@ -86,4 +88,3 @@ for rank in sorted(drivers.values(), key=lambda rank: rank.ranking, reverse=True print rank session.commit() - diff --git a/f1elo/db.py b/f1elo/db.py index 49ccc3d..dc40ba1 100644 --- a/f1elo/db.py +++ b/f1elo/db.py @@ -1,16 +1,15 @@ -import __main__ +import json from os import path +import __main__ +from f1elo.model import Driver from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker -import json - config = json.load(open(path.dirname(__main__.__file__) + '/config/db.json')) engine = create_engine("mysql://{0[user]}:{0[pass]}@{0[host]}/{0[db]}?charset=utf8".format(config)) Session = sessionmaker(bind=engine) -from f1elo.model import Driver def find_driver(name, country, session): driver = session.query(Driver).filter(Driver.driver==name).first() @@ -22,4 +21,3 @@ def find_driver(name, country, session): driver.country = country session.add(driver) return driver - diff --git a/f1elo/elo.py b/f1elo/elo.py index 3ddc6e4..cb35e6c 100644 --- a/f1elo/elo.py +++ b/f1elo/elo.py @@ -1,10 +1,10 @@ -import __main__ +import json +from itertools import combinations from os import path +import __main__ from f1elo.model import * -import json -from itertools import combinations class Elo: def __init__(self, session): diff --git a/f1elo/model.py b/f1elo/model.py index 3133a59..7b340fa 100644 --- a/f1elo/model.py +++ b/f1elo/model.py @@ -1,7 +1,7 @@ -from sqlalchemy import Column, Table, ForeignKey -from sqlalchemy.types import Date, Float, Integer, String, Boolean -from sqlalchemy.orm import backref, relationship, sessionmaker +from sqlalchemy import Column, ForeignKey, Table from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import backref, relationship, sessionmaker +from sqlalchemy.types import Boolean, Date, Float, Integer, String Base = declarative_base() diff --git a/import-csv.py b/import-csv.py index de0eb7a..ae4b9e6 100644 --- a/import-csv.py +++ b/import-csv.py @@ -1,10 +1,11 @@ -from f1elo.db import Session, find_driver -from f1elo.model import * +import csv import sys +from f1elo.db import find_driver, Session +from f1elo.model import * + session = Session() -import csv with open(sys.argv[1]) as f: reader = csv.reader(f) for row in reader: |