From 2df844314c4dcfd53f3d698f20b252e0346e5ed1 Mon Sep 17 00:00:00 2001 From: Josip Sokcevic Date: Wed, 10 Nov 2021 22:46:40 +0000 Subject: [PATCH] Remove retry_decorator from third_party It's not used. R=gavinmak@google.com Fixed: 1256920 Change-Id: Iffae29035839d553faa46149cd6d9eadfc6b2395 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3273328 Auto-Submit: Josip Sokcevic Commit-Queue: Gavin Mak Reviewed-by: Gavin Mak --- third_party/retry_decorator/LICENSE.google | 30 --------------- third_party/retry_decorator/__init__.py | 0 third_party/retry_decorator/decorators.py | 45 ---------------------- 3 files changed, 75 deletions(-) delete mode 100644 third_party/retry_decorator/LICENSE.google delete mode 100644 third_party/retry_decorator/__init__.py delete mode 100644 third_party/retry_decorator/decorators.py diff --git a/third_party/retry_decorator/LICENSE.google b/third_party/retry_decorator/LICENSE.google deleted file mode 100644 index 12610f278..000000000 --- a/third_party/retry_decorator/LICENSE.google +++ /dev/null @@ -1,30 +0,0 @@ -Copyright (c) 2013, SaltyCrane -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the - distribution. - - * Neither the name of the SaltyCrane nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/third_party/retry_decorator/__init__.py b/third_party/retry_decorator/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/third_party/retry_decorator/decorators.py b/third_party/retry_decorator/decorators.py deleted file mode 100644 index e5eb9caa6..000000000 --- a/third_party/retry_decorator/decorators.py +++ /dev/null @@ -1,45 +0,0 @@ -import time -from functools import wraps - - -def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None): - """Retry calling the decorated function using an exponential backoff. - - http://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/ - original from: http://wiki.python.org/moin/PythonDecoratorLibrary#Retry - - :param ExceptionToCheck: the exception to check. may be a tuple of - exceptions to check - :type ExceptionToCheck: Exception or tuple - :param tries: number of times to try (not retry) before giving up - :type tries: int - :param delay: initial delay between retries in seconds - :type delay: int - :param backoff: backoff multiplier e.g. value of 2 will double the delay - each retry - :type backoff: int - :param logger: logger to use. If None, print - :type logger: logging.Logger instance - """ - def deco_retry(f): - - @wraps(f) - def f_retry(*args, **kwargs): - mtries, mdelay = tries, delay - while mtries > 1: - try: - return f(*args, **kwargs) - except ExceptionToCheck, e: - msg = "%s, Retrying in %d seconds..." % (str(e), mdelay) - if logger: - logger.warning(msg) - else: - print msg - time.sleep(mdelay) - mtries -= 1 - mdelay *= backoff - return f(*args, **kwargs) - - return f_retry # true decorator - - return deco_retry