Skip to content

Commit 7d75bfa

Browse files
committed
Update for release
Remove last_update on info objects Remove dependencies on requests and dateutil
1 parent 4a99955 commit 7d75bfa

File tree

3 files changed

+2
-15
lines changed

3 files changed

+2
-15
lines changed

mlbgame/info.py

+1-11
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import mlbgame.object
1111

1212
from datetime import datetime
13-
import dateutil.parser
1413
import json
1514
import lxml.etree as etree
1615
import requests
@@ -135,16 +134,13 @@ def roster(team_id):
135134
data = mlbgame.data.get_roster(team_id)
136135
parsed = json.loads(data.read().decode('utf-8'))
137136
players = parsed['roster_40']['queryResults']['row']
138-
last_update = dateutil.parser.parse(
139-
parsed['roster_40']['queryResults']['created'])
140-
return {'players': players, 'last_update': last_update, 'team_id': team_id}
137+
return {'players': players, 'team_id': team_id}
141138

142139

143140
class Roster(object):
144141
"""Represents an MLB Team
145142
146143
Properties:
147-
last_update
148144
players
149145
team_id
150146
"""
@@ -154,7 +150,6 @@ def __init__(self, data):
154150
155151
`data` should be a dictionary of values.
156152
"""
157-
self.last_update = data['last_update']
158153
self.team_id = data['team_id']
159154
self.players = []
160155
for player in data['players']:
@@ -217,8 +212,6 @@ def standings(date):
217212
data = mlbgame.data.get_historical_standings(date)
218213
standings_schedule_date = 'historical_standings_schedule_date'
219214
parsed = json.loads(data.read().decode('utf-8'))
220-
last_update = parsed[standings_schedule_date][
221-
'standings_all_date_rptr']['standings_all_date'][0]['queryResults']['created']
222215
sjson = parsed[standings_schedule_date]['standings_all_date_rptr']['standings_all_date']
223216
for league in sjson:
224217
if league['league_id'] == '103':
@@ -235,7 +228,6 @@ def standings(date):
235228
return {
236229
'standings_schedule_date': standings_schedule_date,
237230
'divisions': divisions,
238-
'last_update': dateutil.parser.parse(last_update)
239231
}
240232

241233

@@ -245,7 +237,6 @@ class Standings(object):
245237
Properties:
246238
divisions
247239
standings_schedule_date
248-
last_update
249240
"""
250241

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

260250

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
packages=['mlbgame'],
6464
package_data={'mlbgame': ['default.xml']},
6565
data_files=[('docs', ['README.md', 'LICENSE', 'description.rst'])],
66-
install_requires=['lxml', 'requests', 'python-dateutil'],
66+
install_requires=['lxml'],
6767
extras_require={
6868
'dev': ['pytest', 'pytest-cov', 'coveralls']
6969
}

tests/test_info.py

-3
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ def test_teams(self):
221221

222222
def test_roster(self):
223223
roster = mlbgame.roster(121)
224-
self.assertIsInstance(roster.last_update, datetime)
225224
self.assertIsInstance(roster.players, list)
226225
for player in roster.players:
227226
self.assertIsInstance(player.bats, str)
@@ -258,7 +257,6 @@ def test_roster(self):
258257
def test_standings(self):
259258
standings = mlbgame.standings()
260259
self.assertEqual(standings.standings_schedule_date, 'standings_schedule_date')
261-
self.assertIsInstance(standings.last_update, datetime)
262260
self.assertIsInstance(standings.divisions, list)
263261
for division in standings.divisions:
264262
self.assertIsInstance(division.name, str)
@@ -314,7 +312,6 @@ def test_standings_historical(self):
314312
date = datetime(2016, 6, 1)
315313
standings = mlbgame.standings(date)
316314
self.assertEqual(standings.standings_schedule_date, 'historical_standings_schedule_date')
317-
self.assertIsInstance(standings.last_update, datetime)
318315
self.assertIsInstance(standings.divisions, list)
319316
for division in standings.divisions:
320317
self.assertIsInstance(division.name, str)

0 commit comments

Comments
 (0)