File tree Expand file tree Collapse file tree 2 files changed +17
-20
lines changed Expand file tree Collapse file tree 2 files changed +17
-20
lines changed Original file line number Diff line number Diff line change 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__ ))
Original file line number Diff line number Diff line change 1- import urllib2 # the lib that handles the url stuff
1+ from six . moves . urllib . request import urlopen
22import re
33
44
55def 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 )
You can’t perform that action at this time.
0 commit comments