Commits

ms2ger committed 76c58db

Import functions from the correct URL libraries in python 3.

Comments (0)

Files changed (1)

anolislib/processes/annotate.py

 # THE SOFTWARE.
 
 from lxml import etree
-import urlparse
-import urllib2
 from collections import defaultdict
 
+import sys
+if sys.version_info[0] == 3:
+    from urllib.parse import urlsplit
+    from urllib.request import urlopen
+else:
+    from urlparse import urlsplit
+    from urllib2 import urlopen
+
 statuses =   {"UNKNOWN": "Unknown",
               "TBW": "Idea; yet to be specified",
               "WIP": "Being edited right now",
     else:
         annotation_location = kwargs["annotation"]
 
-    if urlparse.urlsplit(annotation_location)[0]:
-        annotations_data = urllib2.urlopen(annotation_location)
+    if urlsplit(annotation_location)[0]:
+        annotations_data = urlopen(annotation_location)
     else:
         annotations_data = open(annotation_location)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.