You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-29Lines changed: 1 addition & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -140,7 +140,6 @@ You can think of a `@flow` function as a durable goroutine that can survive appl
140
140
```python
141
141
from deepslate import flow
142
142
143
-
144
143
@flow
145
144
asyncdefadd(a: int, b: int) -> int:
146
145
return a + b
@@ -166,12 +165,11 @@ You can think of a `@flow` function as a durable goroutine that can survive appl
166
165
167
166
-**return**: return a value or exit the flow, e.g. `return result` or bare `return`
168
167
169
-
-**isinstance**: narrow a `T | DSError` union, the idiomatic error check
168
+
-**DSError and isinstance**: deepslate does not support exceptions, durable operations return the result type `T | DSError`, narrow it with `isinstance` on the success type and propagate by returning the error
170
169
171
170
```python
172
171
from deepslate import flow, http_listen, DSError
173
172
174
-
175
173
@flow
176
174
asyncdefhandle():
177
175
data: bytes| DSError
@@ -185,7 +183,6 @@ You can think of a `@flow` function as a durable goroutine that can survive appl
185
183
```python
186
184
from deepslate import flow, sleep
187
185
188
-
189
186
@flow
190
187
asyncdefdelay():
191
188
sleep(1.0)
@@ -196,7 +193,6 @@ You can think of a `@flow` function as a durable goroutine that can survive appl
196
193
```python
197
194
from deepslate import flow, http_listen, DSError
198
195
199
-
200
196
@flow
201
197
asyncdeflistener():
202
198
data: bytes| DSError
@@ -208,7 +204,6 @@ You can think of a `@flow` function as a durable goroutine that can survive appl
208
204
```python
209
205
from deepslate import flow, http_request, DSError
210
206
211
-
212
207
@flow
213
208
asyncdeffetch():
214
209
resp: bytes| DSError
@@ -220,7 +215,6 @@ You can think of a `@flow` function as a durable goroutine that can survive appl
220
215
```python
221
216
from deepslate import flow, json_marshal, json_unmarshal, DSError
222
217
223
-
224
218
@flow
225
219
asyncdefcodec(data: bytes):
226
220
nums: list[int] | DSError
@@ -234,7 +228,6 @@ You can think of a `@flow` function as a durable goroutine that can survive appl
234
228
```python
235
229
from deepslate import pure
236
230
237
-
238
231
@pure
239
232
defget_status(resp: HealthResponse) -> str:
240
233
return resp.Status
@@ -247,7 +240,6 @@ You can think of a `@flow` function as a durable goroutine that can survive appl
247
240
248
241
from deepslate import flow, impure
249
242
250
-
251
243
@impure
252
244
definsert_event(name: str) -> None:
253
245
conn = psycopg2.connect(DBURL)
@@ -267,7 +259,6 @@ You can think of a `@flow` function as a durable goroutine that can survive appl
267
259
```python
268
260
from deepslate import flow
269
261
270
-
271
262
@flow
272
263
asyncdefadder(a: int, b: int) -> int:
273
264
return a + b
@@ -283,7 +274,6 @@ You can think of a `@flow` function as a durable goroutine that can survive appl
283
274
```python
284
275
from deepslate import flow, sleep, dpslio
285
276
286
-
287
277
@flow
288
278
asyncdefchild(n: int):
289
279
sleep(1.0)
@@ -299,7 +289,6 @@ You can think of a `@flow` function as a durable goroutine that can survive appl
299
289
```python
300
290
from deepslate import flow, dpslio
301
291
302
-
303
292
@flow
304
293
asyncdefconsumer(ch: dpslio.Queue[int]):
305
294
value: int=await ch.get()
@@ -317,7 +306,6 @@ You can think of a `@flow` function as a durable goroutine that can survive appl
317
306
```python
318
307
from deepslate import flow, sleep, dpslio
319
308
320
-
321
309
@flow
322
310
asyncdeftask(wg: dpslio.WaitGroup):
323
311
sleep(1.0)
@@ -338,7 +326,6 @@ You can think of a `@flow` function as a durable goroutine that can survive appl
338
326
```python
339
327
from deepslate import flow, dpslio
340
328
341
-
342
329
@flow
343
330
asyncdefworker(mu: dpslio.Lock):
344
331
await mu.acquire()
@@ -351,7 +338,6 @@ You can think of a `@flow` function as a durable goroutine that can survive appl
@@ -361,17 +347,3 @@ You can think of a `@flow` function as a durable goroutine that can survive appl
361
347
case _ if v :=await ch2.get():
362
348
result = v
363
349
```
364
-
365
-
-**DSError**: deepslate does not support exceptions, instead the result type `T | DSError` is used, check with `isinstance` and propagate by returning the error
0 commit comments