Skip to content

Commit

Permalink
Update for release
Browse files Browse the repository at this point in the history
Remove last_update on info objects
Remove dependencies on requests and dateutil
  • Loading branch information
panzarino committed Sep 8, 2017
1 parent 4a99955 commit 7d75bfa
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
12 changes: 1 addition & 11 deletions mlbgame/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import mlbgame.object

from datetime import datetime
import dateutil.parser
import json
import lxml.etree as etree
import requests
Expand Down Expand Up @@ -135,16 +134,13 @@ def roster(team_id):
data = mlbgame.data.get_roster(team_id)
parsed = json.loads(data.read().decode('utf-8'))
players = parsed['roster_40']['queryResults']['row']
last_update = dateutil.parser.parse(
parsed['roster_40']['queryResults']['created'])
return {'players': players, 'last_update': last_update, 'team_id': team_id}
return {'players': players, 'team_id': team_id}


class Roster(object):
"""Represents an MLB Team
Properties:
last_update
players
team_id
"""
Expand All @@ -154,7 +150,6 @@ def __init__(self, data):
`data` should be a dictionary of values.
"""
self.last_update = data['last_update']
self.team_id = data['team_id']
self.players = []
for player in data['players']:
Expand Down Expand Up @@ -217,8 +212,6 @@ def standings(date):
data = mlbgame.data.get_historical_standings(date)
standings_schedule_date = 'historical_standings_schedule_date'
parsed = json.loads(data.read().decode('utf-8'))
last_update = parsed[standings_schedule_date][
'standings_all_date_rptr']['standings_all_date'][0]['queryResults']['created']
sjson = parsed[standings_schedule_date]['standings_all_date_rptr']['standings_all_date']
for league in sjson:
if league['league_id'] == '103':
Expand All @@ -235,7 +228,6 @@ def standings(date):
return {
'standings_schedule_date': standings_schedule_date,
'divisions': divisions,
'last_update': dateutil.parser.parse(last_update)
}


Expand All @@ -245,7 +237,6 @@ class Standings(object):
Properties:
divisions
standings_schedule_date
last_update
"""

def __init__(self, data):
Expand All @@ -254,7 +245,6 @@ def __init__(self, data):
`data` should be a dictionary of values
"""
self.standings_schedule_date = data['standings_schedule_date']
self.last_update = data['last_update']
self.divisions = [Division(x['division'], x['teams']) for x in data['divisions']]


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
packages=['mlbgame'],
package_data={'mlbgame': ['default.xml']},
data_files=[('docs', ['README.md', 'LICENSE', 'description.rst'])],
install_requires=['lxml', 'requests', 'python-dateutil'],
install_requires=['lxml'],
extras_require={
'dev': ['pytest', 'pytest-cov', 'coveralls']
}
Expand Down
3 changes: 0 additions & 3 deletions tests/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ def test_teams(self):

def test_roster(self):
roster = mlbgame.roster(121)
self.assertIsInstance(roster.last_update, datetime)
self.assertIsInstance(roster.players, list)
for player in roster.players:
self.assertIsInstance(player.bats, str)
Expand Down Expand Up @@ -258,7 +257,6 @@ def test_roster(self):
def test_standings(self):
standings = mlbgame.standings()
self.assertEqual(standings.standings_schedule_date, 'standings_schedule_date')
self.assertIsInstance(standings.last_update, datetime)
self.assertIsInstance(standings.divisions, list)
for division in standings.divisions:
self.assertIsInstance(division.name, str)
Expand Down Expand Up @@ -314,7 +312,6 @@ def test_standings_historical(self):
date = datetime(2016, 6, 1)
standings = mlbgame.standings(date)
self.assertEqual(standings.standings_schedule_date, 'historical_standings_schedule_date')
self.assertIsInstance(standings.last_update, datetime)
self.assertIsInstance(standings.divisions, list)
for division in standings.divisions:
self.assertIsInstance(division.name, str)
Expand Down

0 comments on commit 7d75bfa

Please sign in to comment.