python-libphash 2.0.1.0__cp310-abi3-win_amd64.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.
libphash/_native.pyi ADDED
@@ -0,0 +1,944 @@
1
+ # Generated by tools/stub.py from the built module; do not edit.
2
+ # Every function and constant of libphash.h, typed by cffi's argument rules.
3
+
4
+ from collections.abc import Callable, Iterator, Mapping, Sequence
5
+ from typing import Final, Literal, TypeVar, overload
6
+
7
+ from typing_extensions import Buffer
8
+
9
+ _P = TypeVar("_P", bound=Pointer)
10
+ _F = TypeVar("_F", bound=Callable[..., object])
11
+
12
+ class CData: ...
13
+
14
+ class Pointer(CData):
15
+ def __bool__(self) -> bool: ...
16
+
17
+ class void_ptr(Pointer): ...
18
+
19
+ class CField:
20
+ type: CType
21
+ offset: int
22
+
23
+ class CType:
24
+ kind: str
25
+ cname: str
26
+ item: CType
27
+ length: int | None
28
+ fields: list[tuple[str, CField]] | None
29
+ args: tuple[CType, ...]
30
+ result: CType
31
+ ellipsis: bool
32
+ elements: dict[int, str]
33
+
34
+ class CBuffer:
35
+ def __buffer__(self, flags: int, /) -> memoryview: ...
36
+ def __len__(self) -> int: ...
37
+ @overload
38
+ def __getitem__(self, index: int, /) -> bytes: ...
39
+ @overload
40
+ def __getitem__(self, index: slice, /) -> bytes: ...
41
+
42
+ class char_ptr(Pointer):
43
+ def __add__(self, offset: int, /) -> char_ptr: ...
44
+ def __getitem__(self, index: int, /) -> bytes: ...
45
+ def __setitem__(self, index: int, value: bytes, /) -> None: ...
46
+
47
+ class char_array(char_ptr):
48
+ def __len__(self) -> int: ...
49
+ def __iter__(self) -> Iterator[bytes]: ...
50
+
51
+ class double_ptr(Pointer):
52
+ def __add__(self, offset: int, /) -> double_ptr: ...
53
+ def __getitem__(self, index: int, /) -> float: ...
54
+ def __setitem__(self, index: int, value: float, /) -> None: ...
55
+
56
+ class double_array(double_ptr):
57
+ def __len__(self) -> int: ...
58
+ def __iter__(self) -> Iterator[float]: ...
59
+
60
+ class int_ptr(Pointer):
61
+ def __add__(self, offset: int, /) -> int_ptr: ...
62
+ def __getitem__(self, index: int, /) -> int: ...
63
+ def __setitem__(self, index: int, value: int, /) -> None: ...
64
+
65
+ class int_array(int_ptr):
66
+ def __len__(self) -> int: ...
67
+ def __iter__(self) -> Iterator[int]: ...
68
+
69
+ class ph_algorithm_t_ptr(Pointer):
70
+ def __add__(self, offset: int, /) -> ph_algorithm_t_ptr: ...
71
+ def __getitem__(self, index: int, /) -> int: ...
72
+ def __setitem__(self, index: int, value: int, /) -> None: ...
73
+
74
+ class ph_algorithm_t_array(ph_algorithm_t_ptr):
75
+ def __len__(self) -> int: ...
76
+ def __iter__(self) -> Iterator[int]: ...
77
+
78
+ class ph_batch_buffer_item_t(CData):
79
+ @property
80
+ def buffer(self) -> uint8_t_ptr: ...
81
+ @buffer.setter
82
+ def buffer(self, value: char_ptr | uint8_t_ptr | void_ptr) -> None: ...
83
+ length: int
84
+ @property
85
+ def hashes(self) -> uint64_t_array: ...
86
+ @hashes.setter
87
+ def hashes(self, value: uint64_t_array | Sequence[int]) -> None: ...
88
+ status: int
89
+
90
+ class ph_batch_buffer_item_t_ptr(Pointer):
91
+ @property
92
+ def buffer(self) -> uint8_t_ptr: ...
93
+ @buffer.setter
94
+ def buffer(self, value: char_ptr | uint8_t_ptr | void_ptr) -> None: ...
95
+ length: int
96
+ @property
97
+ def hashes(self) -> uint64_t_array: ...
98
+ @hashes.setter
99
+ def hashes(self, value: uint64_t_array | Sequence[int]) -> None: ...
100
+ status: int
101
+ def __add__(self, offset: int, /) -> ph_batch_buffer_item_t_ptr: ...
102
+ def __getitem__(self, index: int, /) -> ph_batch_buffer_item_t: ...
103
+ def __setitem__(self, index: int, value: ph_batch_buffer_item_t, /) -> None: ...
104
+
105
+ class ph_batch_buffer_item_t_array(ph_batch_buffer_item_t_ptr):
106
+ def __len__(self) -> int: ...
107
+ def __iter__(self) -> Iterator[ph_batch_buffer_item_t]: ...
108
+
109
+ class ph_batch_continue_fn(Pointer):
110
+ def __call__(self, user_data: Pointer, /) -> int: ...
111
+
112
+ class ph_batch_item_t(CData):
113
+ @property
114
+ def path(self) -> char_ptr: ...
115
+ @path.setter
116
+ def path(self, value: char_ptr | uint8_t_ptr | void_ptr) -> None: ...
117
+ @property
118
+ def hashes(self) -> uint64_t_array: ...
119
+ @hashes.setter
120
+ def hashes(self, value: uint64_t_array | Sequence[int]) -> None: ...
121
+ status: int
122
+
123
+ class ph_batch_item_t_ptr(Pointer):
124
+ @property
125
+ def path(self) -> char_ptr: ...
126
+ @path.setter
127
+ def path(self, value: char_ptr | uint8_t_ptr | void_ptr) -> None: ...
128
+ @property
129
+ def hashes(self) -> uint64_t_array: ...
130
+ @hashes.setter
131
+ def hashes(self, value: uint64_t_array | Sequence[int]) -> None: ...
132
+ status: int
133
+ def __add__(self, offset: int, /) -> ph_batch_item_t_ptr: ...
134
+ def __getitem__(self, index: int, /) -> ph_batch_item_t: ...
135
+ def __setitem__(self, index: int, value: ph_batch_item_t, /) -> None: ...
136
+
137
+ class ph_batch_item_t_array(ph_batch_item_t_ptr):
138
+ def __len__(self) -> int: ...
139
+ def __iter__(self) -> Iterator[ph_batch_item_t]: ...
140
+
141
+ class ph_batch_options_t(CData):
142
+ struct_size: int
143
+ @property
144
+ def config(self) -> ph_context_t_ptr: ...
145
+ @config.setter
146
+ def config(self, value: ph_context_t_ptr | void_ptr) -> None: ...
147
+ threads: int
148
+ @property
149
+ def should_continue(self) -> ph_batch_continue_fn: ...
150
+ @should_continue.setter
151
+ def should_continue(self, value: ph_batch_continue_fn | void_ptr) -> None: ...
152
+ @property
153
+ def on_progress(self) -> ph_batch_progress_fn: ...
154
+ @on_progress.setter
155
+ def on_progress(self, value: ph_batch_progress_fn | void_ptr) -> None: ...
156
+ @property
157
+ def user_data(self) -> void_ptr: ...
158
+ @user_data.setter
159
+ def user_data(self, value: Pointer) -> None: ...
160
+
161
+ class ph_batch_options_t_ptr(Pointer):
162
+ struct_size: int
163
+ @property
164
+ def config(self) -> ph_context_t_ptr: ...
165
+ @config.setter
166
+ def config(self, value: ph_context_t_ptr | void_ptr) -> None: ...
167
+ threads: int
168
+ @property
169
+ def should_continue(self) -> ph_batch_continue_fn: ...
170
+ @should_continue.setter
171
+ def should_continue(self, value: ph_batch_continue_fn | void_ptr) -> None: ...
172
+ @property
173
+ def on_progress(self) -> ph_batch_progress_fn: ...
174
+ @on_progress.setter
175
+ def on_progress(self, value: ph_batch_progress_fn | void_ptr) -> None: ...
176
+ @property
177
+ def user_data(self) -> void_ptr: ...
178
+ @user_data.setter
179
+ def user_data(self, value: Pointer) -> None: ...
180
+ def __add__(self, offset: int, /) -> ph_batch_options_t_ptr: ...
181
+ def __getitem__(self, index: int, /) -> ph_batch_options_t: ...
182
+ def __setitem__(self, index: int, value: ph_batch_options_t, /) -> None: ...
183
+
184
+ class ph_batch_options_t_array(ph_batch_options_t_ptr):
185
+ def __len__(self) -> int: ...
186
+ def __iter__(self) -> Iterator[ph_batch_options_t]: ...
187
+
188
+ class ph_batch_progress_fn(Pointer):
189
+ def __call__(self, done: int, total: int, user_data: Pointer, /) -> None: ...
190
+
191
+ class ph_context_t_ptr(Pointer): ...
192
+
193
+ class ph_context_t_ptr_ptr(Pointer):
194
+ def __add__(self, offset: int, /) -> ph_context_t_ptr_ptr: ...
195
+ def __getitem__(self, index: int, /) -> ph_context_t_ptr: ...
196
+ def __setitem__(
197
+ self, index: int, value: ph_context_t_ptr | void_ptr, /
198
+ ) -> None: ...
199
+
200
+ class ph_context_t_ptr_array(ph_context_t_ptr_ptr):
201
+ def __len__(self) -> int: ...
202
+ def __iter__(self) -> Iterator[ph_context_t_ptr]: ...
203
+
204
+ class ph_digest_kind_t_ptr(Pointer):
205
+ def __add__(self, offset: int, /) -> ph_digest_kind_t_ptr: ...
206
+ def __getitem__(self, index: int, /) -> int: ...
207
+ def __setitem__(self, index: int, value: int, /) -> None: ...
208
+
209
+ class ph_digest_kind_t_array(ph_digest_kind_t_ptr):
210
+ def __len__(self) -> int: ...
211
+ def __iter__(self) -> Iterator[int]: ...
212
+
213
+ class ph_digest_t(CData):
214
+ @property
215
+ def data(self) -> uint8_t_array: ...
216
+ @data.setter
217
+ def data(self, value: uint8_t_array | Sequence[int]) -> None: ...
218
+ size: int
219
+ kind: int
220
+ @property
221
+ def reserved(self) -> uint8_t_array: ...
222
+ @reserved.setter
223
+ def reserved(self, value: uint8_t_array | Sequence[int]) -> None: ...
224
+
225
+ class ph_digest_t_ptr(Pointer):
226
+ @property
227
+ def data(self) -> uint8_t_array: ...
228
+ @data.setter
229
+ def data(self, value: uint8_t_array | Sequence[int]) -> None: ...
230
+ size: int
231
+ kind: int
232
+ @property
233
+ def reserved(self) -> uint8_t_array: ...
234
+ @reserved.setter
235
+ def reserved(self, value: uint8_t_array | Sequence[int]) -> None: ...
236
+ def __add__(self, offset: int, /) -> ph_digest_t_ptr: ...
237
+ def __getitem__(self, index: int, /) -> ph_digest_t: ...
238
+ def __setitem__(self, index: int, value: ph_digest_t, /) -> None: ...
239
+
240
+ class ph_digest_t_array(ph_digest_t_ptr):
241
+ def __len__(self) -> int: ...
242
+ def __iter__(self) -> Iterator[ph_digest_t]: ...
243
+
244
+ class size_t_ptr(Pointer):
245
+ def __add__(self, offset: int, /) -> size_t_ptr: ...
246
+ def __getitem__(self, index: int, /) -> int: ...
247
+ def __setitem__(self, index: int, value: int, /) -> None: ...
248
+
249
+ class size_t_array(size_t_ptr):
250
+ def __len__(self) -> int: ...
251
+ def __iter__(self) -> Iterator[int]: ...
252
+
253
+ class uint64_t_ptr(Pointer):
254
+ def __add__(self, offset: int, /) -> uint64_t_ptr: ...
255
+ def __getitem__(self, index: int, /) -> int: ...
256
+ def __setitem__(self, index: int, value: int, /) -> None: ...
257
+
258
+ class uint64_t_array(uint64_t_ptr):
259
+ def __len__(self) -> int: ...
260
+ def __iter__(self) -> Iterator[int]: ...
261
+
262
+ class uint8_t_ptr(Pointer):
263
+ def __add__(self, offset: int, /) -> uint8_t_ptr: ...
264
+ def __getitem__(self, index: int, /) -> int: ...
265
+ def __setitem__(self, index: int, value: int, /) -> None: ...
266
+
267
+ class uint8_t_array(uint8_t_ptr):
268
+ def __len__(self) -> int: ...
269
+ def __iter__(self) -> Iterator[int]: ...
270
+
271
+ class _Lib:
272
+ PH_ALGORITHM_COUNT: Final[int]
273
+ PH_ALGO_AHASH: Final[int]
274
+ PH_ALGO_BMH: Final[int]
275
+ PH_ALGO_COLOR_HASH: Final[int]
276
+ PH_ALGO_COLOR_MOMENTS: Final[int]
277
+ PH_ALGO_DHASH: Final[int]
278
+ PH_ALGO_FORCE_INT32_: Final[int]
279
+ PH_ALGO_MHASH: Final[int]
280
+ PH_ALGO_PHASH: Final[int]
281
+ PH_ALGO_RADIAL: Final[int]
282
+ PH_ALGO_WHASH: Final[int]
283
+ PH_ALPHA_BLEND_BLACK: Final[int]
284
+ PH_ALPHA_BLEND_GREY: Final[int]
285
+ PH_ALPHA_BLEND_WHITE: Final[int]
286
+ PH_ALPHA_FORCE_INT32_: Final[int]
287
+ PH_ALPHA_IGNORE: Final[int]
288
+ PH_BATCH_HASHES_CAPACITY: Final[int]
289
+ PH_DECODE_SCALE_EIGHTH: Final[int]
290
+ PH_DECODE_SCALE_FORCE_INT32_: Final[int]
291
+ PH_DECODE_SCALE_FULL: Final[int]
292
+ PH_DECODE_SCALE_HALF: Final[int]
293
+ PH_DECODE_SCALE_QUARTER: Final[int]
294
+ PH_DIGEST_HEX_BUFFER_SIZE: Final[int]
295
+ PH_DIGEST_KIND_BITS: Final[int]
296
+ PH_DIGEST_KIND_COEFFICIENTS: Final[int]
297
+ PH_DIGEST_KIND_FORCE_INT32_: Final[int]
298
+ PH_DIGEST_KIND_HISTOGRAM: Final[int]
299
+ PH_DIGEST_KIND_UNSPECIFIED: Final[int]
300
+ PH_DIGEST_KIND_VECTOR: Final[int]
301
+ PH_DIGEST_KIND_VECTOR16: Final[int]
302
+ PH_DIGEST_MAX_BYTES: Final[int]
303
+ PH_ENUM_FORCE_INT32_VALUE: Final[int]
304
+ PH_ERR_ALLOCATION_FAILED: Final[int]
305
+ PH_ERR_CANCELLED: Final[int]
306
+ PH_ERR_CORRUPT_DATA: Final[int]
307
+ PH_ERR_DECODER_UNAVAILABLE: Final[int]
308
+ PH_ERR_EMPTY_IMAGE: Final[int]
309
+ PH_ERR_FORCE_INT32_: Final[int]
310
+ PH_ERR_IMAGE_TOO_LARGE: Final[int]
311
+ PH_ERR_INVALID_ARGUMENT: Final[int]
312
+ PH_ERR_IO: Final[int]
313
+ PH_ERR_NO_STRUCTURE: Final[int]
314
+ PH_ERR_REQUIRES_COLOR: Final[int]
315
+ PH_ERR_UNSUPPORTED_FORMAT: Final[int]
316
+ PH_HASH_AHASH: Final[int]
317
+ PH_HASH_DHASH: Final[int]
318
+ PH_HASH_FLAGS_COUNT: Final[int]
319
+ PH_HASH_FORCE_INT32_: Final[int]
320
+ PH_HASH_PHASH: Final[int]
321
+ PH_HASH_WHASH: Final[int]
322
+ PH_RADIAL_PCC_THRESHOLD: Final[float]
323
+ PH_SUCCESS: Final[int]
324
+ PH_VECTOR16_SCALE: Final[int]
325
+ PH_WHASH_FAST: Final[int]
326
+ PH_WHASH_FORCE_INT32_: Final[int]
327
+ PH_WHASH_FULL: Final[int]
328
+ _libphash_continue: ph_batch_continue_fn
329
+ _libphash_on_progress: ph_batch_progress_fn
330
+ _libphash_progress: ph_batch_progress_fn
331
+ _libphash_should_continue: ph_batch_continue_fn
332
+ def ph_algorithm_from_name(
333
+ self,
334
+ name: bytes | char_ptr | uint8_t_ptr | void_ptr,
335
+ out_algo: ph_algorithm_t_ptr | void_ptr,
336
+ /,
337
+ ) -> int: ...
338
+ def ph_algorithm_name(self, algo: int, /) -> char_ptr: ...
339
+ def ph_batch_options_init(
340
+ self, options: ph_batch_options_t_ptr | void_ptr, /
341
+ ) -> int: ...
342
+ def ph_can_use_jpeg(self) -> int: ...
343
+ def ph_can_use_png(self) -> int: ...
344
+ def ph_can_use_webp(self) -> int: ...
345
+ def ph_compute_ahash(
346
+ self, ctx: ph_context_t_ptr | void_ptr, out_hash: uint64_t_ptr | void_ptr, /
347
+ ) -> int: ...
348
+ def ph_compute_bmh(
349
+ self,
350
+ ctx: ph_context_t_ptr | void_ptr,
351
+ out_digest: ph_digest_t_ptr | void_ptr,
352
+ /,
353
+ ) -> int: ...
354
+ def ph_compute_color_hash(
355
+ self,
356
+ ctx: ph_context_t_ptr | void_ptr,
357
+ out_digest: ph_digest_t_ptr | void_ptr,
358
+ /,
359
+ ) -> int: ...
360
+ def ph_compute_color_moments_hash(
361
+ self,
362
+ ctx: ph_context_t_ptr | void_ptr,
363
+ out_digest: ph_digest_t_ptr | void_ptr,
364
+ /,
365
+ ) -> int: ...
366
+ def ph_compute_dhash(
367
+ self, ctx: ph_context_t_ptr | void_ptr, out_hash: uint64_t_ptr | void_ptr, /
368
+ ) -> int: ...
369
+ def ph_compute_digest(
370
+ self,
371
+ ctx: ph_context_t_ptr | void_ptr,
372
+ algo: int,
373
+ out_digest: ph_digest_t_ptr | void_ptr,
374
+ /,
375
+ ) -> int: ...
376
+ def ph_compute_mhash(
377
+ self,
378
+ ctx: ph_context_t_ptr | void_ptr,
379
+ out_digest: ph_digest_t_ptr | void_ptr,
380
+ /,
381
+ ) -> int: ...
382
+ def ph_compute_multi(
383
+ self,
384
+ ctx: ph_context_t_ptr | void_ptr,
385
+ flags: int,
386
+ out: uint64_t_ptr | void_ptr,
387
+ /,
388
+ ) -> int: ...
389
+ def ph_compute_phash(
390
+ self, ctx: ph_context_t_ptr | void_ptr, out_hash: uint64_t_ptr | void_ptr, /
391
+ ) -> int: ...
392
+ def ph_compute_radial_hash(
393
+ self,
394
+ ctx: ph_context_t_ptr | void_ptr,
395
+ out_digest: ph_digest_t_ptr | void_ptr,
396
+ /,
397
+ ) -> int: ...
398
+ def ph_compute_whash(
399
+ self, ctx: ph_context_t_ptr | void_ptr, out_hash: uint64_t_ptr | void_ptr, /
400
+ ) -> int: ...
401
+ def ph_context_get_dimensions(
402
+ self,
403
+ ctx: ph_context_t_ptr | void_ptr,
404
+ width: int_ptr | void_ptr,
405
+ height: int_ptr | void_ptr,
406
+ channels: int_ptr | void_ptr,
407
+ /,
408
+ ) -> None: ...
409
+ def ph_context_get_gray_weights(
410
+ self,
411
+ ctx: ph_context_t_ptr | void_ptr,
412
+ r: int_ptr | void_ptr,
413
+ g: int_ptr | void_ptr,
414
+ b: int_ptr | void_ptr,
415
+ /,
416
+ ) -> int: ...
417
+ def ph_context_set_alpha_mode(
418
+ self, ctx: ph_context_t_ptr | void_ptr, mode: int, /
419
+ ) -> int: ...
420
+ def ph_context_set_auto_orient(
421
+ self, ctx: ph_context_t_ptr | void_ptr, enable: int, /
422
+ ) -> int: ...
423
+ def ph_context_set_block_params(
424
+ self, ctx: ph_context_t_ptr | void_ptr, block_size: int, /
425
+ ) -> int: ...
426
+ def ph_context_set_decode_scale(
427
+ self, ctx: ph_context_t_ptr | void_ptr, scale: int, /
428
+ ) -> int: ...
429
+ def ph_context_set_gamma(
430
+ self, ctx: ph_context_t_ptr | void_ptr, gamma: float, /
431
+ ) -> int: ...
432
+ def ph_context_set_gray_weights(
433
+ self, ctx: ph_context_t_ptr | void_ptr, r: int, g: int, b: int, /
434
+ ) -> int: ...
435
+ def ph_context_set_load_grayscale(
436
+ self, ctx: ph_context_t_ptr | void_ptr, enable: int, /
437
+ ) -> int: ...
438
+ def ph_context_set_max_pixels(
439
+ self, ctx: ph_context_t_ptr | void_ptr, max_pixels: int, /
440
+ ) -> int: ...
441
+ def ph_context_set_mhash_params(
442
+ self, ctx: ph_context_t_ptr | void_ptr, alpha: float, level: float, size: int, /
443
+ ) -> int: ...
444
+ def ph_context_set_phash_params(
445
+ self, ctx: ph_context_t_ptr | void_ptr, dct_size: int, reduction_size: int, /
446
+ ) -> int: ...
447
+ def ph_context_set_radial_params(
448
+ self,
449
+ ctx: ph_context_t_ptr | void_ptr,
450
+ projections: int,
451
+ samples: int,
452
+ sigma: float,
453
+ /,
454
+ ) -> int: ...
455
+ def ph_context_set_whash_mode(
456
+ self, ctx: ph_context_t_ptr | void_ptr, mode: int, /
457
+ ) -> int: ...
458
+ def ph_context_set_whash_remove_max_haar_ll(
459
+ self, ctx: ph_context_t_ptr | void_ptr, enable: int, /
460
+ ) -> int: ...
461
+ def ph_create(self, out_ctx: ph_context_t_ptr_ptr | void_ptr, /) -> int: ...
462
+ def ph_digest_from_hex(
463
+ self,
464
+ text: bytes | char_ptr | uint8_t_ptr | void_ptr,
465
+ out: ph_digest_t_ptr | void_ptr,
466
+ /,
467
+ ) -> int: ...
468
+ def ph_digest_info(
469
+ self,
470
+ ctx: ph_context_t_ptr | void_ptr,
471
+ algo: int,
472
+ out_size: size_t_ptr | void_ptr,
473
+ out_kind: ph_digest_kind_t_ptr | void_ptr,
474
+ /,
475
+ ) -> int: ...
476
+ def ph_digest_to_hex(
477
+ self,
478
+ d: ph_digest_t_ptr | void_ptr,
479
+ out: bytes | char_ptr | uint8_t_ptr | void_ptr,
480
+ out_size: int,
481
+ /,
482
+ ) -> int: ...
483
+ def ph_free(self, ctx: ph_context_t_ptr | void_ptr, /) -> None: ...
484
+ def ph_get_build_info(self) -> char_ptr: ...
485
+ def ph_get_error_string(self, err: int, /) -> char_ptr: ...
486
+ def ph_get_last_error_message(
487
+ self, ctx: ph_context_t_ptr | void_ptr, /
488
+ ) -> char_ptr: ...
489
+ def ph_hamming_distance(self, hash1: int, hash2: int, /) -> int: ...
490
+ def ph_hamming_distance_digest(
491
+ self, a: ph_digest_t_ptr | void_ptr, b: ph_digest_t_ptr | void_ptr, /
492
+ ) -> int: ...
493
+ def ph_hash_buffers(
494
+ self,
495
+ items: ph_batch_buffer_item_t_ptr | void_ptr,
496
+ n: int,
497
+ flags: int,
498
+ threads: int,
499
+ /,
500
+ ) -> int: ...
501
+ def ph_hash_buffers_ex(
502
+ self,
503
+ items: ph_batch_buffer_item_t_ptr | void_ptr,
504
+ n: int,
505
+ flags: int,
506
+ options: ph_batch_options_t_ptr | void_ptr,
507
+ /,
508
+ ) -> int: ...
509
+ def ph_hash_files(
510
+ self, items: ph_batch_item_t_ptr | void_ptr, n: int, flags: int, threads: int, /
511
+ ) -> int: ...
512
+ def ph_hash_files_ex(
513
+ self,
514
+ items: ph_batch_item_t_ptr | void_ptr,
515
+ n: int,
516
+ flags: int,
517
+ options: ph_batch_options_t_ptr | void_ptr,
518
+ /,
519
+ ) -> int: ...
520
+ def ph_hash_from_hex(
521
+ self,
522
+ hex: bytes | char_ptr | uint8_t_ptr | void_ptr,
523
+ out: uint64_t_ptr | void_ptr,
524
+ /,
525
+ ) -> int: ...
526
+ def ph_hash_to_hex(
527
+ self,
528
+ hash: int,
529
+ out: bytes | char_ptr | uint8_t_ptr | void_ptr,
530
+ out_size: int,
531
+ /,
532
+ ) -> int: ...
533
+ def ph_histogram_intersection(
534
+ self,
535
+ a: ph_digest_t_ptr | void_ptr,
536
+ b: ph_digest_t_ptr | void_ptr,
537
+ out_similarity: double_ptr | void_ptr,
538
+ /,
539
+ ) -> int: ...
540
+ def ph_is_loaded(self, ctx: ph_context_t_ptr | void_ptr, /) -> int: ...
541
+ def ph_l2_distance(
542
+ self, a: ph_digest_t_ptr | void_ptr, b: ph_digest_t_ptr | void_ptr, /
543
+ ) -> float: ...
544
+ def ph_load_from_file(
545
+ self,
546
+ ctx: ph_context_t_ptr | void_ptr,
547
+ filepath: bytes | char_ptr | uint8_t_ptr | void_ptr,
548
+ /,
549
+ ) -> int: ...
550
+ def ph_load_from_memory(
551
+ self,
552
+ ctx: ph_context_t_ptr | void_ptr,
553
+ buffer: bytes | char_ptr | uint8_t_ptr | void_ptr,
554
+ length: int,
555
+ /,
556
+ ) -> int: ...
557
+ def ph_load_from_pixels(
558
+ self,
559
+ ctx: ph_context_t_ptr | void_ptr,
560
+ pixels: bytes | char_ptr | uint8_t_ptr | void_ptr,
561
+ width: int,
562
+ height: int,
563
+ channels: int,
564
+ stride: int,
565
+ /,
566
+ ) -> int: ...
567
+ def ph_radial_similarity(
568
+ self,
569
+ a: ph_digest_t_ptr | void_ptr,
570
+ b: ph_digest_t_ptr | void_ptr,
571
+ out_pcc: double_ptr | void_ptr,
572
+ /,
573
+ ) -> int: ...
574
+ def ph_similarity(self, a: int, b: int, /) -> float: ...
575
+ def ph_similarity_digest(
576
+ self, a: ph_digest_t_ptr | void_ptr, b: ph_digest_t_ptr | void_ptr, /
577
+ ) -> float: ...
578
+ def ph_version(self) -> char_ptr: ...
579
+ def ph_version_number(self) -> int: ...
580
+
581
+ class _FFI:
582
+ NULL: void_ptr
583
+ error: type[Exception]
584
+ @overload
585
+ def new(
586
+ self, cdecl: Literal["char *", "const char *"], init: bytes = ..., /
587
+ ) -> char_ptr: ...
588
+ @overload
589
+ def new(
590
+ self, cdecl: Literal["char[]", "const char[]"], init: int | bytes = ..., /
591
+ ) -> char_array: ...
592
+ @overload
593
+ def new(
594
+ self, cdecl: Literal["double *", "const double *"], init: float = ..., /
595
+ ) -> double_ptr: ...
596
+ @overload
597
+ def new(
598
+ self,
599
+ cdecl: Literal["double[]", "const double[]"],
600
+ init: int | Sequence[float] = ...,
601
+ /,
602
+ ) -> double_array: ...
603
+ @overload
604
+ def new(
605
+ self, cdecl: Literal["int *", "const int *"], init: int = ..., /
606
+ ) -> int_ptr: ...
607
+ @overload
608
+ def new(
609
+ self, cdecl: Literal["int[]", "const int[]"], init: int | Sequence[int] = ..., /
610
+ ) -> int_array: ...
611
+ @overload
612
+ def new(
613
+ self,
614
+ cdecl: Literal["ph_algorithm_t *", "const ph_algorithm_t *"],
615
+ init: int = ...,
616
+ /,
617
+ ) -> ph_algorithm_t_ptr: ...
618
+ @overload
619
+ def new(
620
+ self,
621
+ cdecl: Literal["ph_algorithm_t[]", "const ph_algorithm_t[]"],
622
+ init: int | Sequence[int] = ...,
623
+ /,
624
+ ) -> ph_algorithm_t_array: ...
625
+ @overload
626
+ def new(
627
+ self,
628
+ cdecl: Literal["ph_batch_buffer_item_t *", "const ph_batch_buffer_item_t *"],
629
+ init: Mapping[str, object] | Sequence[object] = ...,
630
+ /,
631
+ ) -> ph_batch_buffer_item_t_ptr: ...
632
+ @overload
633
+ def new(
634
+ self,
635
+ cdecl: Literal["ph_batch_buffer_item_t[]", "const ph_batch_buffer_item_t[]"],
636
+ init: int | Sequence[ph_batch_buffer_item_t] = ...,
637
+ /,
638
+ ) -> ph_batch_buffer_item_t_array: ...
639
+ @overload
640
+ def new(
641
+ self,
642
+ cdecl: Literal["ph_batch_item_t *", "const ph_batch_item_t *"],
643
+ init: Mapping[str, object] | Sequence[object] = ...,
644
+ /,
645
+ ) -> ph_batch_item_t_ptr: ...
646
+ @overload
647
+ def new(
648
+ self,
649
+ cdecl: Literal["ph_batch_item_t[]", "const ph_batch_item_t[]"],
650
+ init: int | Sequence[ph_batch_item_t] = ...,
651
+ /,
652
+ ) -> ph_batch_item_t_array: ...
653
+ @overload
654
+ def new(
655
+ self,
656
+ cdecl: Literal["ph_batch_options_t *", "const ph_batch_options_t *"],
657
+ init: Mapping[str, object] | Sequence[object] = ...,
658
+ /,
659
+ ) -> ph_batch_options_t_ptr: ...
660
+ @overload
661
+ def new(
662
+ self,
663
+ cdecl: Literal["ph_batch_options_t[]", "const ph_batch_options_t[]"],
664
+ init: int | Sequence[ph_batch_options_t] = ...,
665
+ /,
666
+ ) -> ph_batch_options_t_array: ...
667
+ @overload
668
+ def new(
669
+ self,
670
+ cdecl: Literal["ph_context_t **"],
671
+ init: ph_context_t_ptr | void_ptr = ...,
672
+ /,
673
+ ) -> ph_context_t_ptr_ptr: ...
674
+ @overload
675
+ def new(
676
+ self,
677
+ cdecl: Literal["ph_context_t *[]"],
678
+ init: int | Sequence[ph_context_t_ptr] = ...,
679
+ /,
680
+ ) -> ph_context_t_ptr_array: ...
681
+ @overload
682
+ def new(
683
+ self,
684
+ cdecl: Literal["ph_digest_kind_t *", "const ph_digest_kind_t *"],
685
+ init: int = ...,
686
+ /,
687
+ ) -> ph_digest_kind_t_ptr: ...
688
+ @overload
689
+ def new(
690
+ self,
691
+ cdecl: Literal["ph_digest_kind_t[]", "const ph_digest_kind_t[]"],
692
+ init: int | Sequence[int] = ...,
693
+ /,
694
+ ) -> ph_digest_kind_t_array: ...
695
+ @overload
696
+ def new(
697
+ self,
698
+ cdecl: Literal["ph_digest_t *", "const ph_digest_t *"],
699
+ init: Mapping[str, object] | Sequence[object] = ...,
700
+ /,
701
+ ) -> ph_digest_t_ptr: ...
702
+ @overload
703
+ def new(
704
+ self,
705
+ cdecl: Literal["ph_digest_t[]", "const ph_digest_t[]"],
706
+ init: int | Sequence[ph_digest_t] = ...,
707
+ /,
708
+ ) -> ph_digest_t_array: ...
709
+ @overload
710
+ def new(
711
+ self, cdecl: Literal["size_t *", "const size_t *"], init: int = ..., /
712
+ ) -> size_t_ptr: ...
713
+ @overload
714
+ def new(
715
+ self,
716
+ cdecl: Literal["size_t[]", "const size_t[]"],
717
+ init: int | Sequence[int] = ...,
718
+ /,
719
+ ) -> size_t_array: ...
720
+ @overload
721
+ def new(
722
+ self, cdecl: Literal["uint64_t *", "const uint64_t *"], init: int = ..., /
723
+ ) -> uint64_t_ptr: ...
724
+ @overload
725
+ def new(
726
+ self,
727
+ cdecl: Literal["uint64_t[]", "const uint64_t[]"],
728
+ init: int | Sequence[int] = ...,
729
+ /,
730
+ ) -> uint64_t_array: ...
731
+ @overload
732
+ def new(
733
+ self, cdecl: Literal["uint8_t *", "const uint8_t *"], init: int = ..., /
734
+ ) -> uint8_t_ptr: ...
735
+ @overload
736
+ def new(
737
+ self,
738
+ cdecl: Literal["uint8_t[]", "const uint8_t[]"],
739
+ init: int | Sequence[int] = ...,
740
+ /,
741
+ ) -> uint8_t_array: ...
742
+ @overload
743
+ def cast(
744
+ self, cdecl: Literal["char *", "const char *"], value: int | Pointer, /
745
+ ) -> char_ptr: ...
746
+ @overload
747
+ def cast(
748
+ self, cdecl: Literal["double *", "const double *"], value: int | Pointer, /
749
+ ) -> double_ptr: ...
750
+ @overload
751
+ def cast(
752
+ self, cdecl: Literal["int *", "const int *"], value: int | Pointer, /
753
+ ) -> int_ptr: ...
754
+ @overload
755
+ def cast(
756
+ self,
757
+ cdecl: Literal["ph_algorithm_t *", "const ph_algorithm_t *"],
758
+ value: int | Pointer,
759
+ /,
760
+ ) -> ph_algorithm_t_ptr: ...
761
+ @overload
762
+ def cast(
763
+ self,
764
+ cdecl: Literal["ph_batch_buffer_item_t *", "const ph_batch_buffer_item_t *"],
765
+ value: int | Pointer,
766
+ /,
767
+ ) -> ph_batch_buffer_item_t_ptr: ...
768
+ @overload
769
+ def cast(
770
+ self,
771
+ cdecl: Literal["ph_batch_item_t *", "const ph_batch_item_t *"],
772
+ value: int | Pointer,
773
+ /,
774
+ ) -> ph_batch_item_t_ptr: ...
775
+ @overload
776
+ def cast(
777
+ self,
778
+ cdecl: Literal["ph_batch_options_t *", "const ph_batch_options_t *"],
779
+ value: int | Pointer,
780
+ /,
781
+ ) -> ph_batch_options_t_ptr: ...
782
+ @overload
783
+ def cast(
784
+ self, cdecl: Literal["ph_context_t **"], value: int | Pointer, /
785
+ ) -> ph_context_t_ptr_ptr: ...
786
+ @overload
787
+ def cast(
788
+ self,
789
+ cdecl: Literal["ph_digest_kind_t *", "const ph_digest_kind_t *"],
790
+ value: int | Pointer,
791
+ /,
792
+ ) -> ph_digest_kind_t_ptr: ...
793
+ @overload
794
+ def cast(
795
+ self,
796
+ cdecl: Literal["ph_digest_t *", "const ph_digest_t *"],
797
+ value: int | Pointer,
798
+ /,
799
+ ) -> ph_digest_t_ptr: ...
800
+ @overload
801
+ def cast(
802
+ self, cdecl: Literal["size_t *", "const size_t *"], value: int | Pointer, /
803
+ ) -> size_t_ptr: ...
804
+ @overload
805
+ def cast(
806
+ self, cdecl: Literal["uint64_t *", "const uint64_t *"], value: int | Pointer, /
807
+ ) -> uint64_t_ptr: ...
808
+ @overload
809
+ def cast(
810
+ self, cdecl: Literal["uint8_t *", "const uint8_t *"], value: int | Pointer, /
811
+ ) -> uint8_t_ptr: ...
812
+ @overload
813
+ def cast(self, cdecl: Literal["void *"], value: int | Pointer, /) -> void_ptr: ...
814
+ @overload
815
+ def from_buffer(
816
+ self, python_buffer: Buffer, /, require_writable: bool = ...
817
+ ) -> char_array: ...
818
+ @overload
819
+ def from_buffer(
820
+ self,
821
+ cdecl: Literal["char[]", "const char[]"],
822
+ python_buffer: Buffer,
823
+ /,
824
+ require_writable: bool = ...,
825
+ ) -> char_array: ...
826
+ @overload
827
+ def from_buffer(
828
+ self,
829
+ cdecl: Literal["double[]", "const double[]"],
830
+ python_buffer: Buffer,
831
+ /,
832
+ require_writable: bool = ...,
833
+ ) -> double_array: ...
834
+ @overload
835
+ def from_buffer(
836
+ self,
837
+ cdecl: Literal["int[]", "const int[]"],
838
+ python_buffer: Buffer,
839
+ /,
840
+ require_writable: bool = ...,
841
+ ) -> int_array: ...
842
+ @overload
843
+ def from_buffer(
844
+ self,
845
+ cdecl: Literal["ph_algorithm_t[]", "const ph_algorithm_t[]"],
846
+ python_buffer: Buffer,
847
+ /,
848
+ require_writable: bool = ...,
849
+ ) -> ph_algorithm_t_array: ...
850
+ @overload
851
+ def from_buffer(
852
+ self,
853
+ cdecl: Literal["ph_batch_buffer_item_t[]", "const ph_batch_buffer_item_t[]"],
854
+ python_buffer: Buffer,
855
+ /,
856
+ require_writable: bool = ...,
857
+ ) -> ph_batch_buffer_item_t_array: ...
858
+ @overload
859
+ def from_buffer(
860
+ self,
861
+ cdecl: Literal["ph_batch_item_t[]", "const ph_batch_item_t[]"],
862
+ python_buffer: Buffer,
863
+ /,
864
+ require_writable: bool = ...,
865
+ ) -> ph_batch_item_t_array: ...
866
+ @overload
867
+ def from_buffer(
868
+ self,
869
+ cdecl: Literal["ph_batch_options_t[]", "const ph_batch_options_t[]"],
870
+ python_buffer: Buffer,
871
+ /,
872
+ require_writable: bool = ...,
873
+ ) -> ph_batch_options_t_array: ...
874
+ @overload
875
+ def from_buffer(
876
+ self,
877
+ cdecl: Literal["ph_context_t *[]"],
878
+ python_buffer: Buffer,
879
+ /,
880
+ require_writable: bool = ...,
881
+ ) -> ph_context_t_ptr_array: ...
882
+ @overload
883
+ def from_buffer(
884
+ self,
885
+ cdecl: Literal["ph_digest_kind_t[]", "const ph_digest_kind_t[]"],
886
+ python_buffer: Buffer,
887
+ /,
888
+ require_writable: bool = ...,
889
+ ) -> ph_digest_kind_t_array: ...
890
+ @overload
891
+ def from_buffer(
892
+ self,
893
+ cdecl: Literal["ph_digest_t[]", "const ph_digest_t[]"],
894
+ python_buffer: Buffer,
895
+ /,
896
+ require_writable: bool = ...,
897
+ ) -> ph_digest_t_array: ...
898
+ @overload
899
+ def from_buffer(
900
+ self,
901
+ cdecl: Literal["size_t[]", "const size_t[]"],
902
+ python_buffer: Buffer,
903
+ /,
904
+ require_writable: bool = ...,
905
+ ) -> size_t_array: ...
906
+ @overload
907
+ def from_buffer(
908
+ self,
909
+ cdecl: Literal["uint64_t[]", "const uint64_t[]"],
910
+ python_buffer: Buffer,
911
+ /,
912
+ require_writable: bool = ...,
913
+ ) -> uint64_t_array: ...
914
+ @overload
915
+ def from_buffer(
916
+ self,
917
+ cdecl: Literal["uint8_t[]", "const uint8_t[]"],
918
+ python_buffer: Buffer,
919
+ /,
920
+ require_writable: bool = ...,
921
+ ) -> uint8_t_array: ...
922
+ def string(self, cdata: char_ptr | uint8_t_ptr, maxlen: int = ...) -> bytes: ...
923
+ def buffer(self, cdata: Pointer, size: int = ...) -> CBuffer: ...
924
+ def memmove(
925
+ self, dest: Pointer | Buffer, src: Pointer | Buffer, n: int
926
+ ) -> None: ...
927
+ def gc(
928
+ self, cdata: _P, destructor: Callable[[_P], object] | None, size: int = ...
929
+ ) -> _P: ...
930
+ def release(self, cdata: Pointer, /) -> None: ...
931
+ def new_handle(self, x: object, /) -> void_ptr: ...
932
+ def from_handle(self, x: void_ptr, /) -> object: ...
933
+ def def_extern(
934
+ self,
935
+ name: str = ...,
936
+ error: object = ...,
937
+ onerror: Callable[..., object] | None = ...,
938
+ ) -> Callable[[_F], _F]: ...
939
+ def typeof(self, cdecl: str | CData | Callable[..., object], /) -> CType: ...
940
+ def sizeof(self, cdecl: str | CData, /) -> int: ...
941
+ def list_types(self) -> tuple[list[str], list[str], list[str]]: ...
942
+
943
+ ffi: _FFI
944
+ lib: _Lib