MCPcopy Create free account
hub / github.com/ipython/traitlets / should_warn

Function should_warn

traitlets/utils/warnings.py:51–64  ·  view source on GitHub ↗

Add our own checks for too many deprecation warnings. Limit to once per package.

(key: t.Any)

Source from the content-addressed store, hash-verified

49
50
51def should_warn(key: t.Any) -> bool:
52 """Add our own checks for too many deprecation warnings.
53
54 Limit to once per package.
55 """
56 env_flag = os.environ.get("TRAITLETS_ALL_DEPRECATIONS")
57 if env_flag and env_flag != "0":
58 return True
59
60 if key not in _deprecations_shown:
61 _deprecations_shown.add(key)
62 return True
63 else:
64 return False

Callers 2

__init__Method · 0.85
deprecated_methodFunction · 0.85

Calls 2

addMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…