File tree 5 files changed +17
-18
lines changed
5 files changed +17
-18
lines changed Original file line number Diff line number Diff line change 14
14
15
15
"""
16
16
try :
17
- from urlparse import urlsplit , urljoin
18
- from urllib import unquote , urlretrieve
19
- except ImportError : # Python 3
20
- from urllib .parse import urlsplit , unquote # TODO: include urljoin
21
- from urllib .request import urlretrieve
17
+ from urlparse import urljoin
18
+ except ImportError : # Python 3
19
+ from urllib .parse import urljoin
22
20
23
21
24
22
PATRIC_FTP_BASE_URL = "ftp://ftp.patricbrc.org"
Original file line number Diff line number Diff line change 17
17
import os
18
18
try :
19
19
from urlparse import urljoin
20
- except ImportError : # Python 3
21
- pass # TODO: include urljoin
20
+ except ImportError : # Python 3
21
+ from urllib . parse import urljoin
22
22
23
23
from time import sleep
24
24
Original file line number Diff line number Diff line change 18
18
from unittest import TestCase
19
19
20
20
try :
21
+ from urllib2 import urlopen
21
22
from urlparse import urljoin
22
- except ImportError : # Python 3
23
- pass # TODO: include urljoin
23
+ except ImportError : # Python 3
24
+ from urllib .parse import urljoin
25
+ from urllib .request import urlopen
24
26
25
27
from ..config import PATRIC_FTP_BASE_URL , PATRIC_FTP_AMR_METADATA_URL , \
26
28
PATRIC_FTP_GENOMES_URL , PATRIC_FTP_GENOMES_METADATA_URL
27
29
30
+
28
31
class UtilityTests (TestCase ):
29
32
def setUp (self ):
30
33
"""
@@ -34,9 +37,8 @@ def setUp(self):
34
37
pass
35
38
36
39
def _test_url (self , url ):
37
- import urllib2
38
40
try :
39
- urllib2 . urlopen (url , timeout = 10 )
41
+ urlopen (url , timeout = 10 )
40
42
except :
41
43
self .fail ("Could not reach {0!s}" .format (url ))
42
44
Original file line number Diff line number Diff line change 17
17
import posixpath
18
18
19
19
try :
20
- from urlparse import urlsplit , urljoin
21
- from urllib import unquote , urlretrieve
22
- except ImportError : # Python 3
23
- from urllib .parse import urlsplit , unquote #TODO: include urljoin
24
- from urllib .request import urlretrieve
20
+ from urlparse import urlsplit
21
+ from urllib import unquote
22
+ except ImportError : # Python 3
23
+ from urllib .parse import urlsplit , unquote
25
24
26
25
27
26
def download_file_from_url (url , outdir ):
@@ -51,7 +50,7 @@ def download_file_from_url(url, outdir):
51
50
system ("wget --quiet -o /dev/null -O {0!s} --continue --timeout 20 {1!s}" .format (os .path .join (outdir , url_extract_file_name (url )), url ))
52
51
return ""
53
52
except Exception as e :
54
- print e
53
+ print ( e )
55
54
return url + str (e )
56
55
57
56
Original file line number Diff line number Diff line change 25
25
26
26
setup (
27
27
name = 'PATRIC Tools' ,
28
- version = '1.0 .0' ,
28
+ version = '1.1 .0' ,
29
29
30
30
description = 'A Python package to interact with the PATRIC database (https://www.patricbrc.org)' ,
31
31
long_description = long_description ,
You can’t perform that action at this time.
0 commit comments