11308: Fix futurize.
authorTom Clegg <tom@curoverse.com>
Sat, 1 Apr 2017 02:55:14 +0000 (22:55 -0400)
committerTom Clegg <tom@curoverse.com>
Sat, 1 Apr 2017 21:43:54 +0000 (17:43 -0400)
sdk/python/arvados/__init__.py
sdk/python/arvados/collection.py
sdk/python/arvados/safeapi.py

index 45370777362a8baaa705401974f29299f59d801f..36d54e5cf6b36ee23ded14b260883dab4bf6b09d 100644 (file)
@@ -20,7 +20,7 @@ import fcntl
 import time
 import threading
 
 import time
 import threading
 
-from .api import api, http_cache
+from .api import api, api_from_config, http_cache
 from .collection import CollectionReader, CollectionWriter, ResumableCollectionWriter
 from .keep import *
 from .stream import *
 from .collection import CollectionReader, CollectionWriter, ResumableCollectionWriter
 from .keep import *
 from .stream import *
index 095187e4c6188dd03d3b1277e2074da87d944490..1a427814cf4d5bc13ffbeca75f7c22c87134962c 100644 (file)
@@ -17,10 +17,10 @@ from .stream import StreamReader
 from ._normalize_stream import normalize_stream
 from ._ranges import Range, LocatorAndRange
 from .safeapi import ThreadSafeApiCache
 from ._normalize_stream import normalize_stream
 from ._ranges import Range, LocatorAndRange
 from .safeapi import ThreadSafeApiCache
-from . import config
-from . import errors
-from . import util
-from . import events
+import arvados.config as config
+import arvados.errors as errors
+import arvados.util
+import arvados.events as events
 from arvados.retry import retry_method
 
 _logger = logging.getLogger('arvados.collection')
 from arvados.retry import retry_method
 
 _logger = logging.getLogger('arvados.collection')
@@ -52,7 +52,7 @@ class CollectionBase(object):
             if fields:
                 clean_fields = fields[:1] + [
                     (re.sub(r'\+[^\d][^\+]*', '', x)
             if fields:
                 clean_fields = fields[:1] + [
                     (re.sub(r'\+[^\d][^\+]*', '', x)
-                     if re.match(util.keep_locator_pattern, x)
+                     if re.match(arvados.util.keep_locator_pattern, x)
                      else x)
                     for x in fields[1:]]
                 clean += [' '.join(clean_fields), "\n"]
                      else x)
                     for x in fields[1:]]
                 clean += [' '.join(clean_fields), "\n"]
@@ -181,7 +181,7 @@ class CollectionWriter(CollectionBase):
 
     def _work_trees(self):
         path, stream_name, max_manifest_depth = self._queued_trees[0]
 
     def _work_trees(self):
         path, stream_name, max_manifest_depth = self._queued_trees[0]
-        d = util.listdir_recursive(
+        d = arvados.util.listdir_recursive(
             path, max_depth = (None if max_manifest_depth == 0 else 0))
         if d:
             self._queue_dirents(stream_name, d)
             path, max_depth = (None if max_manifest_depth == 0 else 0))
         if d:
             self._queue_dirents(stream_name, d)
@@ -1223,11 +1223,11 @@ class Collection(RichCollectionBase):
         self.events = None
 
         if manifest_locator_or_text:
         self.events = None
 
         if manifest_locator_or_text:
-            if re.match(util.keep_locator_pattern, manifest_locator_or_text):
+            if re.match(arvados.util.keep_locator_pattern, manifest_locator_or_text):
                 self._manifest_locator = manifest_locator_or_text
                 self._manifest_locator = manifest_locator_or_text
-            elif re.match(util.collection_uuid_pattern, manifest_locator_or_text):
+            elif re.match(arvados.util.collection_uuid_pattern, manifest_locator_or_text):
                 self._manifest_locator = manifest_locator_or_text
                 self._manifest_locator = manifest_locator_or_text
-            elif re.match(util.manifest_pattern, manifest_locator_or_text):
+            elif re.match(arvados.util.manifest_pattern, manifest_locator_or_text):
                 self._manifest_text = manifest_locator_or_text
             else:
                 raise errors.ArgumentError(
                 self._manifest_text = manifest_locator_or_text
             else:
                 raise errors.ArgumentError(
@@ -1343,10 +1343,10 @@ class Collection(RichCollectionBase):
         error_via_api = None
         error_via_keep = None
         should_try_keep = ((self._manifest_text is None) and
         error_via_api = None
         error_via_keep = None
         should_try_keep = ((self._manifest_text is None) and
-                           util.keep_locator_pattern.match(
+                           arvados.util.keep_locator_pattern.match(
                                self._manifest_locator))
         if ((self._manifest_text is None) and
                                self._manifest_locator))
         if ((self._manifest_text is None) and
-            util.signed_locator_pattern.match(self._manifest_locator)):
+            arvados.util.signed_locator_pattern.match(self._manifest_locator)):
             error_via_keep = self._populate_from_keep()
         if self._manifest_text is None:
             error_via_api = self._populate_from_api_server()
             error_via_keep = self._populate_from_keep()
         if self._manifest_text is None:
             error_via_api = self._populate_from_api_server()
@@ -1372,7 +1372,7 @@ class Collection(RichCollectionBase):
 
 
     def _has_collection_uuid(self):
 
 
     def _has_collection_uuid(self):
-        return self._manifest_locator is not None and re.match(util.collection_uuid_pattern, self._manifest_locator)
+        return self._manifest_locator is not None and re.match(arvados.util.collection_uuid_pattern, self._manifest_locator)
 
     def __enter__(self):
         return self
 
     def __enter__(self):
         return self
index bc875367de02e6bea245c4d2230346bf4a78ac36..a9ca978865375eea1e34d44db08bb462388811de 100644 (file)
@@ -1,9 +1,11 @@
 from __future__ import absolute_import
 from __future__ import absolute_import
-import threading
-from . import api
-from . import keep
-from . import config
+
 import copy
 import copy
+import threading
+
+import arvados
+import arvados.keep as keep
+import arvados.config as config
 
 class ThreadSafeApiCache(object):
     """Threadsafe wrapper for API objects.
 
 class ThreadSafeApiCache(object):
     """Threadsafe wrapper for API objects.
@@ -22,7 +24,7 @@ class ThreadSafeApiCache(object):
 
     def localapi(self):
         if 'api' not in self.local.__dict__:
 
     def localapi(self):
         if 'api' not in self.local.__dict__:
-            self.local.api = api.api_from_config('v1', apiconfig=self.apiconfig)
+            self.local.api = arvados.api_from_config('v1', apiconfig=self.apiconfig)
         return self.local.api
 
     def __getattr__(self, name):
         return self.local.api
 
     def __getattr__(self, name):