X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=python%2Fcumulus%2Fstore%2F__init__.py;h=e638bc5806ca9185df3deed4f1b09363c5fe6d85;hb=567bd6a883eaa54d10ca61d0b6083da09bf48085;hp=0899d70b04c9a03e1b0e1e32bc2166eca4ae4e88;hpb=c343597dac79f9edc63d95d881625a317fadb1d9;p=cumulus.git diff --git a/python/cumulus/store/__init__.py b/python/cumulus/store/__init__.py index 0899d70..e638bc5 100644 --- a/python/cumulus/store/__init__.py +++ b/python/cumulus/store/__init__.py @@ -16,7 +16,13 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -import exceptions, re, urlparse +from __future__ import division, print_function, unicode_literals + +import re +try: + from urllib.parse import urlparse +except ImportError: + from urlparse import urlparse type_patterns = { 'checksums': re.compile(r"^snapshot-(.*)\.(\w+)sums$"), @@ -24,7 +30,7 @@ type_patterns = { 'snapshots': re.compile(r"^snapshot-(.*)\.(cumulus|lbs)$") } -class NotFoundError(exceptions.KeyError): +class NotFoundError(KeyError): """Exception thrown when a file is not found in a repository.""" pass @@ -39,7 +45,7 @@ class Store (object): if cls != Store: return super(Store, cls).__new__(cls, url, **kw) (scheme, netloc, path, params, query, fragment) \ - = urlparse.urlparse(url) + = urlparse(url) try: cumulus = __import__('cumulus.store.%s' % scheme, globals()) @@ -53,7 +59,7 @@ class Store (object): obj.fragment = fragment return obj except ImportError: - raise NotImplementedError, "Scheme %s not implemented" % scheme + raise NotImplementedError("Scheme %s not implemented" % scheme) def list(self, path): raise NotImplementedError @@ -70,7 +76,7 @@ class Store (object): def stat(self, path): raise NotImplementedError - def scan(self): + def scan(self, path): """Cache file information stored in this backend. This might make subsequent list or stat calls more efficient, but this