-#! /usr/bin/env python
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
# arv-copy [--recursive] [--no-recursive] object-uuid src dst
#
from __future__ import division
from future import standard_library
+from future.utils import listvalues
standard_library.install_aliases()
from past.builtins import basestring
from builtins import object
-from past.utils import old_div
import argparse
import contextlib
import getpass
abort("cannot copy object {} of type {}".format(args.object_uuid, t))
# Clean up any outstanding temp git repositories.
- for d in list(local_repo_dir.values()):
+ for d in listvalues(local_repo_dir):
shutil.rmtree(d, ignore_errors=True)
# If no exception was thrown and the response does not have an
#
def copy_collection(obj_uuid, src, dst, args):
if arvados.util.keep_locator_pattern.match(obj_uuid):
- # If the obj_uuid is a portable data hash, it might not be uniquely
- # identified with a particular collection. As a result, it is
- # ambigious as to what name to use for the copy. Apply some heuristics
- # to pick which collection to get the name from.
+ # If the obj_uuid is a portable data hash, it might not be
+ # uniquely identified with a particular collection. As a
+ # result, it is ambiguous as to what name to use for the copy.
+ # Apply some heuristics to pick which collection to get the
+ # name from.
srccol = src.collections().list(
filters=[['portable_data_hash', '=', obj_uuid]],
order="created_at asc"
if git_url.startswith("http:"):
if allow_insecure_http:
- logger.warn("Using insecure git url %s but will allow this because %s", git_url, allow_insecure_http_opt)
+ logger.warning("Using insecure git url %s but will allow this because %s", git_url, allow_insecure_http_opt)
else:
raise Exception("Refusing to use insecure git url %s, use %s if you really want this." % (git_url, allow_insecure_http_opt))
return "\r{}: {}M / {}M {:.1%} ".format(
obj_uuid,
bytes_written >> 20, bytes_expected >> 20,
- old_div(float(bytes_written), bytes_expected))
+ float(bytes_written) / bytes_expected)
else:
return "\r{}: {} ".format(obj_uuid, bytes_written)