blob: 5b58f9e63965a724ef1d37f65ee5bbbe575f71d3 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
(define-module (language python exceptions)
#:use-module (oop pf-objects)
#:use-module (oop goops)
#:export (StopIteration GeneratorExit RuntimeError
Exception ValueError TypeError
IndexError KeyError AttributeError ArgumentError
SyntaxError SystemException
OSError ProcessLookupError PermissionError
None NotImplemented NotImplementedError
RunTimeError AssertionError ImportError
ModuleNotFoundError BlockingIOError
InterruptedError BaseException
ZeroDivisionError ArithmeticError
OverflowError RecursionError
Warning DeprecationWarning BytesWarning
ResourceWarning
UnicodeDecodeError LookupError IndentationError
KeyboardInterrupt MemoryError NameError
EOFError UnicodeError UnicodeEncodeError
FileExistsError FileNotFoundError IsADirectoryError
EnvironmentError))
(define-syntax-rule (aif it p x y) (let ((it p)) (if it x y)))
(define-python-class Exception ()
(define __init__
(case-lambda
((self)
(values))
((self val . l)
(set self 'value val))))
(define __repr__
(lambda (self)
(aif it (rawref self 'value #f)
(format #f "~a:~a"
(rawref self '__name__) it)
(format #f "~a"
(rawref self '__name__))))))
(define-python-class Warning ()
(define __init__
(case-lambda
((self)
(values))
((self val . l)
(set self 'value val))))
(define __repr__
(lambda (self)
(aif it (rawref self 'value #f)
(format #f "~a:~a"
(rawref self '__name__) it)
(format #f "~a"
(rawref self '__name__))))))
(define-syntax define-er
(syntax-rules ()
((_ nm k)
(define-python-class nm (Exception)))
((_ nm w k)
(define-python-class nm w))))
(define-syntax define-er2
(syntax-rules ()
((_ nm k)
(define-python-class nm (BaseException)))
((_ nm w k)
(define-python-class nm w))))
(define StopIteration 'StopIteration)
(define GeneratorExit 'GeneratorExit)
(define-er EnvironmentError 'EnvironmentError)
(define-er UnicodeEncodeError 'UnicodeEncodeError)
(define-er FileExistsError 'FileExistsError)
(define-er FileNotFoundError 'FileNotFoundError)
(define-er IsADirectoryError 'IsADirectoryError)
(define-er UnicodeError 'UnicodeError)
(define-er EOFError 'EOFError)
(define-er MemoryError 'MemoryError)
(define-er NameError 'NameError)
(define-er UnicodeDecodeError 'UnicodeDecodeError)
(define-er LookupError 'LookupError)
(define-er IndentationError 'IndentationError)
(define-er OverflowError 'OverflowError)
(define-er KeyboardInterrupt 'KeyboardInterrupt)
(define-er RecursionError 'RecursionError)
(define-er ArithmeticError 'ArithmeticError)
(define-er BaseException 'BaseException)
(define-er ZeroDivisionError 'ZeroDivisionError)
(define-er SystemException 'SystemException)
(define-er RuntimeError 'RuntimeError)
(define-er IndexError 'IndexError)
(define-er ArgumentError 'IndexError)
(define-er ValueError 'ValueError)
(define None 'None)
(define-er KeyError 'KeyError)
(define-er TypeError 'TypeError)
(define-er AttributeError 'AttributeError)
(define-er SyntaxError 'SyntaxError)
(define-er OSError 'OSError)
(define-er ProcessLookupError 'ProcessLookupError)
(define-er PermissionError 'PermissionError)
(define-er NotImplementedError 'NotImplementedError)
(define-er RunTimeError 'RunTimeError)
(define AssertionError 'AssertionError)
(define-er ImportError 'ImportError)
(define-er ModuleNotFoundError (ImportError) 'ModuleNotFoundError)
(define-er BlockingIOError 'BlockingIOError)
(define-er InterruptedError 'OSError)
(define NotImplemented (list 'NotImplemented))
(define-syntax define-wr
(syntax-rules ()
((_ nm k)
(define-python-class nm (Warning)))
((_ nm w k)
(define-python-class nm w))))
(define-wr BytesWarning 'BytesWarning)
(define-wr DepricationWarning 'DeprecationWarning)
(define-wr ResourceWarning 'ResourceWarning)
|