Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 15d88cf

Browse filesBrowse files
committed
using six for python 3 compatibility
1 parent bb7c7e3 commit 15d88cf
Copy full SHA for 15d88cf

File tree

2 files changed

+17
-20
lines changed
Filter options

2 files changed

+17
-20
lines changed

‎plotly/__init__.py

Copy file name to clipboardExpand all lines: plotly/__init__.py
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535

3636
_latest = get_latest()
3737

38-
if __version__ != _latest :
39-
print("Your version of Plotly is currently outdated,\n" +
40-
"You're currently running {old}".format(old=__version__) +
41-
", while the latest version is {}".format(_latest))
38+
if __version__ != _latest:
39+
print("Your version of Plotly is currently outdated,\n" +
40+
"You're currently running {}".format(__version__) +
41+
", while the latest version is {}".format(_latest))
42+
else:
43+
print("Plotly {} is currently up to date".format(__version__))

‎plotly/check_version.py

Copy file name to clipboard
+11-16Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
1-
import urllib2 # the lib that handles the url stuff
1+
from six.moves.urllib.request import urlopen
22
import re
33

44

55
def get_latest():
6-
data = urllib2.urlopen('https://raw.githubusercontent.com/plotly/plotly.py/master/plotly/version.py') # it's a file like object and works just like a file
7-
version_string = [i for i in data][0]
8-
latest_version = re.findall(r'\'.*\'', version_string)[0][1:-1]
9-
return latest_version
10-
11-
def run_duration(f, **kwargs):
12-
import timeit
13-
start_time = timeit.default_timer()
14-
f(**kwargs)
15-
return (timeit.default_timer() - start_time)
16-
17-
18-
19-
20-
6+
data = urlopen('https://raw.githubusercontent.com/plotly/plotly.py/' +
7+
'master/plotly/version.py')
8+
version = [i for i in data][0]
9+
latest_version = re.findall(r'([0-9\.]+)', str(version))[0]
10+
return latest_version
2111

2212

13+
def run_duration(f, **kwargs):
14+
import timeit
15+
start_time = timeit.default_timer()
16+
f(**kwargs)
17+
return (timeit.default_timer() - start_time)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.