SHARE
TWEET

Untitled

a guest Jan 24th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import sys
  2. import inspect
  3.  
  4. builtins = sys.modules["builtins"]
  5. for name in dir(builtins):
  6.     v = getattr(builtins, name)
  7.     if not inspect.isclass(v):
  8.         continue
  9.     if not issubclass(v, Exception):
  10.         continue
  11.     print(name, [subclass.__name__ for subclass in v.mro()])
  12. # -- stdout --------------------
  13. # >> ArithmeticError ['ArithmeticError', 'Exception', 'BaseException', 'object']
  14. # >> AssertionError ['AssertionError', 'Exception', 'BaseException', 'object']
  15. # >> AttributeError ['AttributeError', 'Exception', 'BaseException', 'object']
  16. # >> BlockingIOError ['BlockingIOError', 'OSError', 'Exception', 'BaseException', 'object']
  17. # >> BrokenPipeError ['BrokenPipeError', 'ConnectionError', 'OSError', 'Exception', 'BaseException', 'object']
  18. # >> BufferError ['BufferError', 'Exception', 'BaseException', 'object']
  19. # >> BytesWarning ['BytesWarning', 'Warning', 'Exception', 'BaseException', 'object']
  20. # >> ChildProcessError ['ChildProcessError', 'OSError', 'Exception', 'BaseException', 'object']
  21. # >> ConnectionAbortedError ['ConnectionAbortedError', 'ConnectionError', 'OSError', 'Exception', 'BaseException', 'object']
  22. # >> ConnectionError ['ConnectionError', 'OSError', 'Exception', 'BaseException', 'object']
  23. # >> ConnectionRefusedError ['ConnectionRefusedError', 'ConnectionError', 'OSError', 'Exception', 'BaseException', 'object']
  24. # >> ConnectionResetError ['ConnectionResetError', 'ConnectionError', 'OSError', 'Exception', 'BaseException', 'object']
  25. # >> DeprecationWarning ['DeprecationWarning', 'Warning', 'Exception', 'BaseException', 'object']
  26. # >> EOFError ['EOFError', 'Exception', 'BaseException', 'object']
  27. # >> EnvironmentError ['OSError', 'Exception', 'BaseException', 'object']
  28. # >> Exception ['Exception', 'BaseException', 'object']
  29. # >> FileExistsError ['FileExistsError', 'OSError', 'Exception', 'BaseException', 'object']
  30. # >> FileNotFoundError ['FileNotFoundError', 'OSError', 'Exception', 'BaseException', 'object']
  31. # >> FloatingPointError ['FloatingPointError', 'ArithmeticError', 'Exception', 'BaseException', 'object']
  32. # >> FutureWarning ['FutureWarning', 'Warning', 'Exception', 'BaseException', 'object']
  33. # >> IOError ['OSError', 'Exception', 'BaseException', 'object']
  34. # >> ImportError ['ImportError', 'Exception', 'BaseException', 'object']
  35. # >> ImportWarning ['ImportWarning', 'Warning', 'Exception', 'BaseException', 'object']
  36. # >> IndentationError ['IndentationError', 'SyntaxError', 'Exception', 'BaseException', 'object']
  37. # >> IndexError ['IndexError', 'LookupError', 'Exception', 'BaseException', 'object']
  38. # >> InterruptedError ['InterruptedError', 'OSError', 'Exception', 'BaseException', 'object']
  39. # >> IsADirectoryError ['IsADirectoryError', 'OSError', 'Exception', 'BaseException', 'object']
  40. # >> KeyError ['KeyError', 'LookupError', 'Exception', 'BaseException', 'object']
  41. # >> LookupError ['LookupError', 'Exception', 'BaseException', 'object']
  42. # >> MemoryError ['MemoryError', 'Exception', 'BaseException', 'object']
  43. # >> ModuleNotFoundError ['ModuleNotFoundError', 'ImportError', 'Exception', 'BaseException', 'object']
  44. # >> NameError ['NameError', 'Exception', 'BaseException', 'object']
  45. # >> NotADirectoryError ['NotADirectoryError', 'OSError', 'Exception', 'BaseException', 'object']
  46. # >> NotImplementedError ['NotImplementedError', 'RuntimeError', 'Exception', 'BaseException', 'object']
  47. # >> OSError ['OSError', 'Exception', 'BaseException', 'object']
  48. # >> OverflowError ['OverflowError', 'ArithmeticError', 'Exception', 'BaseException', 'object']
  49. # >> PendingDeprecationWarning ['PendingDeprecationWarning', 'Warning', 'Exception', 'BaseException', 'object']
  50. # >> PermissionError ['PermissionError', 'OSError', 'Exception', 'BaseException', 'object']
  51. # >> ProcessLookupError ['ProcessLookupError', 'OSError', 'Exception', 'BaseException', 'object']
  52. # >> RecursionError ['RecursionError', 'RuntimeError', 'Exception', 'BaseException', 'object']
  53. # >> ReferenceError ['ReferenceError', 'Exception', 'BaseException', 'object']
  54. # >> ResourceWarning ['ResourceWarning', 'Warning', 'Exception', 'BaseException', 'object']
  55. # >> RuntimeError ['RuntimeError', 'Exception', 'BaseException', 'object']
  56. # >> RuntimeWarning ['RuntimeWarning', 'Warning', 'Exception', 'BaseException', 'object']
  57. # >> StopAsyncIteration ['StopAsyncIteration', 'Exception', 'BaseException', 'object']
  58. # >> StopIteration ['StopIteration', 'Exception', 'BaseException', 'object']
  59. # >> SyntaxError ['SyntaxError', 'Exception', 'BaseException', 'object']
  60. # >> SyntaxWarning ['SyntaxWarning', 'Warning', 'Exception', 'BaseException', 'object']
  61. # >> SystemError ['SystemError', 'Exception', 'BaseException', 'object']
  62. # >> TabError ['TabError', 'IndentationError', 'SyntaxError', 'Exception', 'BaseException', 'object']
  63. # >> TimeoutError ['TimeoutError', 'OSError', 'Exception', 'BaseException', 'object']
  64. # >> TypeError ['TypeError', 'Exception', 'BaseException', 'object']
  65. # >> UnboundLocalError ['UnboundLocalError', 'NameError', 'Exception', 'BaseException', 'object']
  66. # >> UnicodeDecodeError ['UnicodeDecodeError', 'UnicodeError', 'ValueError', 'Exception', 'BaseException', 'object']
  67. # >> UnicodeEncodeError ['UnicodeEncodeError', 'UnicodeError', 'ValueError', 'Exception', 'BaseException', 'object']
  68. # >> UnicodeError ['UnicodeError', 'ValueError', 'Exception', 'BaseException', 'object']
  69. # >> UnicodeTranslateError ['UnicodeTranslateError', 'UnicodeError', 'ValueError', 'Exception', 'BaseException', 'object']
  70. # >> UnicodeWarning ['UnicodeWarning', 'Warning', 'Exception', 'BaseException', 'object']
  71. # >> UserWarning ['UserWarning', 'Warning', 'Exception', 'BaseException', 'object']
  72. # >> ValueError ['ValueError', 'Exception', 'BaseException', 'object']
  73. # >> Warning ['Warning', 'Exception', 'BaseException', 'object']
  74. # >> ZeroDivisionError ['ZeroDivisionError', 'ArithmeticError', 'Exception', 'BaseException', 'object']
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top