Skip to content

Commit

Permalink
Drop support for EOL Python 2.6 and remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Oct 20, 2017
1 parent 538f524 commit 10c0a68
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 27 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ Python standard library, but `nflgame.live` depends on `pytz` and the
All three dependencies are installed automatically if you install nflgame from
PyPI with `pip`.

nflgame does not yet work on Python 3, but it should work with Python 2.6 and
2.7.
nflgame does not yet work on Python 3, but it should work with Python 2.7.


### Updating the player database (e.g., rosters)
Expand Down
9 changes: 2 additions & 7 deletions nflgame/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,12 @@
We tend to respond fairly quickly!
"""

try:
from collections import OrderedDict
except:
from ordereddict import OrderedDict # from PyPI
import itertools

import sys

if sys.version_info[0] != 2 or sys.version_info[1] < 6:
print("nflgame requires Python 2.6+ and does not yet work with Python 3")
if sys.version_info[:2] != (2, 7):
print("nflgame requires Python 2.7 and does not yet work with Python 3")
print("You are running Python version {}.{}".format(
sys.version_info.major, sys.version_info.minor))
sys.exit(1)
Expand All @@ -101,7 +97,6 @@
import nflgame.seq # noqaj
from nflgame.version import __version__ # noqa

assert OrderedDict # Asserting the import for static analysis.
VERSION = __version__ # Deprecated. Backwards compatibility.

NoPlayers = nflgame.seq.GenPlayerStats(None)
Expand Down
2 changes: 1 addition & 1 deletion nflgame/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import socket
import sys
import urllib2
from collections import OrderedDict

from nflgame import OrderedDict
import nflgame.player
import nflgame.sched
import nflgame.seq
Expand Down
2 changes: 1 addition & 1 deletion nflgame/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import json
import os.path
from collections import OrderedDict

from nflgame import OrderedDict
import nflgame.seq
import nflgame.statmap

Expand Down
5 changes: 1 addition & 4 deletions nflgame/sched.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
try:
from collections import OrderedDict
except:
from ordereddict import OrderedDict # from PyPI
from collections import OrderedDict
import datetime
import json
import os.path
Expand Down
4 changes: 2 additions & 2 deletions nflgame/seq.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import functools
import itertools
import operator
from collections import OrderedDict

from nflgame import OrderedDict
from nflgame import statmap

_BUILTIN_PREDS = {
Expand Down Expand Up @@ -299,7 +299,7 @@ def csv(self, fileName, allfields=False):
"""
import csv

fields, rows = set([]), []
fields, rows = {}, []
players = list(self)
for p in players:
for field, stat in p.stats.iteritems():
Expand Down
2 changes: 1 addition & 1 deletion nflgame/update_sched.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import os
import sys
import urllib2
from collections import OrderedDict
import xml.dom.minidom as xml

import nflgame
from nflgame import OrderedDict


def year_phase_week(year=None, phase=None, week=None):
Expand Down
11 changes: 2 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ def wrapper(name, enc=ascii):
codecs.register(wrapper)

install_requires = ['pytz', 'httplib2', 'beautifulsoup4']
try:
import argparse
except ImportError:
install_requires.append('argparse')
try:
from collections import OrderedDict
except ImportError:
install_requires.append('ordereddict')

cwd = path.dirname(__file__)
longdesc = codecs.open(path.join(cwd, 'longdesc.rst'), 'r', 'ascii').read()
Expand Down Expand Up @@ -52,8 +44,9 @@ def wrapper(name, enc=ascii):
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Other Audience',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 2 :: Only',
'Topic :: Database',
],
platforms='ANY',
Expand Down

0 comments on commit 10c0a68

Please sign in to comment.