From 2a0305b349f61bddae674eb8f4efe0fd3c916bbf Mon Sep 17 00:00:00 2001 From: Christopher Head Date: Mon, 15 May 2023 10:13:37 -0700 Subject: [PATCH] Name top-level exceptions as private variables `exc` is private to the module. Naming it `_exc` eliminates a collision with the `exc` submodule (one which would not be observable at runtime due to the import failing, but which confuses linters). --- git/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/git/__init__.py b/git/__init__.py index f746e1fca..cd6602bf0 100644 --- a/git/__init__.py +++ b/git/__init__.py @@ -56,8 +56,8 @@ def _init_externals() -> None: Actor, rmtree, ) -except GitError as exc: - raise ImportError("%s: %s" % (exc.__class__.__name__, exc)) from exc +except GitError as _exc: + raise ImportError("%s: %s" % (_exc.__class__.__name__, _exc)) from _exc # } END imports @@ -87,6 +87,6 @@ def refresh(path: Optional[PathLike] = None) -> None: ################# try: refresh() -except Exception as exc: - raise ImportError("Failed to initialize: {0}".format(exc)) from exc +except Exception as _exc: + raise ImportError("Failed to initialize: {0}".format(_exc)) from _exc #################