@@ -13,56 +13,38 @@ of_pyobject with no check
13
13
$ ocamlformat -- enable-outside-detected-project lib . ml
14
14
module Silly : sig
15
15
type ' a todo = unit -> ' a
16
-
17
16
type ' a not_implemented = unit -> ' a
18
-
19
17
type t
20
18
21
19
val of_pyobject : Pytypes. pyobject -> t
22
-
23
20
val to_pyobject : t -> Pytypes. pyobject
24
-
25
21
val __init__ : x : int -> y: int -> unit -> t
26
-
27
22
val x : t -> int
28
-
29
23
val y : t -> int
30
-
31
24
val foo : t -> a: int -> b: int -> unit -> int
32
-
33
25
val do_nothing : t -> unit -> unit
34
-
35
26
val return_list : t -> l: string list -> unit -> string list
36
-
37
27
val return_opt_list : t -> l: string option list -> unit -> string option list
38
-
39
28
val return_array : t -> a: string array -> unit -> string array
40
29
41
30
val return_opt_array :
42
31
t -> a: string option array -> unit -> string option array
43
32
44
33
val bar : a: int -> b: int -> unit -> int
45
-
46
34
val do_nothing2 : unit -> unit
47
-
48
35
val hello : ' a todo
49
-
50
36
val world : ' a not_implemented
51
37
end = struct
52
38
type ' a todo = unit -> ' a
53
-
54
39
type ' a not_implemented = unit -> ' a
55
40
56
41
let filter_opt l = List . filter_map Fun. id l
57
-
58
42
let py_module = lazy (Py. Import. import_module " silly" )
59
-
60
43
let import_module () = Lazy. force py_module
61
44
62
45
type t = Pytypes. pyobject
63
46
64
47
let of_pyobject pyo = pyo
65
-
66
48
let to_pyobject x = x
67
49
68
50
let __init__ ~ x ~ y () =
@@ -73,7 +55,6 @@ of_pyobject with no check
73
55
of_pyobject @@ Py. Callable . to_function_with_keywords callable [|| ] kwargs
74
56
75
57
let x t = Py. Int . to_int @@ Py. Object. find_attr_string t " x"
76
-
77
58
let y t = Py. Int . to_int @@ Py. Object. find_attr_string t " y"
78
59
79
60
let foo t ~ a ~ b () =
@@ -151,7 +132,6 @@ of_pyobject with no check
151
132
ignore @@ Py. Callable . to_function_with_keywords callable [|| ] kwargs
152
133
153
134
let hello () = failwith " todo: hello"
154
-
155
135
let world () = failwith " not implemented: world"
156
136
end
157
137
$ dune exec . /run_no_check. exe 2> /dev/ null
@@ -171,50 +151,33 @@ of_pyobject returning option
171
151
$ ocamlformat -- enable-outside-detected-project lib . ml
172
152
module Silly : sig
173
153
type ' a todo = unit -> ' a
174
-
175
154
type ' a not_implemented = unit -> ' a
176
-
177
155
type t
178
156
179
157
val of_pyobject : Pytypes. pyobject -> t option
180
-
181
158
val to_pyobject : t -> Pytypes. pyobject
182
-
183
159
val __init__ : x : int -> y: int -> unit -> t option
184
-
185
160
val x : t -> int
186
-
187
161
val y : t -> int
188
-
189
162
val foo : t -> a: int -> b: int -> unit -> int
190
-
191
163
val do_nothing : t -> unit -> unit
192
-
193
164
val return_list : t -> l: string list -> unit -> string list
194
-
195
165
val return_opt_list : t -> l: string option list -> unit -> string option list
196
-
197
166
val return_array : t -> a: string array -> unit -> string array
198
167
199
168
val return_opt_array :
200
169
t -> a: string option array -> unit -> string option array
201
170
202
171
val bar : a: int -> b: int -> unit -> int
203
-
204
172
val do_nothing2 : unit -> unit
205
-
206
173
val hello : ' a todo
207
-
208
174
val world : ' a not_implemented
209
175
end = struct
210
176
type ' a todo = unit -> ' a
211
-
212
177
type ' a not_implemented = unit -> ' a
213
178
214
179
let filter_opt l = List . filter_map Fun. id l
215
-
216
180
let py_module = lazy (Py. Import. import_module " silly" )
217
-
218
181
let import_module () = Lazy. force py_module
219
182
220
183
type t = Pytypes. pyobject
@@ -224,7 +187,6 @@ of_pyobject returning option
224
187
Py. Object. is_instance pyo py_class
225
188
226
189
let of_pyobject pyo = if is_instance pyo then Some pyo else None
227
-
228
190
let to_pyobject x = x
229
191
230
192
let __init__ ~ x ~ y () =
@@ -235,7 +197,6 @@ of_pyobject returning option
235
197
of_pyobject @@ Py. Callable . to_function_with_keywords callable [|| ] kwargs
236
198
237
199
let x t = Py. Int . to_int @@ Py. Object. find_attr_string t " x"
238
-
239
200
let y t = Py. Int . to_int @@ Py. Object. find_attr_string t " y"
240
201
241
202
let foo t ~ a ~ b () =
@@ -313,7 +274,6 @@ of_pyobject returning option
313
274
ignore @@ Py. Callable . to_function_with_keywords callable [|| ] kwargs
314
275
315
276
let hello () = failwith " todo: hello"
316
-
317
277
let world () = failwith " not implemented: world"
318
278
end
319
279
$ dune exec . /run_option. exe 2> /dev/ null
@@ -335,50 +295,33 @@ of_pyobject returning Or_error
335
295
336
296
module Silly : sig
337
297
type ' a todo = unit -> ' a
338
-
339
298
type ' a not_implemented = unit -> ' a
340
-
341
299
type t
342
300
343
301
val of_pyobject : Pytypes. pyobject -> t Or_error. t
344
-
345
302
val to_pyobject : t -> Pytypes. pyobject
346
-
347
303
val __init__ : x : int -> y: int -> unit -> t Or_error. t
348
-
349
304
val x : t -> int
350
-
351
305
val y : t -> int
352
-
353
306
val foo : t -> a: int -> b: int -> unit -> int
354
-
355
307
val do_nothing : t -> unit -> unit
356
-
357
308
val return_list : t -> l: string list -> unit -> string list
358
-
359
309
val return_opt_list : t -> l: string option list -> unit -> string option list
360
-
361
310
val return_array : t -> a: string array -> unit -> string array
362
311
363
312
val return_opt_array :
364
313
t -> a: string option array -> unit -> string option array
365
314
366
315
val bar : a: int -> b: int -> unit -> int
367
-
368
316
val do_nothing2 : unit -> unit
369
-
370
317
val hello : ' a todo
371
-
372
318
val world : ' a not_implemented
373
319
end = struct
374
320
type ' a todo = unit -> ' a
375
-
376
321
type ' a not_implemented = unit -> ' a
377
322
378
323
let filter_opt = List . filter_opt
379
-
380
324
let py_module = lazy (Py. Import. import_module " silly" )
381
-
382
325
let import_module () = Lazy. force py_module
383
326
384
327
type t = Pytypes. pyobject
@@ -401,7 +344,6 @@ of_pyobject returning Or_error
401
344
of_pyobject @@ Py. Callable . to_function_with_keywords callable [|| ] kwargs
402
345
403
346
let x t = Py. Int . to_int @@ Py. Object. find_attr_string t " x"
404
-
405
347
let y t = Py. Int . to_int @@ Py. Object. find_attr_string t " y"
406
348
407
349
let foo t ~ a ~ b () =
@@ -479,7 +421,6 @@ of_pyobject returning Or_error
479
421
ignore @@ Py. Callable . to_function_with_keywords callable [|| ] kwargs
480
422
481
423
let hello () = failwith " todo: hello"
482
-
483
424
let world () = failwith " not implemented: world"
484
425
end
485
426
$ dune exec ./ run_or_error. exe
0 commit comments