Skip to content

Commit a737e36

Browse files
committed
Fixes for Python 3.x errors
1 parent 936fee0 commit a737e36

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

lightning/types/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from lightning import Visualization
22
import requests
3+
import six
34

45

56
class Base(Visualization):
@@ -105,7 +106,7 @@ def baseplot(cls, session, type, *args, **kwargs):
105106

106107
options = {}
107108
if hasattr(cls, '_validOptions'):
108-
for key, value in kwargs.iteritems():
109+
for key, value in six.iteritems(kwargs):
109110
if key in cls._validOptions:
110111
lgn_option = cls._validOptions[key].get('lightning_name')
111112
options[lgn_option] = value

lightning/visualization.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import requests
22
import json
33
import webbrowser
4-
import urllib
54

65

76
class Visualization(object):
@@ -14,8 +13,11 @@ def __init__(self, session=None, json=None, auth=None):
1413
def _format_url(self, url):
1514
if not url.endswith('/'):
1615
url += '/'
17-
18-
return url + '?host=' + urllib.quote(self.session.host)
16+
try:
17+
from urllib.parse import quote
18+
except ImportError:
19+
from urllib import quote
20+
return url + '?host=' + quote(self.session.host)
1921

2022
def _update_image(self, image):
2123
url = self.session.host + '/sessions/' + str(self.session.id) + '/visualizations/' + str(self.id) + '/data/images'

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ setuptools
22
requests
33
numpy
44
pytest
5-
matplotlib
5+
matplotlib
6+
six

0 commit comments

Comments
 (0)