nbis-python 0.1.4__py3-none-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
nbis/nbis/nbis.py ADDED
@@ -0,0 +1,2430 @@
1
+
2
+
3
+ # This file was autogenerated by some hot garbage in the `uniffi` crate.
4
+ # Trust me, you don't want to mess with it!
5
+
6
+ # Common helper code.
7
+ #
8
+ # Ideally this would live in a separate .py file where it can be unittested etc
9
+ # in isolation, and perhaps even published as a re-useable package.
10
+ #
11
+ # However, it's important that the details of how this helper code works (e.g. the
12
+ # way that different builtin types are passed across the FFI) exactly match what's
13
+ # expected by the rust code on the other side of the interface. In practice right
14
+ # now that means coming from the exact some version of `uniffi` that was used to
15
+ # compile the rust component. The easiest way to ensure this is to bundle the Python
16
+ # helpers directly inline like we're doing here.
17
+
18
+ from __future__ import annotations
19
+ import os
20
+ import sys
21
+ import ctypes
22
+ import enum
23
+ import struct
24
+ import contextlib
25
+ import datetime
26
+ import threading
27
+ import itertools
28
+ import traceback
29
+ import typing
30
+ import platform
31
+
32
+ # Used for default argument values
33
+ _DEFAULT = object() # type: typing.Any
34
+
35
+
36
+ class _UniffiRustBuffer(ctypes.Structure):
37
+ _fields_ = [
38
+ ("capacity", ctypes.c_uint64),
39
+ ("len", ctypes.c_uint64),
40
+ ("data", ctypes.POINTER(ctypes.c_char)),
41
+ ]
42
+
43
+ @staticmethod
44
+ def default():
45
+ return _UniffiRustBuffer(0, 0, None)
46
+
47
+ @staticmethod
48
+ def alloc(size):
49
+ return _uniffi_rust_call(_UniffiLib.ffi_nbis_rustbuffer_alloc, size)
50
+
51
+ @staticmethod
52
+ def reserve(rbuf, additional):
53
+ return _uniffi_rust_call(_UniffiLib.ffi_nbis_rustbuffer_reserve, rbuf, additional)
54
+
55
+ def free(self):
56
+ return _uniffi_rust_call(_UniffiLib.ffi_nbis_rustbuffer_free, self)
57
+
58
+ def __str__(self):
59
+ return "_UniffiRustBuffer(capacity={}, len={}, data={})".format(
60
+ self.capacity,
61
+ self.len,
62
+ self.data[0:self.len]
63
+ )
64
+
65
+ @contextlib.contextmanager
66
+ def alloc_with_builder(*args):
67
+ """Context-manger to allocate a buffer using a _UniffiRustBufferBuilder.
68
+
69
+ The allocated buffer will be automatically freed if an error occurs, ensuring that
70
+ we don't accidentally leak it.
71
+ """
72
+ builder = _UniffiRustBufferBuilder()
73
+ try:
74
+ yield builder
75
+ except:
76
+ builder.discard()
77
+ raise
78
+
79
+ @contextlib.contextmanager
80
+ def consume_with_stream(self):
81
+ """Context-manager to consume a buffer using a _UniffiRustBufferStream.
82
+
83
+ The _UniffiRustBuffer will be freed once the context-manager exits, ensuring that we don't
84
+ leak it even if an error occurs.
85
+ """
86
+ try:
87
+ s = _UniffiRustBufferStream.from_rust_buffer(self)
88
+ yield s
89
+ if s.remaining() != 0:
90
+ raise RuntimeError("junk data left in buffer at end of consume_with_stream")
91
+ finally:
92
+ self.free()
93
+
94
+ @contextlib.contextmanager
95
+ def read_with_stream(self):
96
+ """Context-manager to read a buffer using a _UniffiRustBufferStream.
97
+
98
+ This is like consume_with_stream, but doesn't free the buffer afterwards.
99
+ It should only be used with borrowed `_UniffiRustBuffer` data.
100
+ """
101
+ s = _UniffiRustBufferStream.from_rust_buffer(self)
102
+ yield s
103
+ if s.remaining() != 0:
104
+ raise RuntimeError("junk data left in buffer at end of read_with_stream")
105
+
106
+ class _UniffiForeignBytes(ctypes.Structure):
107
+ _fields_ = [
108
+ ("len", ctypes.c_int32),
109
+ ("data", ctypes.POINTER(ctypes.c_char)),
110
+ ]
111
+
112
+ def __str__(self):
113
+ return "_UniffiForeignBytes(len={}, data={})".format(self.len, self.data[0:self.len])
114
+
115
+
116
+ class _UniffiRustBufferStream:
117
+ """
118
+ Helper for structured reading of bytes from a _UniffiRustBuffer
119
+ """
120
+
121
+ def __init__(self, data, len):
122
+ self.data = data
123
+ self.len = len
124
+ self.offset = 0
125
+
126
+ @classmethod
127
+ def from_rust_buffer(cls, buf):
128
+ return cls(buf.data, buf.len)
129
+
130
+ def remaining(self):
131
+ return self.len - self.offset
132
+
133
+ def _unpack_from(self, size, format):
134
+ if self.offset + size > self.len:
135
+ raise InternalError("read past end of rust buffer")
136
+ value = struct.unpack(format, self.data[self.offset:self.offset+size])[0]
137
+ self.offset += size
138
+ return value
139
+
140
+ def read(self, size):
141
+ if self.offset + size > self.len:
142
+ raise InternalError("read past end of rust buffer")
143
+ data = self.data[self.offset:self.offset+size]
144
+ self.offset += size
145
+ return data
146
+
147
+ def read_i8(self):
148
+ return self._unpack_from(1, ">b")
149
+
150
+ def read_u8(self):
151
+ return self._unpack_from(1, ">B")
152
+
153
+ def read_i16(self):
154
+ return self._unpack_from(2, ">h")
155
+
156
+ def read_u16(self):
157
+ return self._unpack_from(2, ">H")
158
+
159
+ def read_i32(self):
160
+ return self._unpack_from(4, ">i")
161
+
162
+ def read_u32(self):
163
+ return self._unpack_from(4, ">I")
164
+
165
+ def read_i64(self):
166
+ return self._unpack_from(8, ">q")
167
+
168
+ def read_u64(self):
169
+ return self._unpack_from(8, ">Q")
170
+
171
+ def read_float(self):
172
+ v = self._unpack_from(4, ">f")
173
+ return v
174
+
175
+ def read_double(self):
176
+ return self._unpack_from(8, ">d")
177
+
178
+ class _UniffiRustBufferBuilder:
179
+ """
180
+ Helper for structured writing of bytes into a _UniffiRustBuffer.
181
+ """
182
+
183
+ def __init__(self):
184
+ self.rbuf = _UniffiRustBuffer.alloc(16)
185
+ self.rbuf.len = 0
186
+
187
+ def finalize(self):
188
+ rbuf = self.rbuf
189
+ self.rbuf = None
190
+ return rbuf
191
+
192
+ def discard(self):
193
+ if self.rbuf is not None:
194
+ rbuf = self.finalize()
195
+ rbuf.free()
196
+
197
+ @contextlib.contextmanager
198
+ def _reserve(self, num_bytes):
199
+ if self.rbuf.len + num_bytes > self.rbuf.capacity:
200
+ self.rbuf = _UniffiRustBuffer.reserve(self.rbuf, num_bytes)
201
+ yield None
202
+ self.rbuf.len += num_bytes
203
+
204
+ def _pack_into(self, size, format, value):
205
+ with self._reserve(size):
206
+ # XXX TODO: I feel like I should be able to use `struct.pack_into` here but can't figure it out.
207
+ for i, byte in enumerate(struct.pack(format, value)):
208
+ self.rbuf.data[self.rbuf.len + i] = byte
209
+
210
+ def write(self, value):
211
+ with self._reserve(len(value)):
212
+ for i, byte in enumerate(value):
213
+ self.rbuf.data[self.rbuf.len + i] = byte
214
+
215
+ def write_i8(self, v):
216
+ self._pack_into(1, ">b", v)
217
+
218
+ def write_u8(self, v):
219
+ self._pack_into(1, ">B", v)
220
+
221
+ def write_i16(self, v):
222
+ self._pack_into(2, ">h", v)
223
+
224
+ def write_u16(self, v):
225
+ self._pack_into(2, ">H", v)
226
+
227
+ def write_i32(self, v):
228
+ self._pack_into(4, ">i", v)
229
+
230
+ def write_u32(self, v):
231
+ self._pack_into(4, ">I", v)
232
+
233
+ def write_i64(self, v):
234
+ self._pack_into(8, ">q", v)
235
+
236
+ def write_u64(self, v):
237
+ self._pack_into(8, ">Q", v)
238
+
239
+ def write_float(self, v):
240
+ self._pack_into(4, ">f", v)
241
+
242
+ def write_double(self, v):
243
+ self._pack_into(8, ">d", v)
244
+
245
+ def write_c_size_t(self, v):
246
+ self._pack_into(ctypes.sizeof(ctypes.c_size_t) , "@N", v)
247
+ # A handful of classes and functions to support the generated data structures.
248
+ # This would be a good candidate for isolating in its own ffi-support lib.
249
+
250
+ class InternalError(Exception):
251
+ pass
252
+
253
+ class _UniffiRustCallStatus(ctypes.Structure):
254
+ """
255
+ Error runtime.
256
+ """
257
+ _fields_ = [
258
+ ("code", ctypes.c_int8),
259
+ ("error_buf", _UniffiRustBuffer),
260
+ ]
261
+
262
+ # These match the values from the uniffi::rustcalls module
263
+ CALL_SUCCESS = 0
264
+ CALL_ERROR = 1
265
+ CALL_UNEXPECTED_ERROR = 2
266
+
267
+ @staticmethod
268
+ def default():
269
+ return _UniffiRustCallStatus(code=_UniffiRustCallStatus.CALL_SUCCESS, error_buf=_UniffiRustBuffer.default())
270
+
271
+ def __str__(self):
272
+ if self.code == _UniffiRustCallStatus.CALL_SUCCESS:
273
+ return "_UniffiRustCallStatus(CALL_SUCCESS)"
274
+ elif self.code == _UniffiRustCallStatus.CALL_ERROR:
275
+ return "_UniffiRustCallStatus(CALL_ERROR)"
276
+ elif self.code == _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR:
277
+ return "_UniffiRustCallStatus(CALL_UNEXPECTED_ERROR)"
278
+ else:
279
+ return "_UniffiRustCallStatus(<invalid code>)"
280
+
281
+ def _uniffi_rust_call(fn, *args):
282
+ # Call a rust function
283
+ return _uniffi_rust_call_with_error(None, fn, *args)
284
+
285
+ def _uniffi_rust_call_with_error(error_ffi_converter, fn, *args):
286
+ # Call a rust function and handle any errors
287
+ #
288
+ # This function is used for rust calls that return Result<> and therefore can set the CALL_ERROR status code.
289
+ # error_ffi_converter must be set to the _UniffiConverter for the error class that corresponds to the result.
290
+ call_status = _UniffiRustCallStatus.default()
291
+
292
+ args_with_error = args + (ctypes.byref(call_status),)
293
+ result = fn(*args_with_error)
294
+ _uniffi_check_call_status(error_ffi_converter, call_status)
295
+ return result
296
+
297
+ def _uniffi_check_call_status(error_ffi_converter, call_status):
298
+ if call_status.code == _UniffiRustCallStatus.CALL_SUCCESS:
299
+ pass
300
+ elif call_status.code == _UniffiRustCallStatus.CALL_ERROR:
301
+ if error_ffi_converter is None:
302
+ call_status.error_buf.free()
303
+ raise InternalError("_uniffi_rust_call_with_error: CALL_ERROR, but error_ffi_converter is None")
304
+ else:
305
+ raise error_ffi_converter.lift(call_status.error_buf)
306
+ elif call_status.code == _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR:
307
+ # When the rust code sees a panic, it tries to construct a _UniffiRustBuffer
308
+ # with the message. But if that code panics, then it just sends back
309
+ # an empty buffer.
310
+ if call_status.error_buf.len > 0:
311
+ msg = _UniffiConverterString.lift(call_status.error_buf)
312
+ else:
313
+ msg = "Unknown rust panic"
314
+ raise InternalError(msg)
315
+ else:
316
+ raise InternalError("Invalid _UniffiRustCallStatus code: {}".format(
317
+ call_status.code))
318
+
319
+ def _uniffi_trait_interface_call(call_status, make_call, write_return_value):
320
+ try:
321
+ return write_return_value(make_call())
322
+ except Exception as e:
323
+ call_status.code = _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR
324
+ call_status.error_buf = _UniffiConverterString.lower(repr(e))
325
+
326
+ def _uniffi_trait_interface_call_with_error(call_status, make_call, write_return_value, error_type, lower_error):
327
+ try:
328
+ try:
329
+ return write_return_value(make_call())
330
+ except error_type as e:
331
+ call_status.code = _UniffiRustCallStatus.CALL_ERROR
332
+ call_status.error_buf = lower_error(e)
333
+ except Exception as e:
334
+ call_status.code = _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR
335
+ call_status.error_buf = _UniffiConverterString.lower(repr(e))
336
+ class _UniffiHandleMap:
337
+ """
338
+ A map where inserting, getting and removing data is synchronized with a lock.
339
+ """
340
+
341
+ def __init__(self):
342
+ # type Handle = int
343
+ self._map = {} # type: Dict[Handle, Any]
344
+ self._lock = threading.Lock()
345
+ self._counter = itertools.count()
346
+
347
+ def insert(self, obj):
348
+ with self._lock:
349
+ handle = next(self._counter)
350
+ self._map[handle] = obj
351
+ return handle
352
+
353
+ def get(self, handle):
354
+ try:
355
+ with self._lock:
356
+ return self._map[handle]
357
+ except KeyError:
358
+ raise InternalError("_UniffiHandleMap.get: Invalid handle")
359
+
360
+ def remove(self, handle):
361
+ try:
362
+ with self._lock:
363
+ return self._map.pop(handle)
364
+ except KeyError:
365
+ raise InternalError("_UniffiHandleMap.remove: Invalid handle")
366
+
367
+ def __len__(self):
368
+ return len(self._map)
369
+ # Types conforming to `_UniffiConverterPrimitive` pass themselves directly over the FFI.
370
+ class _UniffiConverterPrimitive:
371
+ @classmethod
372
+ def lift(cls, value):
373
+ return value
374
+
375
+ @classmethod
376
+ def lower(cls, value):
377
+ return value
378
+
379
+ class _UniffiConverterPrimitiveInt(_UniffiConverterPrimitive):
380
+ @classmethod
381
+ def check_lower(cls, value):
382
+ try:
383
+ value = value.__index__()
384
+ except Exception:
385
+ raise TypeError("'{}' object cannot be interpreted as an integer".format(type(value).__name__))
386
+ if not isinstance(value, int):
387
+ raise TypeError("__index__ returned non-int (type {})".format(type(value).__name__))
388
+ if not cls.VALUE_MIN <= value < cls.VALUE_MAX:
389
+ raise ValueError("{} requires {} <= value < {}".format(cls.CLASS_NAME, cls.VALUE_MIN, cls.VALUE_MAX))
390
+
391
+ class _UniffiConverterPrimitiveFloat(_UniffiConverterPrimitive):
392
+ @classmethod
393
+ def check_lower(cls, value):
394
+ try:
395
+ value = value.__float__()
396
+ except Exception:
397
+ raise TypeError("must be real number, not {}".format(type(value).__name__))
398
+ if not isinstance(value, float):
399
+ raise TypeError("__float__ returned non-float (type {})".format(type(value).__name__))
400
+
401
+ # Helper class for wrapper types that will always go through a _UniffiRustBuffer.
402
+ # Classes should inherit from this and implement the `read` and `write` static methods.
403
+ class _UniffiConverterRustBuffer:
404
+ @classmethod
405
+ def lift(cls, rbuf):
406
+ with rbuf.consume_with_stream() as stream:
407
+ return cls.read(stream)
408
+
409
+ @classmethod
410
+ def lower(cls, value):
411
+ with _UniffiRustBuffer.alloc_with_builder() as builder:
412
+ cls.write(value, builder)
413
+ return builder.finalize()
414
+
415
+ # Contains loading, initialization code, and the FFI Function declarations.
416
+ # Define some ctypes FFI types that we use in the library
417
+
418
+ """
419
+ Function pointer for a Rust task, which a callback function that takes a opaque pointer
420
+ """
421
+ _UNIFFI_RUST_TASK = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int8)
422
+
423
+ def _uniffi_future_callback_t(return_type):
424
+ """
425
+ Factory function to create callback function types for async functions
426
+ """
427
+ return ctypes.CFUNCTYPE(None, ctypes.c_uint64, return_type, _UniffiRustCallStatus)
428
+
429
+ def _uniffi_load_indirect():
430
+ """
431
+ This is how we find and load the dynamic library provided by the component.
432
+ For now we just look it up by name.
433
+ """
434
+ if sys.platform == "darwin":
435
+ libname = "lib{}.dylib"
436
+ elif sys.platform.startswith("win"):
437
+ # As of python3.8, ctypes does not seem to search $PATH when loading DLLs.
438
+ # We could use `os.add_dll_directory` to configure the search path, but
439
+ # it doesn't feel right to mess with application-wide settings. Let's
440
+ # assume that the `.dll` is next to the `.py` file and load by full path.
441
+ libname = os.path.join(
442
+ os.path.dirname(__file__),
443
+ "{}.dll",
444
+ )
445
+ else:
446
+ # Anything else must be an ELF platform - Linux, *BSD, Solaris/illumos
447
+ libname = "lib{}.so"
448
+
449
+ libname = libname.format("nbis")
450
+ path = os.path.join(os.path.dirname(__file__), libname)
451
+ lib = ctypes.cdll.LoadLibrary(path)
452
+ return lib
453
+
454
+ def _uniffi_check_contract_api_version(lib):
455
+ # Get the bindings contract version from our ComponentInterface
456
+ bindings_contract_version = 29
457
+ # Get the scaffolding contract version by calling the into the dylib
458
+ scaffolding_contract_version = lib.ffi_nbis_uniffi_contract_version()
459
+ if bindings_contract_version != scaffolding_contract_version:
460
+ raise InternalError("UniFFI contract version mismatch: try cleaning and rebuilding your project")
461
+
462
+ def _uniffi_check_api_checksums(lib):
463
+ if lib.uniffi_nbis_checksum_func_new_nbis_extractor() != 35866:
464
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
465
+ if lib.uniffi_nbis_checksum_method_minutia_angle() != 52761:
466
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
467
+ if lib.uniffi_nbis_checksum_method_minutia_kind() != 40353:
468
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
469
+ if lib.uniffi_nbis_checksum_method_minutia_position() != 53525:
470
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
471
+ if lib.uniffi_nbis_checksum_method_minutia_reliability() != 21196:
472
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
473
+ if lib.uniffi_nbis_checksum_method_minutia_x() != 62575:
474
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
475
+ if lib.uniffi_nbis_checksum_method_minutia_y() != 50671:
476
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
477
+ if lib.uniffi_nbis_checksum_method_minutiae_compare() != 16630:
478
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
479
+ if lib.uniffi_nbis_checksum_method_minutiae_get() != 15862:
480
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
481
+ if lib.uniffi_nbis_checksum_method_minutiae_quality() != 63465:
482
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
483
+ if lib.uniffi_nbis_checksum_method_minutiae_roi() != 49809:
484
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
485
+ if lib.uniffi_nbis_checksum_method_minutiae_to_iso_19794_2_2005() != 19032:
486
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
487
+ if lib.uniffi_nbis_checksum_method_nbisextractor_annotate_minutiae() != 59346:
488
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
489
+ if lib.uniffi_nbis_checksum_method_nbisextractor_annotate_minutiae_from_image_file() != 40713:
490
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
491
+ if lib.uniffi_nbis_checksum_method_nbisextractor_extract_minutiae() != 45214:
492
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
493
+ if lib.uniffi_nbis_checksum_method_nbisextractor_extract_minutiae_from_image_file() != 23955:
494
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
495
+ if lib.uniffi_nbis_checksum_method_nbisextractor_load_iso_19794_2_2005() != 25457:
496
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
497
+ if lib.uniffi_nbis_checksum_method_nbisextractor_settings() != 20186:
498
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
499
+
500
+ # A ctypes library to expose the extern-C FFI definitions.
501
+ # This is an implementation detail which will be called internally by the public API.
502
+
503
+ _UniffiLib = _uniffi_load_indirect()
504
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK = ctypes.CFUNCTYPE(None,ctypes.c_uint64,ctypes.c_int8,
505
+ )
506
+ _UNIFFI_FOREIGN_FUTURE_FREE = ctypes.CFUNCTYPE(None,ctypes.c_uint64,
507
+ )
508
+ _UNIFFI_CALLBACK_INTERFACE_FREE = ctypes.CFUNCTYPE(None,ctypes.c_uint64,
509
+ )
510
+ class _UniffiForeignFuture(ctypes.Structure):
511
+ _fields_ = [
512
+ ("handle", ctypes.c_uint64),
513
+ ("free", _UNIFFI_FOREIGN_FUTURE_FREE),
514
+ ]
515
+ class _UniffiForeignFutureStructU8(ctypes.Structure):
516
+ _fields_ = [
517
+ ("return_value", ctypes.c_uint8),
518
+ ("call_status", _UniffiRustCallStatus),
519
+ ]
520
+ _UNIFFI_FOREIGN_FUTURE_COMPLETE_U8 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU8,
521
+ )
522
+ class _UniffiForeignFutureStructI8(ctypes.Structure):
523
+ _fields_ = [
524
+ ("return_value", ctypes.c_int8),
525
+ ("call_status", _UniffiRustCallStatus),
526
+ ]
527
+ _UNIFFI_FOREIGN_FUTURE_COMPLETE_I8 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI8,
528
+ )
529
+ class _UniffiForeignFutureStructU16(ctypes.Structure):
530
+ _fields_ = [
531
+ ("return_value", ctypes.c_uint16),
532
+ ("call_status", _UniffiRustCallStatus),
533
+ ]
534
+ _UNIFFI_FOREIGN_FUTURE_COMPLETE_U16 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU16,
535
+ )
536
+ class _UniffiForeignFutureStructI16(ctypes.Structure):
537
+ _fields_ = [
538
+ ("return_value", ctypes.c_int16),
539
+ ("call_status", _UniffiRustCallStatus),
540
+ ]
541
+ _UNIFFI_FOREIGN_FUTURE_COMPLETE_I16 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI16,
542
+ )
543
+ class _UniffiForeignFutureStructU32(ctypes.Structure):
544
+ _fields_ = [
545
+ ("return_value", ctypes.c_uint32),
546
+ ("call_status", _UniffiRustCallStatus),
547
+ ]
548
+ _UNIFFI_FOREIGN_FUTURE_COMPLETE_U32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU32,
549
+ )
550
+ class _UniffiForeignFutureStructI32(ctypes.Structure):
551
+ _fields_ = [
552
+ ("return_value", ctypes.c_int32),
553
+ ("call_status", _UniffiRustCallStatus),
554
+ ]
555
+ _UNIFFI_FOREIGN_FUTURE_COMPLETE_I32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI32,
556
+ )
557
+ class _UniffiForeignFutureStructU64(ctypes.Structure):
558
+ _fields_ = [
559
+ ("return_value", ctypes.c_uint64),
560
+ ("call_status", _UniffiRustCallStatus),
561
+ ]
562
+ _UNIFFI_FOREIGN_FUTURE_COMPLETE_U64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU64,
563
+ )
564
+ class _UniffiForeignFutureStructI64(ctypes.Structure):
565
+ _fields_ = [
566
+ ("return_value", ctypes.c_int64),
567
+ ("call_status", _UniffiRustCallStatus),
568
+ ]
569
+ _UNIFFI_FOREIGN_FUTURE_COMPLETE_I64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI64,
570
+ )
571
+ class _UniffiForeignFutureStructF32(ctypes.Structure):
572
+ _fields_ = [
573
+ ("return_value", ctypes.c_float),
574
+ ("call_status", _UniffiRustCallStatus),
575
+ ]
576
+ _UNIFFI_FOREIGN_FUTURE_COMPLETE_F32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructF32,
577
+ )
578
+ class _UniffiForeignFutureStructF64(ctypes.Structure):
579
+ _fields_ = [
580
+ ("return_value", ctypes.c_double),
581
+ ("call_status", _UniffiRustCallStatus),
582
+ ]
583
+ _UNIFFI_FOREIGN_FUTURE_COMPLETE_F64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructF64,
584
+ )
585
+ class _UniffiForeignFutureStructPointer(ctypes.Structure):
586
+ _fields_ = [
587
+ ("return_value", ctypes.c_void_p),
588
+ ("call_status", _UniffiRustCallStatus),
589
+ ]
590
+ _UNIFFI_FOREIGN_FUTURE_COMPLETE_POINTER = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructPointer,
591
+ )
592
+ class _UniffiForeignFutureStructRustBuffer(ctypes.Structure):
593
+ _fields_ = [
594
+ ("return_value", _UniffiRustBuffer),
595
+ ("call_status", _UniffiRustCallStatus),
596
+ ]
597
+ _UNIFFI_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructRustBuffer,
598
+ )
599
+ class _UniffiForeignFutureStructVoid(ctypes.Structure):
600
+ _fields_ = [
601
+ ("call_status", _UniffiRustCallStatus),
602
+ ]
603
+ _UNIFFI_FOREIGN_FUTURE_COMPLETE_VOID = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructVoid,
604
+ )
605
+ _UniffiLib.uniffi_nbis_fn_clone_minutia.argtypes = (
606
+ ctypes.c_void_p,
607
+ ctypes.POINTER(_UniffiRustCallStatus),
608
+ )
609
+ _UniffiLib.uniffi_nbis_fn_clone_minutia.restype = ctypes.c_void_p
610
+ _UniffiLib.uniffi_nbis_fn_free_minutia.argtypes = (
611
+ ctypes.c_void_p,
612
+ ctypes.POINTER(_UniffiRustCallStatus),
613
+ )
614
+ _UniffiLib.uniffi_nbis_fn_free_minutia.restype = None
615
+ _UniffiLib.uniffi_nbis_fn_method_minutia_angle.argtypes = (
616
+ ctypes.c_void_p,
617
+ ctypes.POINTER(_UniffiRustCallStatus),
618
+ )
619
+ _UniffiLib.uniffi_nbis_fn_method_minutia_angle.restype = ctypes.c_double
620
+ _UniffiLib.uniffi_nbis_fn_method_minutia_kind.argtypes = (
621
+ ctypes.c_void_p,
622
+ ctypes.POINTER(_UniffiRustCallStatus),
623
+ )
624
+ _UniffiLib.uniffi_nbis_fn_method_minutia_kind.restype = _UniffiRustBuffer
625
+ _UniffiLib.uniffi_nbis_fn_method_minutia_position.argtypes = (
626
+ ctypes.c_void_p,
627
+ ctypes.POINTER(_UniffiRustCallStatus),
628
+ )
629
+ _UniffiLib.uniffi_nbis_fn_method_minutia_position.restype = _UniffiRustBuffer
630
+ _UniffiLib.uniffi_nbis_fn_method_minutia_reliability.argtypes = (
631
+ ctypes.c_void_p,
632
+ ctypes.POINTER(_UniffiRustCallStatus),
633
+ )
634
+ _UniffiLib.uniffi_nbis_fn_method_minutia_reliability.restype = ctypes.c_double
635
+ _UniffiLib.uniffi_nbis_fn_method_minutia_x.argtypes = (
636
+ ctypes.c_void_p,
637
+ ctypes.POINTER(_UniffiRustCallStatus),
638
+ )
639
+ _UniffiLib.uniffi_nbis_fn_method_minutia_x.restype = ctypes.c_int32
640
+ _UniffiLib.uniffi_nbis_fn_method_minutia_y.argtypes = (
641
+ ctypes.c_void_p,
642
+ ctypes.POINTER(_UniffiRustCallStatus),
643
+ )
644
+ _UniffiLib.uniffi_nbis_fn_method_minutia_y.restype = ctypes.c_int32
645
+ _UniffiLib.uniffi_nbis_fn_clone_minutiae.argtypes = (
646
+ ctypes.c_void_p,
647
+ ctypes.POINTER(_UniffiRustCallStatus),
648
+ )
649
+ _UniffiLib.uniffi_nbis_fn_clone_minutiae.restype = ctypes.c_void_p
650
+ _UniffiLib.uniffi_nbis_fn_free_minutiae.argtypes = (
651
+ ctypes.c_void_p,
652
+ ctypes.POINTER(_UniffiRustCallStatus),
653
+ )
654
+ _UniffiLib.uniffi_nbis_fn_free_minutiae.restype = None
655
+ _UniffiLib.uniffi_nbis_fn_method_minutiae_compare.argtypes = (
656
+ ctypes.c_void_p,
657
+ ctypes.c_void_p,
658
+ ctypes.POINTER(_UniffiRustCallStatus),
659
+ )
660
+ _UniffiLib.uniffi_nbis_fn_method_minutiae_compare.restype = ctypes.c_int32
661
+ _UniffiLib.uniffi_nbis_fn_method_minutiae_get.argtypes = (
662
+ ctypes.c_void_p,
663
+ ctypes.POINTER(_UniffiRustCallStatus),
664
+ )
665
+ _UniffiLib.uniffi_nbis_fn_method_minutiae_get.restype = _UniffiRustBuffer
666
+ _UniffiLib.uniffi_nbis_fn_method_minutiae_quality.argtypes = (
667
+ ctypes.c_void_p,
668
+ ctypes.POINTER(_UniffiRustCallStatus),
669
+ )
670
+ _UniffiLib.uniffi_nbis_fn_method_minutiae_quality.restype = _UniffiRustBuffer
671
+ _UniffiLib.uniffi_nbis_fn_method_minutiae_roi.argtypes = (
672
+ ctypes.c_void_p,
673
+ ctypes.POINTER(_UniffiRustCallStatus),
674
+ )
675
+ _UniffiLib.uniffi_nbis_fn_method_minutiae_roi.restype = _UniffiRustBuffer
676
+ _UniffiLib.uniffi_nbis_fn_method_minutiae_to_iso_19794_2_2005.argtypes = (
677
+ ctypes.c_void_p,
678
+ ctypes.POINTER(_UniffiRustCallStatus),
679
+ )
680
+ _UniffiLib.uniffi_nbis_fn_method_minutiae_to_iso_19794_2_2005.restype = _UniffiRustBuffer
681
+ _UniffiLib.uniffi_nbis_fn_clone_nbisextractor.argtypes = (
682
+ ctypes.c_void_p,
683
+ ctypes.POINTER(_UniffiRustCallStatus),
684
+ )
685
+ _UniffiLib.uniffi_nbis_fn_clone_nbisextractor.restype = ctypes.c_void_p
686
+ _UniffiLib.uniffi_nbis_fn_free_nbisextractor.argtypes = (
687
+ ctypes.c_void_p,
688
+ ctypes.POINTER(_UniffiRustCallStatus),
689
+ )
690
+ _UniffiLib.uniffi_nbis_fn_free_nbisextractor.restype = None
691
+ _UniffiLib.uniffi_nbis_fn_method_nbisextractor_annotate_minutiae.argtypes = (
692
+ ctypes.c_void_p,
693
+ _UniffiRustBuffer,
694
+ ctypes.POINTER(_UniffiRustCallStatus),
695
+ )
696
+ _UniffiLib.uniffi_nbis_fn_method_nbisextractor_annotate_minutiae.restype = _UniffiRustBuffer
697
+ _UniffiLib.uniffi_nbis_fn_method_nbisextractor_annotate_minutiae_from_image_file.argtypes = (
698
+ ctypes.c_void_p,
699
+ _UniffiRustBuffer,
700
+ ctypes.POINTER(_UniffiRustCallStatus),
701
+ )
702
+ _UniffiLib.uniffi_nbis_fn_method_nbisextractor_annotate_minutiae_from_image_file.restype = _UniffiRustBuffer
703
+ _UniffiLib.uniffi_nbis_fn_method_nbisextractor_extract_minutiae.argtypes = (
704
+ ctypes.c_void_p,
705
+ _UniffiRustBuffer,
706
+ ctypes.POINTER(_UniffiRustCallStatus),
707
+ )
708
+ _UniffiLib.uniffi_nbis_fn_method_nbisextractor_extract_minutiae.restype = ctypes.c_void_p
709
+ _UniffiLib.uniffi_nbis_fn_method_nbisextractor_extract_minutiae_from_image_file.argtypes = (
710
+ ctypes.c_void_p,
711
+ _UniffiRustBuffer,
712
+ ctypes.POINTER(_UniffiRustCallStatus),
713
+ )
714
+ _UniffiLib.uniffi_nbis_fn_method_nbisextractor_extract_minutiae_from_image_file.restype = ctypes.c_void_p
715
+ _UniffiLib.uniffi_nbis_fn_method_nbisextractor_load_iso_19794_2_2005.argtypes = (
716
+ ctypes.c_void_p,
717
+ _UniffiRustBuffer,
718
+ ctypes.POINTER(_UniffiRustCallStatus),
719
+ )
720
+ _UniffiLib.uniffi_nbis_fn_method_nbisextractor_load_iso_19794_2_2005.restype = ctypes.c_void_p
721
+ _UniffiLib.uniffi_nbis_fn_method_nbisextractor_settings.argtypes = (
722
+ ctypes.c_void_p,
723
+ ctypes.POINTER(_UniffiRustCallStatus),
724
+ )
725
+ _UniffiLib.uniffi_nbis_fn_method_nbisextractor_settings.restype = _UniffiRustBuffer
726
+ _UniffiLib.uniffi_nbis_fn_clone_nfiq2.argtypes = (
727
+ ctypes.c_void_p,
728
+ ctypes.POINTER(_UniffiRustCallStatus),
729
+ )
730
+ _UniffiLib.uniffi_nbis_fn_clone_nfiq2.restype = ctypes.c_void_p
731
+ _UniffiLib.uniffi_nbis_fn_free_nfiq2.argtypes = (
732
+ ctypes.c_void_p,
733
+ ctypes.POINTER(_UniffiRustCallStatus),
734
+ )
735
+ _UniffiLib.uniffi_nbis_fn_free_nfiq2.restype = None
736
+ _UniffiLib.uniffi_nbis_fn_func_new_nbis_extractor.argtypes = (
737
+ _UniffiRustBuffer,
738
+ ctypes.POINTER(_UniffiRustCallStatus),
739
+ )
740
+ _UniffiLib.uniffi_nbis_fn_func_new_nbis_extractor.restype = ctypes.c_void_p
741
+ _UniffiLib.ffi_nbis_rustbuffer_alloc.argtypes = (
742
+ ctypes.c_uint64,
743
+ ctypes.POINTER(_UniffiRustCallStatus),
744
+ )
745
+ _UniffiLib.ffi_nbis_rustbuffer_alloc.restype = _UniffiRustBuffer
746
+ _UniffiLib.ffi_nbis_rustbuffer_from_bytes.argtypes = (
747
+ _UniffiForeignBytes,
748
+ ctypes.POINTER(_UniffiRustCallStatus),
749
+ )
750
+ _UniffiLib.ffi_nbis_rustbuffer_from_bytes.restype = _UniffiRustBuffer
751
+ _UniffiLib.ffi_nbis_rustbuffer_free.argtypes = (
752
+ _UniffiRustBuffer,
753
+ ctypes.POINTER(_UniffiRustCallStatus),
754
+ )
755
+ _UniffiLib.ffi_nbis_rustbuffer_free.restype = None
756
+ _UniffiLib.ffi_nbis_rustbuffer_reserve.argtypes = (
757
+ _UniffiRustBuffer,
758
+ ctypes.c_uint64,
759
+ ctypes.POINTER(_UniffiRustCallStatus),
760
+ )
761
+ _UniffiLib.ffi_nbis_rustbuffer_reserve.restype = _UniffiRustBuffer
762
+ _UniffiLib.ffi_nbis_rust_future_poll_u8.argtypes = (
763
+ ctypes.c_uint64,
764
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
765
+ ctypes.c_uint64,
766
+ )
767
+ _UniffiLib.ffi_nbis_rust_future_poll_u8.restype = None
768
+ _UniffiLib.ffi_nbis_rust_future_cancel_u8.argtypes = (
769
+ ctypes.c_uint64,
770
+ )
771
+ _UniffiLib.ffi_nbis_rust_future_cancel_u8.restype = None
772
+ _UniffiLib.ffi_nbis_rust_future_free_u8.argtypes = (
773
+ ctypes.c_uint64,
774
+ )
775
+ _UniffiLib.ffi_nbis_rust_future_free_u8.restype = None
776
+ _UniffiLib.ffi_nbis_rust_future_complete_u8.argtypes = (
777
+ ctypes.c_uint64,
778
+ ctypes.POINTER(_UniffiRustCallStatus),
779
+ )
780
+ _UniffiLib.ffi_nbis_rust_future_complete_u8.restype = ctypes.c_uint8
781
+ _UniffiLib.ffi_nbis_rust_future_poll_i8.argtypes = (
782
+ ctypes.c_uint64,
783
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
784
+ ctypes.c_uint64,
785
+ )
786
+ _UniffiLib.ffi_nbis_rust_future_poll_i8.restype = None
787
+ _UniffiLib.ffi_nbis_rust_future_cancel_i8.argtypes = (
788
+ ctypes.c_uint64,
789
+ )
790
+ _UniffiLib.ffi_nbis_rust_future_cancel_i8.restype = None
791
+ _UniffiLib.ffi_nbis_rust_future_free_i8.argtypes = (
792
+ ctypes.c_uint64,
793
+ )
794
+ _UniffiLib.ffi_nbis_rust_future_free_i8.restype = None
795
+ _UniffiLib.ffi_nbis_rust_future_complete_i8.argtypes = (
796
+ ctypes.c_uint64,
797
+ ctypes.POINTER(_UniffiRustCallStatus),
798
+ )
799
+ _UniffiLib.ffi_nbis_rust_future_complete_i8.restype = ctypes.c_int8
800
+ _UniffiLib.ffi_nbis_rust_future_poll_u16.argtypes = (
801
+ ctypes.c_uint64,
802
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
803
+ ctypes.c_uint64,
804
+ )
805
+ _UniffiLib.ffi_nbis_rust_future_poll_u16.restype = None
806
+ _UniffiLib.ffi_nbis_rust_future_cancel_u16.argtypes = (
807
+ ctypes.c_uint64,
808
+ )
809
+ _UniffiLib.ffi_nbis_rust_future_cancel_u16.restype = None
810
+ _UniffiLib.ffi_nbis_rust_future_free_u16.argtypes = (
811
+ ctypes.c_uint64,
812
+ )
813
+ _UniffiLib.ffi_nbis_rust_future_free_u16.restype = None
814
+ _UniffiLib.ffi_nbis_rust_future_complete_u16.argtypes = (
815
+ ctypes.c_uint64,
816
+ ctypes.POINTER(_UniffiRustCallStatus),
817
+ )
818
+ _UniffiLib.ffi_nbis_rust_future_complete_u16.restype = ctypes.c_uint16
819
+ _UniffiLib.ffi_nbis_rust_future_poll_i16.argtypes = (
820
+ ctypes.c_uint64,
821
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
822
+ ctypes.c_uint64,
823
+ )
824
+ _UniffiLib.ffi_nbis_rust_future_poll_i16.restype = None
825
+ _UniffiLib.ffi_nbis_rust_future_cancel_i16.argtypes = (
826
+ ctypes.c_uint64,
827
+ )
828
+ _UniffiLib.ffi_nbis_rust_future_cancel_i16.restype = None
829
+ _UniffiLib.ffi_nbis_rust_future_free_i16.argtypes = (
830
+ ctypes.c_uint64,
831
+ )
832
+ _UniffiLib.ffi_nbis_rust_future_free_i16.restype = None
833
+ _UniffiLib.ffi_nbis_rust_future_complete_i16.argtypes = (
834
+ ctypes.c_uint64,
835
+ ctypes.POINTER(_UniffiRustCallStatus),
836
+ )
837
+ _UniffiLib.ffi_nbis_rust_future_complete_i16.restype = ctypes.c_int16
838
+ _UniffiLib.ffi_nbis_rust_future_poll_u32.argtypes = (
839
+ ctypes.c_uint64,
840
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
841
+ ctypes.c_uint64,
842
+ )
843
+ _UniffiLib.ffi_nbis_rust_future_poll_u32.restype = None
844
+ _UniffiLib.ffi_nbis_rust_future_cancel_u32.argtypes = (
845
+ ctypes.c_uint64,
846
+ )
847
+ _UniffiLib.ffi_nbis_rust_future_cancel_u32.restype = None
848
+ _UniffiLib.ffi_nbis_rust_future_free_u32.argtypes = (
849
+ ctypes.c_uint64,
850
+ )
851
+ _UniffiLib.ffi_nbis_rust_future_free_u32.restype = None
852
+ _UniffiLib.ffi_nbis_rust_future_complete_u32.argtypes = (
853
+ ctypes.c_uint64,
854
+ ctypes.POINTER(_UniffiRustCallStatus),
855
+ )
856
+ _UniffiLib.ffi_nbis_rust_future_complete_u32.restype = ctypes.c_uint32
857
+ _UniffiLib.ffi_nbis_rust_future_poll_i32.argtypes = (
858
+ ctypes.c_uint64,
859
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
860
+ ctypes.c_uint64,
861
+ )
862
+ _UniffiLib.ffi_nbis_rust_future_poll_i32.restype = None
863
+ _UniffiLib.ffi_nbis_rust_future_cancel_i32.argtypes = (
864
+ ctypes.c_uint64,
865
+ )
866
+ _UniffiLib.ffi_nbis_rust_future_cancel_i32.restype = None
867
+ _UniffiLib.ffi_nbis_rust_future_free_i32.argtypes = (
868
+ ctypes.c_uint64,
869
+ )
870
+ _UniffiLib.ffi_nbis_rust_future_free_i32.restype = None
871
+ _UniffiLib.ffi_nbis_rust_future_complete_i32.argtypes = (
872
+ ctypes.c_uint64,
873
+ ctypes.POINTER(_UniffiRustCallStatus),
874
+ )
875
+ _UniffiLib.ffi_nbis_rust_future_complete_i32.restype = ctypes.c_int32
876
+ _UniffiLib.ffi_nbis_rust_future_poll_u64.argtypes = (
877
+ ctypes.c_uint64,
878
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
879
+ ctypes.c_uint64,
880
+ )
881
+ _UniffiLib.ffi_nbis_rust_future_poll_u64.restype = None
882
+ _UniffiLib.ffi_nbis_rust_future_cancel_u64.argtypes = (
883
+ ctypes.c_uint64,
884
+ )
885
+ _UniffiLib.ffi_nbis_rust_future_cancel_u64.restype = None
886
+ _UniffiLib.ffi_nbis_rust_future_free_u64.argtypes = (
887
+ ctypes.c_uint64,
888
+ )
889
+ _UniffiLib.ffi_nbis_rust_future_free_u64.restype = None
890
+ _UniffiLib.ffi_nbis_rust_future_complete_u64.argtypes = (
891
+ ctypes.c_uint64,
892
+ ctypes.POINTER(_UniffiRustCallStatus),
893
+ )
894
+ _UniffiLib.ffi_nbis_rust_future_complete_u64.restype = ctypes.c_uint64
895
+ _UniffiLib.ffi_nbis_rust_future_poll_i64.argtypes = (
896
+ ctypes.c_uint64,
897
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
898
+ ctypes.c_uint64,
899
+ )
900
+ _UniffiLib.ffi_nbis_rust_future_poll_i64.restype = None
901
+ _UniffiLib.ffi_nbis_rust_future_cancel_i64.argtypes = (
902
+ ctypes.c_uint64,
903
+ )
904
+ _UniffiLib.ffi_nbis_rust_future_cancel_i64.restype = None
905
+ _UniffiLib.ffi_nbis_rust_future_free_i64.argtypes = (
906
+ ctypes.c_uint64,
907
+ )
908
+ _UniffiLib.ffi_nbis_rust_future_free_i64.restype = None
909
+ _UniffiLib.ffi_nbis_rust_future_complete_i64.argtypes = (
910
+ ctypes.c_uint64,
911
+ ctypes.POINTER(_UniffiRustCallStatus),
912
+ )
913
+ _UniffiLib.ffi_nbis_rust_future_complete_i64.restype = ctypes.c_int64
914
+ _UniffiLib.ffi_nbis_rust_future_poll_f32.argtypes = (
915
+ ctypes.c_uint64,
916
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
917
+ ctypes.c_uint64,
918
+ )
919
+ _UniffiLib.ffi_nbis_rust_future_poll_f32.restype = None
920
+ _UniffiLib.ffi_nbis_rust_future_cancel_f32.argtypes = (
921
+ ctypes.c_uint64,
922
+ )
923
+ _UniffiLib.ffi_nbis_rust_future_cancel_f32.restype = None
924
+ _UniffiLib.ffi_nbis_rust_future_free_f32.argtypes = (
925
+ ctypes.c_uint64,
926
+ )
927
+ _UniffiLib.ffi_nbis_rust_future_free_f32.restype = None
928
+ _UniffiLib.ffi_nbis_rust_future_complete_f32.argtypes = (
929
+ ctypes.c_uint64,
930
+ ctypes.POINTER(_UniffiRustCallStatus),
931
+ )
932
+ _UniffiLib.ffi_nbis_rust_future_complete_f32.restype = ctypes.c_float
933
+ _UniffiLib.ffi_nbis_rust_future_poll_f64.argtypes = (
934
+ ctypes.c_uint64,
935
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
936
+ ctypes.c_uint64,
937
+ )
938
+ _UniffiLib.ffi_nbis_rust_future_poll_f64.restype = None
939
+ _UniffiLib.ffi_nbis_rust_future_cancel_f64.argtypes = (
940
+ ctypes.c_uint64,
941
+ )
942
+ _UniffiLib.ffi_nbis_rust_future_cancel_f64.restype = None
943
+ _UniffiLib.ffi_nbis_rust_future_free_f64.argtypes = (
944
+ ctypes.c_uint64,
945
+ )
946
+ _UniffiLib.ffi_nbis_rust_future_free_f64.restype = None
947
+ _UniffiLib.ffi_nbis_rust_future_complete_f64.argtypes = (
948
+ ctypes.c_uint64,
949
+ ctypes.POINTER(_UniffiRustCallStatus),
950
+ )
951
+ _UniffiLib.ffi_nbis_rust_future_complete_f64.restype = ctypes.c_double
952
+ _UniffiLib.ffi_nbis_rust_future_poll_pointer.argtypes = (
953
+ ctypes.c_uint64,
954
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
955
+ ctypes.c_uint64,
956
+ )
957
+ _UniffiLib.ffi_nbis_rust_future_poll_pointer.restype = None
958
+ _UniffiLib.ffi_nbis_rust_future_cancel_pointer.argtypes = (
959
+ ctypes.c_uint64,
960
+ )
961
+ _UniffiLib.ffi_nbis_rust_future_cancel_pointer.restype = None
962
+ _UniffiLib.ffi_nbis_rust_future_free_pointer.argtypes = (
963
+ ctypes.c_uint64,
964
+ )
965
+ _UniffiLib.ffi_nbis_rust_future_free_pointer.restype = None
966
+ _UniffiLib.ffi_nbis_rust_future_complete_pointer.argtypes = (
967
+ ctypes.c_uint64,
968
+ ctypes.POINTER(_UniffiRustCallStatus),
969
+ )
970
+ _UniffiLib.ffi_nbis_rust_future_complete_pointer.restype = ctypes.c_void_p
971
+ _UniffiLib.ffi_nbis_rust_future_poll_rust_buffer.argtypes = (
972
+ ctypes.c_uint64,
973
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
974
+ ctypes.c_uint64,
975
+ )
976
+ _UniffiLib.ffi_nbis_rust_future_poll_rust_buffer.restype = None
977
+ _UniffiLib.ffi_nbis_rust_future_cancel_rust_buffer.argtypes = (
978
+ ctypes.c_uint64,
979
+ )
980
+ _UniffiLib.ffi_nbis_rust_future_cancel_rust_buffer.restype = None
981
+ _UniffiLib.ffi_nbis_rust_future_free_rust_buffer.argtypes = (
982
+ ctypes.c_uint64,
983
+ )
984
+ _UniffiLib.ffi_nbis_rust_future_free_rust_buffer.restype = None
985
+ _UniffiLib.ffi_nbis_rust_future_complete_rust_buffer.argtypes = (
986
+ ctypes.c_uint64,
987
+ ctypes.POINTER(_UniffiRustCallStatus),
988
+ )
989
+ _UniffiLib.ffi_nbis_rust_future_complete_rust_buffer.restype = _UniffiRustBuffer
990
+ _UniffiLib.ffi_nbis_rust_future_poll_void.argtypes = (
991
+ ctypes.c_uint64,
992
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
993
+ ctypes.c_uint64,
994
+ )
995
+ _UniffiLib.ffi_nbis_rust_future_poll_void.restype = None
996
+ _UniffiLib.ffi_nbis_rust_future_cancel_void.argtypes = (
997
+ ctypes.c_uint64,
998
+ )
999
+ _UniffiLib.ffi_nbis_rust_future_cancel_void.restype = None
1000
+ _UniffiLib.ffi_nbis_rust_future_free_void.argtypes = (
1001
+ ctypes.c_uint64,
1002
+ )
1003
+ _UniffiLib.ffi_nbis_rust_future_free_void.restype = None
1004
+ _UniffiLib.ffi_nbis_rust_future_complete_void.argtypes = (
1005
+ ctypes.c_uint64,
1006
+ ctypes.POINTER(_UniffiRustCallStatus),
1007
+ )
1008
+ _UniffiLib.ffi_nbis_rust_future_complete_void.restype = None
1009
+ _UniffiLib.uniffi_nbis_checksum_func_new_nbis_extractor.argtypes = (
1010
+ )
1011
+ _UniffiLib.uniffi_nbis_checksum_func_new_nbis_extractor.restype = ctypes.c_uint16
1012
+ _UniffiLib.uniffi_nbis_checksum_method_minutia_angle.argtypes = (
1013
+ )
1014
+ _UniffiLib.uniffi_nbis_checksum_method_minutia_angle.restype = ctypes.c_uint16
1015
+ _UniffiLib.uniffi_nbis_checksum_method_minutia_kind.argtypes = (
1016
+ )
1017
+ _UniffiLib.uniffi_nbis_checksum_method_minutia_kind.restype = ctypes.c_uint16
1018
+ _UniffiLib.uniffi_nbis_checksum_method_minutia_position.argtypes = (
1019
+ )
1020
+ _UniffiLib.uniffi_nbis_checksum_method_minutia_position.restype = ctypes.c_uint16
1021
+ _UniffiLib.uniffi_nbis_checksum_method_minutia_reliability.argtypes = (
1022
+ )
1023
+ _UniffiLib.uniffi_nbis_checksum_method_minutia_reliability.restype = ctypes.c_uint16
1024
+ _UniffiLib.uniffi_nbis_checksum_method_minutia_x.argtypes = (
1025
+ )
1026
+ _UniffiLib.uniffi_nbis_checksum_method_minutia_x.restype = ctypes.c_uint16
1027
+ _UniffiLib.uniffi_nbis_checksum_method_minutia_y.argtypes = (
1028
+ )
1029
+ _UniffiLib.uniffi_nbis_checksum_method_minutia_y.restype = ctypes.c_uint16
1030
+ _UniffiLib.uniffi_nbis_checksum_method_minutiae_compare.argtypes = (
1031
+ )
1032
+ _UniffiLib.uniffi_nbis_checksum_method_minutiae_compare.restype = ctypes.c_uint16
1033
+ _UniffiLib.uniffi_nbis_checksum_method_minutiae_get.argtypes = (
1034
+ )
1035
+ _UniffiLib.uniffi_nbis_checksum_method_minutiae_get.restype = ctypes.c_uint16
1036
+ _UniffiLib.uniffi_nbis_checksum_method_minutiae_quality.argtypes = (
1037
+ )
1038
+ _UniffiLib.uniffi_nbis_checksum_method_minutiae_quality.restype = ctypes.c_uint16
1039
+ _UniffiLib.uniffi_nbis_checksum_method_minutiae_roi.argtypes = (
1040
+ )
1041
+ _UniffiLib.uniffi_nbis_checksum_method_minutiae_roi.restype = ctypes.c_uint16
1042
+ _UniffiLib.uniffi_nbis_checksum_method_minutiae_to_iso_19794_2_2005.argtypes = (
1043
+ )
1044
+ _UniffiLib.uniffi_nbis_checksum_method_minutiae_to_iso_19794_2_2005.restype = ctypes.c_uint16
1045
+ _UniffiLib.uniffi_nbis_checksum_method_nbisextractor_annotate_minutiae.argtypes = (
1046
+ )
1047
+ _UniffiLib.uniffi_nbis_checksum_method_nbisextractor_annotate_minutiae.restype = ctypes.c_uint16
1048
+ _UniffiLib.uniffi_nbis_checksum_method_nbisextractor_annotate_minutiae_from_image_file.argtypes = (
1049
+ )
1050
+ _UniffiLib.uniffi_nbis_checksum_method_nbisextractor_annotate_minutiae_from_image_file.restype = ctypes.c_uint16
1051
+ _UniffiLib.uniffi_nbis_checksum_method_nbisextractor_extract_minutiae.argtypes = (
1052
+ )
1053
+ _UniffiLib.uniffi_nbis_checksum_method_nbisextractor_extract_minutiae.restype = ctypes.c_uint16
1054
+ _UniffiLib.uniffi_nbis_checksum_method_nbisextractor_extract_minutiae_from_image_file.argtypes = (
1055
+ )
1056
+ _UniffiLib.uniffi_nbis_checksum_method_nbisextractor_extract_minutiae_from_image_file.restype = ctypes.c_uint16
1057
+ _UniffiLib.uniffi_nbis_checksum_method_nbisextractor_load_iso_19794_2_2005.argtypes = (
1058
+ )
1059
+ _UniffiLib.uniffi_nbis_checksum_method_nbisextractor_load_iso_19794_2_2005.restype = ctypes.c_uint16
1060
+ _UniffiLib.uniffi_nbis_checksum_method_nbisextractor_settings.argtypes = (
1061
+ )
1062
+ _UniffiLib.uniffi_nbis_checksum_method_nbisextractor_settings.restype = ctypes.c_uint16
1063
+ _UniffiLib.ffi_nbis_uniffi_contract_version.argtypes = (
1064
+ )
1065
+ _UniffiLib.ffi_nbis_uniffi_contract_version.restype = ctypes.c_uint32
1066
+
1067
+ _uniffi_check_contract_api_version(_UniffiLib)
1068
+ # _uniffi_check_api_checksums(_UniffiLib)
1069
+
1070
+ # Public interface members begin here.
1071
+
1072
+
1073
+ class _UniffiConverterUInt32(_UniffiConverterPrimitiveInt):
1074
+ CLASS_NAME = "u32"
1075
+ VALUE_MIN = 0
1076
+ VALUE_MAX = 2**32
1077
+
1078
+ @staticmethod
1079
+ def read(buf):
1080
+ return buf.read_u32()
1081
+
1082
+ @staticmethod
1083
+ def write(value, buf):
1084
+ buf.write_u32(value)
1085
+
1086
+ class _UniffiConverterInt32(_UniffiConverterPrimitiveInt):
1087
+ CLASS_NAME = "i32"
1088
+ VALUE_MIN = -2**31
1089
+ VALUE_MAX = 2**31
1090
+
1091
+ @staticmethod
1092
+ def read(buf):
1093
+ return buf.read_i32()
1094
+
1095
+ @staticmethod
1096
+ def write(value, buf):
1097
+ buf.write_i32(value)
1098
+
1099
+ class _UniffiConverterInt64(_UniffiConverterPrimitiveInt):
1100
+ CLASS_NAME = "i64"
1101
+ VALUE_MIN = -2**63
1102
+ VALUE_MAX = 2**63
1103
+
1104
+ @staticmethod
1105
+ def read(buf):
1106
+ return buf.read_i64()
1107
+
1108
+ @staticmethod
1109
+ def write(value, buf):
1110
+ buf.write_i64(value)
1111
+
1112
+ class _UniffiConverterDouble(_UniffiConverterPrimitiveFloat):
1113
+ @staticmethod
1114
+ def read(buf):
1115
+ return buf.read_double()
1116
+
1117
+ @staticmethod
1118
+ def write(value, buf):
1119
+ buf.write_double(value)
1120
+
1121
+ class _UniffiConverterBool:
1122
+ @classmethod
1123
+ def check_lower(cls, value):
1124
+ return not not value
1125
+
1126
+ @classmethod
1127
+ def lower(cls, value):
1128
+ return 1 if value else 0
1129
+
1130
+ @staticmethod
1131
+ def lift(value):
1132
+ return value != 0
1133
+
1134
+ @classmethod
1135
+ def read(cls, buf):
1136
+ return cls.lift(buf.read_u8())
1137
+
1138
+ @classmethod
1139
+ def write(cls, value, buf):
1140
+ buf.write_u8(value)
1141
+
1142
+ class _UniffiConverterString:
1143
+ @staticmethod
1144
+ def check_lower(value):
1145
+ if not isinstance(value, str):
1146
+ raise TypeError("argument must be str, not {}".format(type(value).__name__))
1147
+ return value
1148
+
1149
+ @staticmethod
1150
+ def read(buf):
1151
+ size = buf.read_i32()
1152
+ if size < 0:
1153
+ raise InternalError("Unexpected negative string length")
1154
+ utf8_bytes = buf.read(size)
1155
+ return utf8_bytes.decode("utf-8")
1156
+
1157
+ @staticmethod
1158
+ def write(value, buf):
1159
+ utf8_bytes = value.encode("utf-8")
1160
+ buf.write_i32(len(utf8_bytes))
1161
+ buf.write(utf8_bytes)
1162
+
1163
+ @staticmethod
1164
+ def lift(buf):
1165
+ with buf.consume_with_stream() as stream:
1166
+ return stream.read(stream.remaining()).decode("utf-8")
1167
+
1168
+ @staticmethod
1169
+ def lower(value):
1170
+ with _UniffiRustBuffer.alloc_with_builder() as builder:
1171
+ builder.write(value.encode("utf-8"))
1172
+ return builder.finalize()
1173
+
1174
+ class _UniffiConverterBytes(_UniffiConverterRustBuffer):
1175
+ @staticmethod
1176
+ def read(buf):
1177
+ size = buf.read_i32()
1178
+ if size < 0:
1179
+ raise InternalError("Unexpected negative byte string length")
1180
+ return buf.read(size)
1181
+
1182
+ @staticmethod
1183
+ def check_lower(value):
1184
+ try:
1185
+ memoryview(value)
1186
+ except TypeError:
1187
+ raise TypeError("a bytes-like object is required, not {!r}".format(type(value).__name__))
1188
+
1189
+ @staticmethod
1190
+ def write(value, buf):
1191
+ buf.write_i32(len(value))
1192
+ buf.write(value)
1193
+
1194
+
1195
+
1196
+
1197
+
1198
+
1199
+
1200
+
1201
+
1202
+
1203
+ class NbisExtractorSettings:
1204
+ min_quality: "float"
1205
+ """
1206
+ The minimum quality of the minutiae to be extracted.
1207
+ """
1208
+
1209
+ get_center: "bool"
1210
+ """
1211
+ Whether to extract the center point / ROI of the fingerprint.
1212
+ """
1213
+
1214
+ check_fingerprint: "bool"
1215
+ """
1216
+ Whether to use SIVV to check for a valid fingerprint.
1217
+ """
1218
+
1219
+ compute_nfiq2: "bool"
1220
+ """
1221
+ Whether to compute the NFIQ2 quality of the fingerprint
1222
+ """
1223
+
1224
+ ppi: "typing.Optional[float]"
1225
+ """
1226
+ The PPI (pixels per inch) of the image. Default is 500.
1227
+ """
1228
+
1229
+ def __init__(self, *, min_quality: "float", get_center: "bool", check_fingerprint: "bool", compute_nfiq2: "bool", ppi: "typing.Optional[float]"):
1230
+ self.min_quality = min_quality
1231
+ self.get_center = get_center
1232
+ self.check_fingerprint = check_fingerprint
1233
+ self.compute_nfiq2 = compute_nfiq2
1234
+ self.ppi = ppi
1235
+
1236
+ def __str__(self):
1237
+ return "NbisExtractorSettings(min_quality={}, get_center={}, check_fingerprint={}, compute_nfiq2={}, ppi={})".format(self.min_quality, self.get_center, self.check_fingerprint, self.compute_nfiq2, self.ppi)
1238
+
1239
+ def __eq__(self, other):
1240
+ if self.min_quality != other.min_quality:
1241
+ return False
1242
+ if self.get_center != other.get_center:
1243
+ return False
1244
+ if self.check_fingerprint != other.check_fingerprint:
1245
+ return False
1246
+ if self.compute_nfiq2 != other.compute_nfiq2:
1247
+ return False
1248
+ if self.ppi != other.ppi:
1249
+ return False
1250
+ return True
1251
+
1252
+ class _UniffiConverterTypeNbisExtractorSettings(_UniffiConverterRustBuffer):
1253
+ @staticmethod
1254
+ def read(buf):
1255
+ return NbisExtractorSettings(
1256
+ min_quality=_UniffiConverterDouble.read(buf),
1257
+ get_center=_UniffiConverterBool.read(buf),
1258
+ check_fingerprint=_UniffiConverterBool.read(buf),
1259
+ compute_nfiq2=_UniffiConverterBool.read(buf),
1260
+ ppi=_UniffiConverterOptionalDouble.read(buf),
1261
+ )
1262
+
1263
+ @staticmethod
1264
+ def check_lower(value):
1265
+ _UniffiConverterDouble.check_lower(value.min_quality)
1266
+ _UniffiConverterBool.check_lower(value.get_center)
1267
+ _UniffiConverterBool.check_lower(value.check_fingerprint)
1268
+ _UniffiConverterBool.check_lower(value.compute_nfiq2)
1269
+ _UniffiConverterOptionalDouble.check_lower(value.ppi)
1270
+
1271
+ @staticmethod
1272
+ def write(value, buf):
1273
+ _UniffiConverterDouble.write(value.min_quality, buf)
1274
+ _UniffiConverterBool.write(value.get_center, buf)
1275
+ _UniffiConverterBool.write(value.check_fingerprint, buf)
1276
+ _UniffiConverterBool.write(value.compute_nfiq2, buf)
1277
+ _UniffiConverterOptionalDouble.write(value.ppi, buf)
1278
+
1279
+
1280
+ class Nfiq2Result:
1281
+ """
1282
+ Safe Rust view of the results
1283
+ """
1284
+
1285
+ score: "int"
1286
+ actionable: "typing.List[Nfiq2Value]"
1287
+ features: "typing.List[Nfiq2Value]"
1288
+ def __init__(self, *, score: "int", actionable: "typing.List[Nfiq2Value]", features: "typing.List[Nfiq2Value]"):
1289
+ self.score = score
1290
+ self.actionable = actionable
1291
+ self.features = features
1292
+
1293
+ def __str__(self):
1294
+ return "Nfiq2Result(score={}, actionable={}, features={})".format(self.score, self.actionable, self.features)
1295
+
1296
+ def __eq__(self, other):
1297
+ if self.score != other.score:
1298
+ return False
1299
+ if self.actionable != other.actionable:
1300
+ return False
1301
+ if self.features != other.features:
1302
+ return False
1303
+ return True
1304
+
1305
+ class _UniffiConverterTypeNfiq2Result(_UniffiConverterRustBuffer):
1306
+ @staticmethod
1307
+ def read(buf):
1308
+ return Nfiq2Result(
1309
+ score=_UniffiConverterUInt32.read(buf),
1310
+ actionable=_UniffiConverterSequenceTypeNfiq2Value.read(buf),
1311
+ features=_UniffiConverterSequenceTypeNfiq2Value.read(buf),
1312
+ )
1313
+
1314
+ @staticmethod
1315
+ def check_lower(value):
1316
+ _UniffiConverterUInt32.check_lower(value.score)
1317
+ _UniffiConverterSequenceTypeNfiq2Value.check_lower(value.actionable)
1318
+ _UniffiConverterSequenceTypeNfiq2Value.check_lower(value.features)
1319
+
1320
+ @staticmethod
1321
+ def write(value, buf):
1322
+ _UniffiConverterUInt32.write(value.score, buf)
1323
+ _UniffiConverterSequenceTypeNfiq2Value.write(value.actionable, buf)
1324
+ _UniffiConverterSequenceTypeNfiq2Value.write(value.features, buf)
1325
+
1326
+
1327
+ class Nfiq2Value:
1328
+ name: "str"
1329
+ value: "float"
1330
+ def __init__(self, *, name: "str", value: "float"):
1331
+ self.name = name
1332
+ self.value = value
1333
+
1334
+ def __str__(self):
1335
+ return "Nfiq2Value(name={}, value={})".format(self.name, self.value)
1336
+
1337
+ def __eq__(self, other):
1338
+ if self.name != other.name:
1339
+ return False
1340
+ if self.value != other.value:
1341
+ return False
1342
+ return True
1343
+
1344
+ class _UniffiConverterTypeNfiq2Value(_UniffiConverterRustBuffer):
1345
+ @staticmethod
1346
+ def read(buf):
1347
+ return Nfiq2Value(
1348
+ name=_UniffiConverterString.read(buf),
1349
+ value=_UniffiConverterDouble.read(buf),
1350
+ )
1351
+
1352
+ @staticmethod
1353
+ def check_lower(value):
1354
+ _UniffiConverterString.check_lower(value.name)
1355
+ _UniffiConverterDouble.check_lower(value.value)
1356
+
1357
+ @staticmethod
1358
+ def write(value, buf):
1359
+ _UniffiConverterString.write(value.name, buf)
1360
+ _UniffiConverterDouble.write(value.value, buf)
1361
+
1362
+
1363
+ class Point:
1364
+ x: "int"
1365
+ """
1366
+ The x-coordinate of the point.
1367
+ """
1368
+
1369
+ y: "int"
1370
+ """
1371
+ The y-coordinate of the point.
1372
+ """
1373
+
1374
+ def __init__(self, *, x: "int", y: "int"):
1375
+ self.x = x
1376
+ self.y = y
1377
+
1378
+ def __str__(self):
1379
+ return "Point(x={}, y={})".format(self.x, self.y)
1380
+
1381
+ def __eq__(self, other):
1382
+ if self.x != other.x:
1383
+ return False
1384
+ if self.y != other.y:
1385
+ return False
1386
+ return True
1387
+
1388
+ class _UniffiConverterTypePoint(_UniffiConverterRustBuffer):
1389
+ @staticmethod
1390
+ def read(buf):
1391
+ return Point(
1392
+ x=_UniffiConverterInt32.read(buf),
1393
+ y=_UniffiConverterInt32.read(buf),
1394
+ )
1395
+
1396
+ @staticmethod
1397
+ def check_lower(value):
1398
+ _UniffiConverterInt32.check_lower(value.x)
1399
+ _UniffiConverterInt32.check_lower(value.y)
1400
+
1401
+ @staticmethod
1402
+ def write(value, buf):
1403
+ _UniffiConverterInt32.write(value.x, buf)
1404
+ _UniffiConverterInt32.write(value.y, buf)
1405
+
1406
+
1407
+ class Position:
1408
+ x: "int"
1409
+ y: "int"
1410
+ def __init__(self, *, x: "int", y: "int"):
1411
+ self.x = x
1412
+ self.y = y
1413
+
1414
+ def __str__(self):
1415
+ return "Position(x={}, y={})".format(self.x, self.y)
1416
+
1417
+ def __eq__(self, other):
1418
+ if self.x != other.x:
1419
+ return False
1420
+ if self.y != other.y:
1421
+ return False
1422
+ return True
1423
+
1424
+ class _UniffiConverterTypePosition(_UniffiConverterRustBuffer):
1425
+ @staticmethod
1426
+ def read(buf):
1427
+ return Position(
1428
+ x=_UniffiConverterInt32.read(buf),
1429
+ y=_UniffiConverterInt32.read(buf),
1430
+ )
1431
+
1432
+ @staticmethod
1433
+ def check_lower(value):
1434
+ _UniffiConverterInt32.check_lower(value.x)
1435
+ _UniffiConverterInt32.check_lower(value.y)
1436
+
1437
+ @staticmethod
1438
+ def write(value, buf):
1439
+ _UniffiConverterInt32.write(value.x, buf)
1440
+ _UniffiConverterInt32.write(value.y, buf)
1441
+
1442
+
1443
+ class Roi:
1444
+ x1: "int"
1445
+ """
1446
+ The x-coordinate of the top-left corner of the ROI.
1447
+ """
1448
+
1449
+ y1: "int"
1450
+ """
1451
+ The y-coordinate of the top-left corner of the ROI.
1452
+ """
1453
+
1454
+ x2: "int"
1455
+ """
1456
+ The x-coordinate of the bottom-right corner of the ROI.
1457
+ """
1458
+
1459
+ y2: "int"
1460
+ """
1461
+ The y-coordinate of the bottom-right corner of the ROI.
1462
+ """
1463
+
1464
+ center: "Point"
1465
+ """
1466
+ The center point of the ROI.
1467
+ """
1468
+
1469
+ def __init__(self, *, x1: "int", y1: "int", x2: "int", y2: "int", center: "Point"):
1470
+ self.x1 = x1
1471
+ self.y1 = y1
1472
+ self.x2 = x2
1473
+ self.y2 = y2
1474
+ self.center = center
1475
+
1476
+ def __str__(self):
1477
+ return "Roi(x1={}, y1={}, x2={}, y2={}, center={})".format(self.x1, self.y1, self.x2, self.y2, self.center)
1478
+
1479
+ def __eq__(self, other):
1480
+ if self.x1 != other.x1:
1481
+ return False
1482
+ if self.y1 != other.y1:
1483
+ return False
1484
+ if self.x2 != other.x2:
1485
+ return False
1486
+ if self.y2 != other.y2:
1487
+ return False
1488
+ if self.center != other.center:
1489
+ return False
1490
+ return True
1491
+
1492
+ class _UniffiConverterTypeRoi(_UniffiConverterRustBuffer):
1493
+ @staticmethod
1494
+ def read(buf):
1495
+ return Roi(
1496
+ x1=_UniffiConverterInt32.read(buf),
1497
+ y1=_UniffiConverterInt32.read(buf),
1498
+ x2=_UniffiConverterInt32.read(buf),
1499
+ y2=_UniffiConverterInt32.read(buf),
1500
+ center=_UniffiConverterTypePoint.read(buf),
1501
+ )
1502
+
1503
+ @staticmethod
1504
+ def check_lower(value):
1505
+ _UniffiConverterInt32.check_lower(value.x1)
1506
+ _UniffiConverterInt32.check_lower(value.y1)
1507
+ _UniffiConverterInt32.check_lower(value.x2)
1508
+ _UniffiConverterInt32.check_lower(value.y2)
1509
+ _UniffiConverterTypePoint.check_lower(value.center)
1510
+
1511
+ @staticmethod
1512
+ def write(value, buf):
1513
+ _UniffiConverterInt32.write(value.x1, buf)
1514
+ _UniffiConverterInt32.write(value.y1, buf)
1515
+ _UniffiConverterInt32.write(value.x2, buf)
1516
+ _UniffiConverterInt32.write(value.y2, buf)
1517
+ _UniffiConverterTypePoint.write(value.center, buf)
1518
+
1519
+
1520
+
1521
+
1522
+
1523
+ class MinutiaKind(enum.Enum):
1524
+ RIDGE_ENDING = 1
1525
+
1526
+ BIFURCATION = 2
1527
+
1528
+
1529
+
1530
+ class _UniffiConverterTypeMinutiaKind(_UniffiConverterRustBuffer):
1531
+ @staticmethod
1532
+ def read(buf):
1533
+ variant = buf.read_i32()
1534
+ if variant == 1:
1535
+ return MinutiaKind.RIDGE_ENDING
1536
+ if variant == 2:
1537
+ return MinutiaKind.BIFURCATION
1538
+ raise InternalError("Raw enum value doesn't match any cases")
1539
+
1540
+ @staticmethod
1541
+ def check_lower(value):
1542
+ if value == MinutiaKind.RIDGE_ENDING:
1543
+ return
1544
+ if value == MinutiaKind.BIFURCATION:
1545
+ return
1546
+ raise ValueError(value)
1547
+
1548
+ @staticmethod
1549
+ def write(value, buf):
1550
+ if value == MinutiaKind.RIDGE_ENDING:
1551
+ buf.write_i32(1)
1552
+ if value == MinutiaKind.BIFURCATION:
1553
+ buf.write_i32(2)
1554
+
1555
+
1556
+
1557
+
1558
+ # NbisError
1559
+ # We want to define each variant as a nested class that's also a subclass,
1560
+ # which is tricky in Python. To accomplish this we're going to create each
1561
+ # class separately, then manually add the child classes to the base class's
1562
+ # __dict__. All of this happens in dummy class to avoid polluting the module
1563
+ # namespace.
1564
+ class NbisError(Exception):
1565
+ pass
1566
+
1567
+ _UniffiTempNbisError = NbisError
1568
+
1569
+ class NbisError: # type: ignore
1570
+ class ImageLoadError(_UniffiTempNbisError):
1571
+ def __init__(self):
1572
+ pass
1573
+
1574
+ def __repr__(self):
1575
+ return "NbisError.ImageLoadError({})".format(str(self))
1576
+ _UniffiTempNbisError.ImageLoadError = ImageLoadError # type: ignore
1577
+ class FileReadError(_UniffiTempNbisError):
1578
+ def __init__(self, *values):
1579
+ if len(values) != 1:
1580
+ raise TypeError(f"Expected 1 arguments, found {len(values)}")
1581
+ if not isinstance(values[0], str):
1582
+ raise TypeError(f"unexpected type for tuple element 0 - expected 'str', got '{type(values[0])}'")
1583
+ super().__init__(", ".join(map(repr, values)))
1584
+ self._values = values
1585
+
1586
+ def __getitem__(self, index):
1587
+ return self._values[index]
1588
+
1589
+ def __repr__(self):
1590
+ return "NbisError.FileReadError({})".format(str(self))
1591
+ _UniffiTempNbisError.FileReadError = FileReadError # type: ignore
1592
+ class InvalidQuality(_UniffiTempNbisError):
1593
+ def __init__(self, *values):
1594
+ if len(values) != 1:
1595
+ raise TypeError(f"Expected 1 arguments, found {len(values)}")
1596
+ if not isinstance(values[0], float):
1597
+ raise TypeError(f"unexpected type for tuple element 0 - expected 'float', got '{type(values[0])}'")
1598
+ super().__init__(", ".join(map(repr, values)))
1599
+ self._values = values
1600
+
1601
+ def __getitem__(self, index):
1602
+ return self._values[index]
1603
+
1604
+ def __repr__(self):
1605
+ return "NbisError.InvalidQuality({})".format(str(self))
1606
+ _UniffiTempNbisError.InvalidQuality = InvalidQuality # type: ignore
1607
+ class UnexpectedError(_UniffiTempNbisError):
1608
+ def __init__(self, *values):
1609
+ if len(values) != 1:
1610
+ raise TypeError(f"Expected 1 arguments, found {len(values)}")
1611
+ if not isinstance(values[0], int):
1612
+ raise TypeError(f"unexpected type for tuple element 0 - expected 'int', got '{type(values[0])}'")
1613
+ super().__init__(", ".join(map(repr, values)))
1614
+ self._values = values
1615
+
1616
+ def __getitem__(self, index):
1617
+ return self._values[index]
1618
+
1619
+ def __repr__(self):
1620
+ return "NbisError.UnexpectedError({})".format(str(self))
1621
+ _UniffiTempNbisError.UnexpectedError = UnexpectedError # type: ignore
1622
+ class InvalidTemplate(_UniffiTempNbisError):
1623
+ def __init__(self, *values):
1624
+ if len(values) != 1:
1625
+ raise TypeError(f"Expected 1 arguments, found {len(values)}")
1626
+ if not isinstance(values[0], str):
1627
+ raise TypeError(f"unexpected type for tuple element 0 - expected 'str', got '{type(values[0])}'")
1628
+ super().__init__(", ".join(map(repr, values)))
1629
+ self._values = values
1630
+
1631
+ def __getitem__(self, index):
1632
+ return self._values[index]
1633
+
1634
+ def __repr__(self):
1635
+ return "NbisError.InvalidTemplate({})".format(str(self))
1636
+ _UniffiTempNbisError.InvalidTemplate = InvalidTemplate # type: ignore
1637
+ class GenericError(_UniffiTempNbisError):
1638
+ def __init__(self, *values):
1639
+ if len(values) != 1:
1640
+ raise TypeError(f"Expected 1 arguments, found {len(values)}")
1641
+ if not isinstance(values[0], str):
1642
+ raise TypeError(f"unexpected type for tuple element 0 - expected 'str', got '{type(values[0])}'")
1643
+ super().__init__(", ".join(map(repr, values)))
1644
+ self._values = values
1645
+
1646
+ def __getitem__(self, index):
1647
+ return self._values[index]
1648
+
1649
+ def __repr__(self):
1650
+ return "NbisError.GenericError({})".format(str(self))
1651
+ _UniffiTempNbisError.GenericError = GenericError # type: ignore
1652
+ class Nfiq2NullContext(_UniffiTempNbisError):
1653
+ def __init__(self):
1654
+ pass
1655
+
1656
+ def __repr__(self):
1657
+ return "NbisError.Nfiq2NullContext({})".format(str(self))
1658
+ _UniffiTempNbisError.Nfiq2NullContext = Nfiq2NullContext # type: ignore
1659
+ class Nfiq2CreateFailed(_UniffiTempNbisError):
1660
+ def __init__(self):
1661
+ pass
1662
+
1663
+ def __repr__(self):
1664
+ return "NbisError.Nfiq2CreateFailed({})".format(str(self))
1665
+ _UniffiTempNbisError.Nfiq2CreateFailed = Nfiq2CreateFailed # type: ignore
1666
+ class Nfiq2ComputeFailed(_UniffiTempNbisError):
1667
+ def __init__(self, *values):
1668
+ if len(values) != 1:
1669
+ raise TypeError(f"Expected 1 arguments, found {len(values)}")
1670
+ if not isinstance(values[0], int):
1671
+ raise TypeError(f"unexpected type for tuple element 0 - expected 'int', got '{type(values[0])}'")
1672
+ super().__init__(", ".join(map(repr, values)))
1673
+ self._values = values
1674
+
1675
+ def __getitem__(self, index):
1676
+ return self._values[index]
1677
+
1678
+ def __repr__(self):
1679
+ return "NbisError.Nfiq2ComputeFailed({})".format(str(self))
1680
+ _UniffiTempNbisError.Nfiq2ComputeFailed = Nfiq2ComputeFailed # type: ignore
1681
+
1682
+ NbisError = _UniffiTempNbisError # type: ignore
1683
+ del _UniffiTempNbisError
1684
+
1685
+
1686
+ class _UniffiConverterTypeNbisError(_UniffiConverterRustBuffer):
1687
+ @staticmethod
1688
+ def read(buf):
1689
+ variant = buf.read_i32()
1690
+ if variant == 1:
1691
+ return NbisError.ImageLoadError(
1692
+ )
1693
+ if variant == 2:
1694
+ return NbisError.FileReadError(
1695
+ _UniffiConverterString.read(buf),
1696
+ )
1697
+ if variant == 3:
1698
+ return NbisError.InvalidQuality(
1699
+ _UniffiConverterDouble.read(buf),
1700
+ )
1701
+ if variant == 4:
1702
+ return NbisError.UnexpectedError(
1703
+ _UniffiConverterInt64.read(buf),
1704
+ )
1705
+ if variant == 5:
1706
+ return NbisError.InvalidTemplate(
1707
+ _UniffiConverterString.read(buf),
1708
+ )
1709
+ if variant == 6:
1710
+ return NbisError.GenericError(
1711
+ _UniffiConverterString.read(buf),
1712
+ )
1713
+ if variant == 7:
1714
+ return NbisError.Nfiq2NullContext(
1715
+ )
1716
+ if variant == 8:
1717
+ return NbisError.Nfiq2CreateFailed(
1718
+ )
1719
+ if variant == 9:
1720
+ return NbisError.Nfiq2ComputeFailed(
1721
+ _UniffiConverterInt32.read(buf),
1722
+ )
1723
+ raise InternalError("Raw enum value doesn't match any cases")
1724
+
1725
+ @staticmethod
1726
+ def check_lower(value):
1727
+ if isinstance(value, NbisError.ImageLoadError):
1728
+ return
1729
+ if isinstance(value, NbisError.FileReadError):
1730
+ _UniffiConverterString.check_lower(value._values[0])
1731
+ return
1732
+ if isinstance(value, NbisError.InvalidQuality):
1733
+ _UniffiConverterDouble.check_lower(value._values[0])
1734
+ return
1735
+ if isinstance(value, NbisError.UnexpectedError):
1736
+ _UniffiConverterInt64.check_lower(value._values[0])
1737
+ return
1738
+ if isinstance(value, NbisError.InvalidTemplate):
1739
+ _UniffiConverterString.check_lower(value._values[0])
1740
+ return
1741
+ if isinstance(value, NbisError.GenericError):
1742
+ _UniffiConverterString.check_lower(value._values[0])
1743
+ return
1744
+ if isinstance(value, NbisError.Nfiq2NullContext):
1745
+ return
1746
+ if isinstance(value, NbisError.Nfiq2CreateFailed):
1747
+ return
1748
+ if isinstance(value, NbisError.Nfiq2ComputeFailed):
1749
+ _UniffiConverterInt32.check_lower(value._values[0])
1750
+ return
1751
+
1752
+ @staticmethod
1753
+ def write(value, buf):
1754
+ if isinstance(value, NbisError.ImageLoadError):
1755
+ buf.write_i32(1)
1756
+ if isinstance(value, NbisError.FileReadError):
1757
+ buf.write_i32(2)
1758
+ _UniffiConverterString.write(value._values[0], buf)
1759
+ if isinstance(value, NbisError.InvalidQuality):
1760
+ buf.write_i32(3)
1761
+ _UniffiConverterDouble.write(value._values[0], buf)
1762
+ if isinstance(value, NbisError.UnexpectedError):
1763
+ buf.write_i32(4)
1764
+ _UniffiConverterInt64.write(value._values[0], buf)
1765
+ if isinstance(value, NbisError.InvalidTemplate):
1766
+ buf.write_i32(5)
1767
+ _UniffiConverterString.write(value._values[0], buf)
1768
+ if isinstance(value, NbisError.GenericError):
1769
+ buf.write_i32(6)
1770
+ _UniffiConverterString.write(value._values[0], buf)
1771
+ if isinstance(value, NbisError.Nfiq2NullContext):
1772
+ buf.write_i32(7)
1773
+ if isinstance(value, NbisError.Nfiq2CreateFailed):
1774
+ buf.write_i32(8)
1775
+ if isinstance(value, NbisError.Nfiq2ComputeFailed):
1776
+ buf.write_i32(9)
1777
+ _UniffiConverterInt32.write(value._values[0], buf)
1778
+
1779
+
1780
+
1781
+ class _UniffiConverterOptionalDouble(_UniffiConverterRustBuffer):
1782
+ @classmethod
1783
+ def check_lower(cls, value):
1784
+ if value is not None:
1785
+ _UniffiConverterDouble.check_lower(value)
1786
+
1787
+ @classmethod
1788
+ def write(cls, value, buf):
1789
+ if value is None:
1790
+ buf.write_u8(0)
1791
+ return
1792
+
1793
+ buf.write_u8(1)
1794
+ _UniffiConverterDouble.write(value, buf)
1795
+
1796
+ @classmethod
1797
+ def read(cls, buf):
1798
+ flag = buf.read_u8()
1799
+ if flag == 0:
1800
+ return None
1801
+ elif flag == 1:
1802
+ return _UniffiConverterDouble.read(buf)
1803
+ else:
1804
+ raise InternalError("Unexpected flag byte for optional type")
1805
+
1806
+
1807
+
1808
+ class _UniffiConverterOptionalTypeRoi(_UniffiConverterRustBuffer):
1809
+ @classmethod
1810
+ def check_lower(cls, value):
1811
+ if value is not None:
1812
+ _UniffiConverterTypeRoi.check_lower(value)
1813
+
1814
+ @classmethod
1815
+ def write(cls, value, buf):
1816
+ if value is None:
1817
+ buf.write_u8(0)
1818
+ return
1819
+
1820
+ buf.write_u8(1)
1821
+ _UniffiConverterTypeRoi.write(value, buf)
1822
+
1823
+ @classmethod
1824
+ def read(cls, buf):
1825
+ flag = buf.read_u8()
1826
+ if flag == 0:
1827
+ return None
1828
+ elif flag == 1:
1829
+ return _UniffiConverterTypeRoi.read(buf)
1830
+ else:
1831
+ raise InternalError("Unexpected flag byte for optional type")
1832
+
1833
+
1834
+
1835
+ class _UniffiConverterSequenceTypeMinutia(_UniffiConverterRustBuffer):
1836
+ @classmethod
1837
+ def check_lower(cls, value):
1838
+ for item in value:
1839
+ _UniffiConverterTypeMinutia.check_lower(item)
1840
+
1841
+ @classmethod
1842
+ def write(cls, value, buf):
1843
+ items = len(value)
1844
+ buf.write_i32(items)
1845
+ for item in value:
1846
+ _UniffiConverterTypeMinutia.write(item, buf)
1847
+
1848
+ @classmethod
1849
+ def read(cls, buf):
1850
+ count = buf.read_i32()
1851
+ if count < 0:
1852
+ raise InternalError("Unexpected negative sequence length")
1853
+
1854
+ return [
1855
+ _UniffiConverterTypeMinutia.read(buf) for i in range(count)
1856
+ ]
1857
+
1858
+
1859
+
1860
+ class _UniffiConverterSequenceTypeNfiq2Value(_UniffiConverterRustBuffer):
1861
+ @classmethod
1862
+ def check_lower(cls, value):
1863
+ for item in value:
1864
+ _UniffiConverterTypeNfiq2Value.check_lower(item)
1865
+
1866
+ @classmethod
1867
+ def write(cls, value, buf):
1868
+ items = len(value)
1869
+ buf.write_i32(items)
1870
+ for item in value:
1871
+ _UniffiConverterTypeNfiq2Value.write(item, buf)
1872
+
1873
+ @classmethod
1874
+ def read(cls, buf):
1875
+ count = buf.read_i32()
1876
+ if count < 0:
1877
+ raise InternalError("Unexpected negative sequence length")
1878
+
1879
+ return [
1880
+ _UniffiConverterTypeNfiq2Value.read(buf) for i in range(count)
1881
+ ]
1882
+
1883
+ # objects.
1884
+ class MinutiaProtocol(typing.Protocol):
1885
+ """
1886
+ A lightweight, fully-safe copy of one minutia.
1887
+ (Add more fields if you need them.)
1888
+ """
1889
+
1890
+ def angle(self, ):
1891
+ """
1892
+ Get the angle in degrees (0-360) for this minutia starting from the X axis (east).
1893
+ """
1894
+
1895
+ raise NotImplementedError
1896
+ def kind(self, ):
1897
+ """
1898
+ Get the kind of minutia (ridge ending or bifurcation).
1899
+ """
1900
+
1901
+ raise NotImplementedError
1902
+ def position(self, ):
1903
+ """
1904
+ Get the position as a tuple (x, y).
1905
+ """
1906
+
1907
+ raise NotImplementedError
1908
+ def reliability(self, ):
1909
+ """
1910
+ Get the reliability score (0.0 to 1.0).
1911
+ """
1912
+
1913
+ raise NotImplementedError
1914
+ def x(self, ):
1915
+ raise NotImplementedError
1916
+ def y(self, ):
1917
+ raise NotImplementedError
1918
+ # Minutia is a Rust-only trait - it's a wrapper around a Rust implementation.
1919
+ class Minutia():
1920
+ """
1921
+ A lightweight, fully-safe copy of one minutia.
1922
+ (Add more fields if you need them.)
1923
+ """
1924
+
1925
+ _pointer: ctypes.c_void_p
1926
+
1927
+ def __init__(self, *args, **kwargs):
1928
+ raise ValueError("This class has no default constructor")
1929
+
1930
+ def __del__(self):
1931
+ # In case of partial initialization of instances.
1932
+ pointer = getattr(self, "_pointer", None)
1933
+ if pointer is not None:
1934
+ _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_free_minutia, pointer)
1935
+
1936
+ def _uniffi_clone_pointer(self):
1937
+ return _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_clone_minutia, self._pointer)
1938
+
1939
+ # Used by alternative constructors or any methods which return this type.
1940
+ @classmethod
1941
+ def _make_instance_(cls, pointer):
1942
+ # Lightly yucky way to bypass the usual __init__ logic
1943
+ # and just create a new instance with the required pointer.
1944
+ inst = cls.__new__(cls)
1945
+ inst._pointer = pointer
1946
+ return inst
1947
+
1948
+
1949
+ def angle(self, ) -> "float":
1950
+ """
1951
+ Get the angle in degrees (0-360) for this minutia starting from the X axis (east).
1952
+ """
1953
+
1954
+ return _UniffiConverterDouble.lift(
1955
+ _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_method_minutia_angle,self._uniffi_clone_pointer(),)
1956
+ )
1957
+
1958
+
1959
+
1960
+
1961
+
1962
+ def kind(self, ) -> "MinutiaKind":
1963
+ """
1964
+ Get the kind of minutia (ridge ending or bifurcation).
1965
+ """
1966
+
1967
+ return _UniffiConverterTypeMinutiaKind.lift(
1968
+ _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_method_minutia_kind,self._uniffi_clone_pointer(),)
1969
+ )
1970
+
1971
+
1972
+
1973
+
1974
+
1975
+ def position(self, ) -> "Position":
1976
+ """
1977
+ Get the position as a tuple (x, y).
1978
+ """
1979
+
1980
+ return _UniffiConverterTypePosition.lift(
1981
+ _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_method_minutia_position,self._uniffi_clone_pointer(),)
1982
+ )
1983
+
1984
+
1985
+
1986
+
1987
+
1988
+ def reliability(self, ) -> "float":
1989
+ """
1990
+ Get the reliability score (0.0 to 1.0).
1991
+ """
1992
+
1993
+ return _UniffiConverterDouble.lift(
1994
+ _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_method_minutia_reliability,self._uniffi_clone_pointer(),)
1995
+ )
1996
+
1997
+
1998
+
1999
+
2000
+
2001
+ def x(self, ) -> "int":
2002
+ return _UniffiConverterInt32.lift(
2003
+ _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_method_minutia_x,self._uniffi_clone_pointer(),)
2004
+ )
2005
+
2006
+
2007
+
2008
+
2009
+
2010
+ def y(self, ) -> "int":
2011
+ return _UniffiConverterInt32.lift(
2012
+ _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_method_minutia_y,self._uniffi_clone_pointer(),)
2013
+ )
2014
+
2015
+
2016
+
2017
+
2018
+
2019
+
2020
+ class _UniffiConverterTypeMinutia:
2021
+
2022
+ @staticmethod
2023
+ def lift(value: int):
2024
+ return Minutia._make_instance_(value)
2025
+
2026
+ @staticmethod
2027
+ def check_lower(value: Minutia):
2028
+ if not isinstance(value, Minutia):
2029
+ raise TypeError("Expected Minutia instance, {} found".format(type(value).__name__))
2030
+
2031
+ @staticmethod
2032
+ def lower(value: MinutiaProtocol):
2033
+ if not isinstance(value, Minutia):
2034
+ raise TypeError("Expected Minutia instance, {} found".format(type(value).__name__))
2035
+ return value._uniffi_clone_pointer()
2036
+
2037
+ @classmethod
2038
+ def read(cls, buf: _UniffiRustBuffer):
2039
+ ptr = buf.read_u64()
2040
+ if ptr == 0:
2041
+ raise InternalError("Raw pointer value was null")
2042
+ return cls.lift(ptr)
2043
+
2044
+ @classmethod
2045
+ def write(cls, value: MinutiaProtocol, buf: _UniffiRustBuffer):
2046
+ buf.write_u64(cls.lower(value))
2047
+ class MinutiaeProtocol(typing.Protocol):
2048
+ """
2049
+ A set of minutiae extracted from a fingerprint image.
2050
+ """
2051
+
2052
+ def compare(self, other: "Minutiae"):
2053
+ """
2054
+ Similarity via Bozorth‑3 (higher = more similar). A score > 50 is a likely match.
2055
+
2056
+ # Arguments
2057
+ * `other` — another `Minutiae` object to compare against.
2058
+
2059
+ Returns an `i32` score representing the similarity between the two sets of minutiae.
2060
+ A higher score indicates more similarity.
2061
+ """
2062
+
2063
+ raise NotImplementedError
2064
+ def get(self, ):
2065
+ """
2066
+ Returns a vector of `Minutia` objects representing the minutiae in this set.
2067
+ """
2068
+
2069
+ raise NotImplementedError
2070
+ def quality(self, ):
2071
+ raise NotImplementedError
2072
+ def roi(self, ):
2073
+ """
2074
+ Returns the ROI (Region of Interest) associated with these minutiae, if any.
2075
+ """
2076
+
2077
+ raise NotImplementedError
2078
+ def to_iso_19794_2_2005(self, ):
2079
+ raise NotImplementedError
2080
+ # Minutiae is a Rust-only trait - it's a wrapper around a Rust implementation.
2081
+ class Minutiae():
2082
+ """
2083
+ A set of minutiae extracted from a fingerprint image.
2084
+ """
2085
+
2086
+ _pointer: ctypes.c_void_p
2087
+
2088
+ def __init__(self, *args, **kwargs):
2089
+ raise ValueError("This class has no default constructor")
2090
+
2091
+ def __del__(self):
2092
+ # In case of partial initialization of instances.
2093
+ pointer = getattr(self, "_pointer", None)
2094
+ if pointer is not None:
2095
+ _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_free_minutiae, pointer)
2096
+
2097
+ def _uniffi_clone_pointer(self):
2098
+ return _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_clone_minutiae, self._pointer)
2099
+
2100
+ # Used by alternative constructors or any methods which return this type.
2101
+ @classmethod
2102
+ def _make_instance_(cls, pointer):
2103
+ # Lightly yucky way to bypass the usual __init__ logic
2104
+ # and just create a new instance with the required pointer.
2105
+ inst = cls.__new__(cls)
2106
+ inst._pointer = pointer
2107
+ return inst
2108
+
2109
+
2110
+ def compare(self, other: "Minutiae") -> "int":
2111
+ """
2112
+ Similarity via Bozorth‑3 (higher = more similar). A score > 50 is a likely match.
2113
+
2114
+ # Arguments
2115
+ * `other` — another `Minutiae` object to compare against.
2116
+
2117
+ Returns an `i32` score representing the similarity between the two sets of minutiae.
2118
+ A higher score indicates more similarity.
2119
+ """
2120
+
2121
+ _UniffiConverterTypeMinutiae.check_lower(other)
2122
+
2123
+ return _UniffiConverterInt32.lift(
2124
+ _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_method_minutiae_compare,self._uniffi_clone_pointer(),
2125
+ _UniffiConverterTypeMinutiae.lower(other))
2126
+ )
2127
+
2128
+
2129
+
2130
+
2131
+
2132
+ def get(self, ) -> "typing.List[Minutia]":
2133
+ """
2134
+ Returns a vector of `Minutia` objects representing the minutiae in this set.
2135
+ """
2136
+
2137
+ return _UniffiConverterSequenceTypeMinutia.lift(
2138
+ _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_method_minutiae_get,self._uniffi_clone_pointer(),)
2139
+ )
2140
+
2141
+
2142
+
2143
+
2144
+
2145
+ def quality(self, ) -> "Nfiq2Result":
2146
+ return _UniffiConverterTypeNfiq2Result.lift(
2147
+ _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_method_minutiae_quality,self._uniffi_clone_pointer(),)
2148
+ )
2149
+
2150
+
2151
+
2152
+
2153
+
2154
+ def roi(self, ) -> "typing.Optional[Roi]":
2155
+ """
2156
+ Returns the ROI (Region of Interest) associated with these minutiae, if any.
2157
+ """
2158
+
2159
+ return _UniffiConverterOptionalTypeRoi.lift(
2160
+ _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_method_minutiae_roi,self._uniffi_clone_pointer(),)
2161
+ )
2162
+
2163
+
2164
+
2165
+
2166
+
2167
+ def to_iso_19794_2_2005(self, ) -> "bytes":
2168
+ return _UniffiConverterBytes.lift(
2169
+ _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_method_minutiae_to_iso_19794_2_2005,self._uniffi_clone_pointer(),)
2170
+ )
2171
+
2172
+
2173
+
2174
+
2175
+
2176
+
2177
+ class _UniffiConverterTypeMinutiae:
2178
+
2179
+ @staticmethod
2180
+ def lift(value: int):
2181
+ return Minutiae._make_instance_(value)
2182
+
2183
+ @staticmethod
2184
+ def check_lower(value: Minutiae):
2185
+ if not isinstance(value, Minutiae):
2186
+ raise TypeError("Expected Minutiae instance, {} found".format(type(value).__name__))
2187
+
2188
+ @staticmethod
2189
+ def lower(value: MinutiaeProtocol):
2190
+ if not isinstance(value, Minutiae):
2191
+ raise TypeError("Expected Minutiae instance, {} found".format(type(value).__name__))
2192
+ return value._uniffi_clone_pointer()
2193
+
2194
+ @classmethod
2195
+ def read(cls, buf: _UniffiRustBuffer):
2196
+ ptr = buf.read_u64()
2197
+ if ptr == 0:
2198
+ raise InternalError("Raw pointer value was null")
2199
+ return cls.lift(ptr)
2200
+
2201
+ @classmethod
2202
+ def write(cls, value: MinutiaeProtocol, buf: _UniffiRustBuffer):
2203
+ buf.write_u64(cls.lower(value))
2204
+ class NbisExtractorProtocol(typing.Protocol):
2205
+ def annotate_minutiae(self, image: "bytes"):
2206
+ raise NotImplementedError
2207
+ def annotate_minutiae_from_image_file(self, path: "str"):
2208
+ raise NotImplementedError
2209
+ def extract_minutiae(self, image_bytes: "bytes"):
2210
+ raise NotImplementedError
2211
+ def extract_minutiae_from_image_file(self, file_path: "str"):
2212
+ raise NotImplementedError
2213
+ def load_iso_19794_2_2005(self, template_bytes: "bytes"):
2214
+ raise NotImplementedError
2215
+ def settings(self, ):
2216
+ raise NotImplementedError
2217
+ # NbisExtractor is a Rust-only trait - it's a wrapper around a Rust implementation.
2218
+ class NbisExtractor():
2219
+ _pointer: ctypes.c_void_p
2220
+
2221
+ def __init__(self, *args, **kwargs):
2222
+ raise ValueError("This class has no default constructor")
2223
+
2224
+ def __del__(self):
2225
+ # In case of partial initialization of instances.
2226
+ pointer = getattr(self, "_pointer", None)
2227
+ if pointer is not None:
2228
+ _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_free_nbisextractor, pointer)
2229
+
2230
+ def _uniffi_clone_pointer(self):
2231
+ return _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_clone_nbisextractor, self._pointer)
2232
+
2233
+ # Used by alternative constructors or any methods which return this type.
2234
+ @classmethod
2235
+ def _make_instance_(cls, pointer):
2236
+ # Lightly yucky way to bypass the usual __init__ logic
2237
+ # and just create a new instance with the required pointer.
2238
+ inst = cls.__new__(cls)
2239
+ inst._pointer = pointer
2240
+ return inst
2241
+
2242
+
2243
+ def annotate_minutiae(self, image: "bytes") -> "bytes":
2244
+ _UniffiConverterBytes.check_lower(image)
2245
+
2246
+ return _UniffiConverterBytes.lift(
2247
+ _uniffi_rust_call_with_error(_UniffiConverterTypeNbisError,_UniffiLib.uniffi_nbis_fn_method_nbisextractor_annotate_minutiae,self._uniffi_clone_pointer(),
2248
+ _UniffiConverterBytes.lower(image))
2249
+ )
2250
+
2251
+
2252
+
2253
+
2254
+
2255
+ def annotate_minutiae_from_image_file(self, path: "str") -> "bytes":
2256
+ _UniffiConverterString.check_lower(path)
2257
+
2258
+ return _UniffiConverterBytes.lift(
2259
+ _uniffi_rust_call_with_error(_UniffiConverterTypeNbisError,_UniffiLib.uniffi_nbis_fn_method_nbisextractor_annotate_minutiae_from_image_file,self._uniffi_clone_pointer(),
2260
+ _UniffiConverterString.lower(path))
2261
+ )
2262
+
2263
+
2264
+
2265
+
2266
+
2267
+ def extract_minutiae(self, image_bytes: "bytes") -> "Minutiae":
2268
+ _UniffiConverterBytes.check_lower(image_bytes)
2269
+
2270
+ return _UniffiConverterTypeMinutiae.lift(
2271
+ _uniffi_rust_call_with_error(_UniffiConverterTypeNbisError,_UniffiLib.uniffi_nbis_fn_method_nbisextractor_extract_minutiae,self._uniffi_clone_pointer(),
2272
+ _UniffiConverterBytes.lower(image_bytes))
2273
+ )
2274
+
2275
+
2276
+
2277
+
2278
+
2279
+ def extract_minutiae_from_image_file(self, file_path: "str") -> "Minutiae":
2280
+ _UniffiConverterString.check_lower(file_path)
2281
+
2282
+ return _UniffiConverterTypeMinutiae.lift(
2283
+ _uniffi_rust_call_with_error(_UniffiConverterTypeNbisError,_UniffiLib.uniffi_nbis_fn_method_nbisextractor_extract_minutiae_from_image_file,self._uniffi_clone_pointer(),
2284
+ _UniffiConverterString.lower(file_path))
2285
+ )
2286
+
2287
+
2288
+
2289
+
2290
+
2291
+ def load_iso_19794_2_2005(self, template_bytes: "bytes") -> "Minutiae":
2292
+ _UniffiConverterBytes.check_lower(template_bytes)
2293
+
2294
+ return _UniffiConverterTypeMinutiae.lift(
2295
+ _uniffi_rust_call_with_error(_UniffiConverterTypeNbisError,_UniffiLib.uniffi_nbis_fn_method_nbisextractor_load_iso_19794_2_2005,self._uniffi_clone_pointer(),
2296
+ _UniffiConverterBytes.lower(template_bytes))
2297
+ )
2298
+
2299
+
2300
+
2301
+
2302
+
2303
+ def settings(self, ) -> "NbisExtractorSettings":
2304
+ return _UniffiConverterTypeNbisExtractorSettings.lift(
2305
+ _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_method_nbisextractor_settings,self._uniffi_clone_pointer(),)
2306
+ )
2307
+
2308
+
2309
+
2310
+
2311
+
2312
+
2313
+ class _UniffiConverterTypeNbisExtractor:
2314
+
2315
+ @staticmethod
2316
+ def lift(value: int):
2317
+ return NbisExtractor._make_instance_(value)
2318
+
2319
+ @staticmethod
2320
+ def check_lower(value: NbisExtractor):
2321
+ if not isinstance(value, NbisExtractor):
2322
+ raise TypeError("Expected NbisExtractor instance, {} found".format(type(value).__name__))
2323
+
2324
+ @staticmethod
2325
+ def lower(value: NbisExtractorProtocol):
2326
+ if not isinstance(value, NbisExtractor):
2327
+ raise TypeError("Expected NbisExtractor instance, {} found".format(type(value).__name__))
2328
+ return value._uniffi_clone_pointer()
2329
+
2330
+ @classmethod
2331
+ def read(cls, buf: _UniffiRustBuffer):
2332
+ ptr = buf.read_u64()
2333
+ if ptr == 0:
2334
+ raise InternalError("Raw pointer value was null")
2335
+ return cls.lift(ptr)
2336
+
2337
+ @classmethod
2338
+ def write(cls, value: NbisExtractorProtocol, buf: _UniffiRustBuffer):
2339
+ buf.write_u64(cls.lower(value))
2340
+ class Nfiq2Protocol(typing.Protocol):
2341
+ """
2342
+ The high‐level Rust handle
2343
+ """
2344
+
2345
+ pass
2346
+ # Nfiq2 is a Rust-only trait - it's a wrapper around a Rust implementation.
2347
+ class Nfiq2():
2348
+ """
2349
+ The high‐level Rust handle
2350
+ """
2351
+
2352
+ _pointer: ctypes.c_void_p
2353
+
2354
+ def __init__(self, *args, **kwargs):
2355
+ raise ValueError("This class has no default constructor")
2356
+
2357
+ def __del__(self):
2358
+ # In case of partial initialization of instances.
2359
+ pointer = getattr(self, "_pointer", None)
2360
+ if pointer is not None:
2361
+ _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_free_nfiq2, pointer)
2362
+
2363
+ def _uniffi_clone_pointer(self):
2364
+ return _uniffi_rust_call(_UniffiLib.uniffi_nbis_fn_clone_nfiq2, self._pointer)
2365
+
2366
+ # Used by alternative constructors or any methods which return this type.
2367
+ @classmethod
2368
+ def _make_instance_(cls, pointer):
2369
+ # Lightly yucky way to bypass the usual __init__ logic
2370
+ # and just create a new instance with the required pointer.
2371
+ inst = cls.__new__(cls)
2372
+ inst._pointer = pointer
2373
+ return inst
2374
+
2375
+
2376
+
2377
+ class _UniffiConverterTypeNfiq2:
2378
+
2379
+ @staticmethod
2380
+ def lift(value: int):
2381
+ return Nfiq2._make_instance_(value)
2382
+
2383
+ @staticmethod
2384
+ def check_lower(value: Nfiq2):
2385
+ if not isinstance(value, Nfiq2):
2386
+ raise TypeError("Expected Nfiq2 instance, {} found".format(type(value).__name__))
2387
+
2388
+ @staticmethod
2389
+ def lower(value: Nfiq2Protocol):
2390
+ if not isinstance(value, Nfiq2):
2391
+ raise TypeError("Expected Nfiq2 instance, {} found".format(type(value).__name__))
2392
+ return value._uniffi_clone_pointer()
2393
+
2394
+ @classmethod
2395
+ def read(cls, buf: _UniffiRustBuffer):
2396
+ ptr = buf.read_u64()
2397
+ if ptr == 0:
2398
+ raise InternalError("Raw pointer value was null")
2399
+ return cls.lift(ptr)
2400
+
2401
+ @classmethod
2402
+ def write(cls, value: Nfiq2Protocol, buf: _UniffiRustBuffer):
2403
+ buf.write_u64(cls.lower(value))
2404
+
2405
+ # Async support
2406
+
2407
+ def new_nbis_extractor(settings: "NbisExtractorSettings") -> "NbisExtractor":
2408
+ _UniffiConverterTypeNbisExtractorSettings.check_lower(settings)
2409
+
2410
+ return _UniffiConverterTypeNbisExtractor.lift(_uniffi_rust_call_with_error(_UniffiConverterTypeNbisError,_UniffiLib.uniffi_nbis_fn_func_new_nbis_extractor,
2411
+ _UniffiConverterTypeNbisExtractorSettings.lower(settings)))
2412
+
2413
+
2414
+ __all__ = [
2415
+ "InternalError",
2416
+ "MinutiaKind",
2417
+ "NbisError",
2418
+ "NbisExtractorSettings",
2419
+ "Nfiq2Result",
2420
+ "Nfiq2Value",
2421
+ "Point",
2422
+ "Position",
2423
+ "Roi",
2424
+ "new_nbis_extractor",
2425
+ "Minutia",
2426
+ "Minutiae",
2427
+ "NbisExtractor",
2428
+ "Nfiq2",
2429
+ ]
2430
+