Skip to content

Commit 652b2c4

Browse files
committed
Merge pull request #17 from openml/master
Merge changes
2 parents 1f9bbb0 + 6a97b1c commit 652b2c4

5 files changed

Lines changed: 16 additions & 13 deletions

File tree

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ python:
44
- "2.7"
55
- "3.4"
66

7+
env:
8+
secure: "KTU56Bhft39FhFnV80Ek+Ht8nwAAJWlLAN104bALBzQWVraoD/znx0gQnoS+YQDjzxgpj30UKBua/o8q1IrvkjxJb8yUBzpS0P1jcGwqmpVRoNdb3pQPk8R7fB9pTFiaJUQbdQJ2/xTrB/T9Kda0J1zq81LC1zSOxAxUL47UI50="
9+
710
before_install:
811
- sudo apt-get install -q libatlas3gf-base libatlas-dev liblapack-dev gfortran
912

openml/apiconnector.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,6 @@ def _create_run_from_xml(self, xml):
947947
url = file_[u"oml:url"]
948948
files[name] = url
949949

950-
print dic.keys()
951950
evaluations = dict()
952951
for evaluation in dic[u"oml:output_data"][u"oml:evaluation"]:
953952
name = evaluation[u"oml:name"]
@@ -994,7 +993,7 @@ def _read_url(self, url, add_authentication=False, data=None, filePath=None):
994993
def _read_url(self, url, data=None, file_path=None):
995994
if data is None:
996995
data = {}
997-
data['session_hash'] = self.config.get('FAKE_SECTION', 'apikey')
996+
data['api_key'] = self.config.get('FAKE_SECTION', 'apikey')
998997

999998
if file_path is not None:
1000999
if os.path.isabs(file_path):
@@ -1009,8 +1008,8 @@ def _read_url(self, url, data=None, file_path=None):
10091008

10101009
try:
10111010
response = requests.post(url, data=data, files=fileElement)
1012-
except URLError, error:
1013-
print error
1011+
except URLError as error:
1012+
print(error)
10141013

10151014
return response.status_code, response
10161015
else:

openml/entities/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def __init__(self, id, name, version, description, format, creator,
8181
else:
8282
raise Exception()
8383

84-
with open(self.data_pickle_file, "w") as fh:
84+
with open(self.data_pickle_file, "wb") as fh:
8585
pickle.dump((X, categorical, attribute_names), fh, -1)
8686
logger.debug("Saved dataset %d: %s to file %s" %
8787
(self.id, self.name, self.data_pickle_file))

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"scipy>=0.13.3",
1717
"xmltodict",
1818
"nose",
19-
"numpydoc"],
19+
"numpydoc",
20+
"requests"],
2021
test_suite="nose.collector",
2122
classifiers=['Intended Audience :: Science/Research',
2223
'Intended Audience :: Developers',

tests/test_apiconnector.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ class TestAPIConnector(unittest.TestCase):
2727
"""
2828

2929
def setUp(self):
30-
config_file = os.path.expanduser('~/.openml/config')
31-
if not os.path.exists(config_file):
32-
raise Exception("OpenML config file required to run unit tests. "
33-
"See https://github.com/openml/OpenML/wiki/Client-API")
34-
3530
self.cwd = os.getcwd()
3631
workdir = os.path.dirname(os.path.abspath(__file__))
3732
self.workdir = os.path.join(workdir, "tmp")
@@ -44,8 +39,13 @@ def setUp(self):
4439
os.chdir(self.workdir)
4540

4641
self.cached = True
42+
43+
try:
44+
apikey = os.environ['OPENMLAPIKEY']
45+
except:
46+
apikey = None
4747
self.connector = APIConnector(cache_directory=self.workdir,
48-
apikey='test')
48+
apikey=apikey)
4949

5050
def tearDown(self):
5151
os.chdir(self.cwd)
@@ -66,7 +66,7 @@ def test_get_cached_datasets(self):
6666
datasets = connector.get_cached_datasets()
6767
self.assertIsInstance(datasets, dict)
6868
self.assertEqual(len(datasets), 2)
69-
self.assertIsInstance(datasets.values()[0], OpenMLDataset)
69+
self.assertIsInstance(list(datasets.values())[0], OpenMLDataset)
7070

7171
def test_get_cached_dataset(self):
7272
workdir = os.path.dirname(os.path.abspath(__file__))

0 commit comments

Comments
 (0)