From aed04e7cc9eb62b98a1682b7a869253e5f9fa07a Mon Sep 17 00:00:00 2001 From: "Mr. Outis" Date: Thu, 2 Jan 2020 16:36:25 -0600 Subject: [PATCH] exceptions: remove noop code --- dvc/exceptions.py | 18 ++---------------- dvc/remote/gdrive.py | 11 +++-------- dvc/stage.py | 3 +-- 3 files changed, 6 insertions(+), 26 deletions(-) diff --git a/dvc/exceptions.py b/dvc/exceptions.py index 8192a674d..f67a01751 100644 --- a/dvc/exceptions.py +++ b/dvc/exceptions.py @@ -13,18 +13,6 @@ class DvcException(Exception): cause (Exception): optional cause exception. """ - def __init__(self, msg, cause=None): - # NOTE: unlike python 3, python 2 doesn't have built-in support - # for chained exceptions, so we are using our own implementation. - self.cause = cause - self.cause_tb = None - if cause: - try: - self.cause_tb = traceback.format_exc() - except AttributeError: # pragma: no cover - pass - super().__init__(msg) - class OutputDuplicationError(DvcException): """Thrown if a file/directory is specified as an output in more than one @@ -109,8 +97,7 @@ class ArgumentDuplicationError(DvcException): def __init__(self, path): assert isinstance(path, str) - msg = "file '{}' is specified more than once." - super().__init__(msg.format(path)) + super().__init__("file '{}' is specified more than once.".format(path)) class MoveNotDataSourceError(DvcException): @@ -175,8 +162,7 @@ class ConfirmRemoveError(DvcException): class InitError(DvcException): - def __init__(self, msg): - super().__init__(msg) + pass class ReproductionError(DvcException): diff --git a/dvc/remote/gdrive.py b/dvc/remote/gdrive.py index a23f9f17f..7167bb132 100644 --- a/dvc/remote/gdrive.py +++ b/dvc/remote/gdrive.py @@ -19,18 +19,13 @@ FOLDER_MIME_TYPE = "application/vnd.google-apps.folder" class GDriveRetriableError(DvcException): - def __init__(self, msg, cause=None): - super().__init__(msg, cause=cause) - + pass class GDriveAccessTokenRefreshError(DvcException): - def __init__(self, msg, cause=None): - super().__init__(msg, cause=cause) - + pass class GDriveMissedCredentialKeyError(DvcException): - def __init__(self, msg, cause=None): - super().__init__(msg, cause=cause) + pass @decorator diff --git a/dvc/stage.py b/dvc/stage.py index 4633cd67b..176da2792 100644 --- a/dvc/stage.py +++ b/dvc/stage.py @@ -71,8 +71,7 @@ class StageFileIsNotDvcFileError(DvcException): class StageFileBadNameError(DvcException): - def __init__(self, msg): - super().__init__(msg) + pass class StagePathOutsideError(DvcException):