MCPcopy Create free account
hub / github.com/numpy/numpy / _display_as_base

Function _display_as_base

numpy/core/_exceptions.py:17–29  ·  view source on GitHub ↗

A decorator that makes an exception class look like its base. We use this to hide subclasses that are implementation details - the user should catch the base type, which is what the traceback will show them. Classes decorated with this decorator are subject to removal without a

(cls)

Source from the content-addressed store, hash-verified

15
16
17def _display_as_base(cls):
18 """
19 A decorator that makes an exception class look like its base.
20
21 We use this to hide subclasses that are implementation details - the user
22 should catch the base type, which is what the traceback will show them.
23
24 Classes decorated with this decorator are subject to removal without a
25 deprecation warning.
26 """
27 assert issubclass(cls, Exception)
28 cls.__name__ = cls.__base__.__name__
29 return cls
30
31
32class UFuncTypeError(TypeError):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected