MCPcopy
hub / github.com/pytest-dev/pytest / safe_isclass

Function safe_isclass

src/_pytest/compat.py:253–258  ·  view source on GitHub ↗

Ignore any exception via isinstance on Python 3.

(obj: object)

Source from the content-addressed store, hash-verified

251
252
253def safe_isclass(obj: object) -> bool:
254 """Ignore any exception via isinstance on Python 3."""
255 try:
256 return inspect.isclass(obj)
257 except Exception:
258 return False
259
260
261def get_user_id() -> int | None:

Callers 3

parsefactoriesMethod · 0.90
test_safe_isclassFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_safe_isclassFunction · 0.72