Skip to content

Commit 2a0305b

Browse files
committed
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).
1 parent e3bc5d1 commit 2a0305b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

git/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def _init_externals() -> None:
5656
Actor,
5757
rmtree,
5858
)
59-
except GitError as exc:
60-
raise ImportError("%s: %s" % (exc.__class__.__name__, exc)) from exc
59+
except GitError as _exc:
60+
raise ImportError("%s: %s" % (_exc.__class__.__name__, _exc)) from _exc
6161

6262
# } END imports
6363

@@ -87,6 +87,6 @@ def refresh(path: Optional[PathLike] = None) -> None:
8787
#################
8888
try:
8989
refresh()
90-
except Exception as exc:
91-
raise ImportError("Failed to initialize: {0}".format(exc)) from exc
90+
except Exception as _exc:
91+
raise ImportError("Failed to initialize: {0}".format(_exc)) from _exc
9292
#################

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy