Skip to content

Commit 8bcc06e

Browse files
committed
chore: hide import from traceback
The `__import__` redefinition only inspects the import and prints a warning and otherwise does not interfere with the import process. Signed-off-by: JP-Ellis <[email protected]>
1 parent 3007720 commit 8bcc06e

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/pact/generate/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def __import__( # noqa: N807
7272
warn users when they import functions directly from this module. This is
7373
done to avoid shadowing built-in types and functions.
7474
"""
75+
__tracebackhide__ = True
7576
if name == "pact.generate" and len(set(fromlist) - {"Matcher"}) > 0:
7677
warnings.warn(
7778
"Avoid `from pact.generate import <func>`. "

src/pact/match/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ def __import__( # noqa: N807
130130
users when they import functions directly from this module. This is done to
131131
avoid shadowing built-in types and functions.
132132
"""
133+
__tracebackhide__ = True
133134
if name == "pact.match" and len(set(fromlist) - {"Matcher"}) > 0:
134135
warnings.warn(
135136
"Avoid `from pact.match import <func>`. "

0 commit comments

Comments
 (0)