summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Head <chead@chead.ca>2023-05-15 10:13:37 -0700
committerChristopher Head <chead@chead.ca>2023-05-15 10:13:37 -0700
commit2a0305b349f61bddae674eb8f4efe0fd3c916bbf (patch)
tree74299948b12c8f2575bbc71925cf10993eae5c7c
parente3bc5d10629ada4d61fdf61353668a58c5610d6b (diff)
downloadgitpython-2a0305b349f61bddae674eb8f4efe0fd3c916bbf.tar.gz
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).
-rw-r--r--git/__init__.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/git/__init__.py b/git/__init__.py
index f746e1fc..cd6602bf 100644
--- a/git/__init__.py
+++ b/git/__init__.py
@@ -56,8 +56,8 @@ try:
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
#################