Skip to content

Commit

Permalink
Revert "Merge pull request #142 from bmay2/master"
Browse files Browse the repository at this point in the history
This reverts commit c0f3bd1, reversing
changes made to 9cfc9c3.
  • Loading branch information
BurntSushi committed Mar 14, 2016
1 parent b470407 commit a8c1cae
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 42 deletions.
6 changes: 2 additions & 4 deletions nfldb/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,14 +535,12 @@ def _migrate_2(c):
team_id character varying (3) NOT NULL,
city character varying (50) NOT NULL,
name character varying (50) NOT NULL,
conference character varying (3) NOT NULL,
division character varying (50) NOT NULL
PRIMARY KEY (team_id)
)
''')
c.execute('''
INSERT INTO team (team_id, city, name, conference, division) VALUES %s
''' % (', '.join(_mogrify(c, team[0:5]) for team in nfldb.team.teams)))
INSERT INTO team (team_id, city, name) VALUES %s
''' % (', '.join(_mogrify(c, team[0:3]) for team in nfldb.team.teams)))

c.execute('''
CREATE TABLE player (
Expand Down
6 changes: 1 addition & 5 deletions nfldb/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def _append_conds(conds, entity, kwargs):

def _no_comp_suffix(s):
"""Removes the comparison operator suffix from a search field."""
return re.sub('__(eq|ne|gt|lt|ge|le|li)$', '', s)
return re.sub('__(eq|ne|gt|lt|ge|le)$', '', s)


def _comp_suffix(s):
Expand Down Expand Up @@ -327,7 +327,6 @@ def __init__(self, entity, kw, value):
suffixes = {
'__eq': '=', '__ne': '!=',
'__lt': '<', '__le': '<=', '__gt': '>', '__ge': '>=',
'__li': 'ilike'
}
for suffix, op in suffixes.items():
if kw.endswith(suffix):
Expand All @@ -354,9 +353,6 @@ def _sql_where(self, cursor, aliases=None, aggregate=False):
vals = [cursor.mogrify('%s', (v,)) for v in self.value]
return '%s IN (%s)' % (field, ', '.join(vals))
else:
if self.operator == "ilike":
self.value = '%' + self.value + '%'

paramed = '%s %s %s' % (field, self.operator, '%s')
return cursor.mogrify(paramed, (self.value,))

Expand Down
66 changes: 33 additions & 33 deletions nfldb/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,39 @@
# the update script.

teams = [
['ARI', 'Arizona', 'Cardinals', 'NFC', 'West', 'Arizona Cardinals'],
['ATL', 'Atlanta', 'Falcons', 'NFC', 'South', 'Atlanta Falcons'],
['BAL', 'Baltimore', 'Ravens', 'AFC', 'North', 'Baltimore Ravens'],
['BUF', 'Buffalo', 'Bills', 'AFC', 'East', 'Buffalo Bills'],
['CAR', 'Carolina', 'Panthers', 'NFC', 'South', 'Carolina Panthers'],
['CHI', 'Chicago', 'Bears', 'NFC', 'North', 'Chicago Bears'],
['CIN', 'Cincinnati', 'Bengals', 'AFC', 'North', 'Cincinnati Bengals'],
['CLE', 'Cleveland', 'Browns', 'AFC', 'North', 'Cleveland Browns'],
['DAL', 'Dallas', 'Cowboys', 'NFC', 'East', 'Dallas Cowboys'],
['DEN', 'Denver', 'Broncos', 'AFC', 'West', 'Denver Broncos'],
['DET', 'Detroit', 'Lions', 'NFC', 'North', 'Detroit Lions'],
['GB', 'Green Bay', 'Packers', 'NFC', 'North', 'Green Bay Packers', 'G.B.', 'GNB'],
['HOU', 'Houston', 'Texans', 'AFC', 'South', 'Houston Texans'],
['IND', 'Indianapolis', 'Colts', 'AFC', 'South', 'Indianapolis Colts'],
['JAC', 'Jacksonville', 'Jaguars', 'AFC', 'South', 'Jacksonville Jaguars', 'JAX'],
['KC', 'Kansas City', 'Chiefs', 'AFC', 'West', 'Kansas City Chiefs', 'K.C.', 'KAN'],
['MIA', 'Miami', 'Dolphins', 'AFC', 'East', 'Miami Dolphins'],
['MIN', 'Minnesota', 'Vikings', 'NFC', 'North', 'Minnesota Vikings'],
['NE', 'New England', 'Patriots', 'AFC', 'East', 'New England Patriots', 'N.E.', 'NWE'],
['NO', 'New Orleans', 'Saints', 'NFC', 'South', 'New Orleans Saints', 'N.O.', 'NOR'],
['NYG', 'New York', 'Giants', 'NFC', 'East', 'New York Giants', 'N.Y.G.'],
['NYJ', 'New York', 'Jets', 'AFC', 'East', 'New York Jets', 'N.Y.J.'],
['OAK', 'Oakland', 'Raiders', 'AFC', 'West', 'Oakland Raiders'],
['PHI', 'Philadelphia', 'Eagles', 'NFC', 'East', 'Philadelphia Eagles'],
['PIT', 'Pittsburgh', 'Steelers', 'AFC', 'North', 'Pittsburgh Steelers'],
['SD', 'San Diego', 'Chargers', 'AFC', 'West', 'San Diego Chargers', 'S.D.', 'SDG'],
['SEA', 'Seattle', 'Seahawks', 'NFC', 'West', 'Seattle Seahawks'],
['SF', 'San Francisco', '49ers', 'NFC', 'West', 'San Francisco 49ers', 'S.F.', 'SFO'],
['STL', 'St. Louis', 'Rams', 'NFC', 'West', 'St. Louis Rams', 'S.T.L.'],
['TB', 'Tampa Bay', 'Buccaneers', 'NFC', 'South', 'Tampa Bay Buccaneers', 'T.B.', 'TAM'],
['TEN', 'Tennessee', 'Titans', 'AFC', 'South', 'Tennessee Titans'],
['WAS', 'Washington', 'Redskins', 'NFC', 'East', 'Washington Redskins', 'WSH'],
['UNK', 'UNK', 'UNK', 'UNK', 'UNK'],
['ARI', 'Arizona', 'Cardinals', 'Arizona Cardinals'],
['ATL', 'Atlanta', 'Falcons', 'Atlanta Falcons'],
['BAL', 'Baltimore', 'Ravens', 'Baltimore Ravens'],
['BUF', 'Buffalo', 'Bills', 'Buffalo Bills'],
['CAR', 'Carolina', 'Panthers', 'Carolina Panthers'],
['CHI', 'Chicago', 'Bears', 'Chicago Bears'],
['CIN', 'Cincinnati', 'Bengals', 'Cincinnati Bengals'],
['CLE', 'Cleveland', 'Browns', 'Cleveland Browns'],
['DAL', 'Dallas', 'Cowboys', 'Dallas Cowboys'],
['DEN', 'Denver', 'Broncos', 'Denver Broncos'],
['DET', 'Detroit', 'Lions', 'Detroit Lions'],
['GB', 'Green Bay', 'Packers', 'Green Bay Packers', 'G.B.', 'GNB'],
['HOU', 'Houston', 'Texans', 'Houston Texans'],
['IND', 'Indianapolis', 'Colts', 'Indianapolis Colts'],
['JAC', 'Jacksonville', 'Jaguars', 'Jacksonville Jaguars', 'JAX'],
['KC', 'Kansas City', 'Chiefs', 'Kansas City Chiefs', 'K.C.', 'KAN'],
['MIA', 'Miami', 'Dolphins', 'Miami Dolphins'],
['MIN', 'Minnesota', 'Vikings', 'Minnesota Vikings'],
['NE', 'New England', 'Patriots', 'New England Patriots', 'N.E.', 'NWE'],
['NO', 'New Orleans', 'Saints', 'New Orleans Saints', 'N.O.', 'NOR'],
['NYG', 'New York', 'Giants', 'New York Giants', 'N.Y.G.'],
['NYJ', 'New York', 'Jets', 'New York Jets', 'N.Y.J.'],
['OAK', 'Oakland', 'Raiders', 'Oakland Raiders'],
['PHI', 'Philadelphia', 'Eagles', 'Philadelphia Eagles'],
['PIT', 'Pittsburgh', 'Steelers', 'Pittsburgh Steelers'],
['SD', 'San Diego', 'Chargers', 'San Diego Chargers', 'S.D.', 'SDG'],
['SEA', 'Seattle', 'Seahawks', 'Seattle Seahawks'],
['SF', 'San Francisco', '49ers', 'San Francisco 49ers', 'S.F.', 'SFO'],
['STL', 'St. Louis', 'Rams', 'St. Louis Rams', 'S.T.L.'],
['TB', 'Tampa Bay', 'Buccaneers', 'Tampa Bay Buccaneers', 'T.B.', 'TAM'],
['TEN', 'Tennessee', 'Titans', 'Tennessee Titans'],
['WAS', 'Washington', 'Redskins', 'Washington Redskins', 'WSH'],
['UNK', 'UNK', 'UNK'],
]


Expand Down

0 comments on commit a8c1cae

Please sign in to comment.