-
Notifications
You must be signed in to change notification settings - Fork 326
Expand file tree
/
Copy patharray.pyi
More file actions
491 lines (475 loc) · 26.6 KB
/
Copy patharray.pyi
File metadata and controls
491 lines (475 loc) · 26.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
"""Stub file for the array module.
This is only needed so that the static type checker can find the types for the extension
methods we have written in Rust. The file will never be used by Python at runtime.
"""
from __future__ import annotations
from collections.abc import Callable, Iterable, Iterator, MutableSequence
from typing import Any, ClassVar, Literal, SupportsFloat, SupportsInt, overload
from fable_library.option import Option
from fable_library.protocols import (
IComparer_1,
IEnumerable_1,
IEnumerator,
IEqualityComparer_1,
IGenericAdder,
IGenericAverager,
)
from fable_library.util import UNIT, Unit
from . import FSharpRef, Int32
# Type alias for inputs that can be iterated - supports both Python Iterable and F# IEnumerable
type Elements[T] = Iterable[T] | IEnumerable_1[T]
ArrayType = Literal[
"Int8",
"UInt8",
"Int16",
"UInt16",
"Int32",
"UInt32",
"SupportsInt",
"USupportsInt",
"Int64",
"UInt64",
"Float32",
"Float64",
"String",
"Bool",
"Generic",
]
class FSharpArray[T](MutableSequence[T]):
# Special methods - accepts both Python Iterable and F# IEnumerable
def __init__(self, elements: Elements[T] | None = None) -> None: ...
def __bytes__(self) -> bytes: ...
def __delitem__(self, idx: int | slice) -> None: ...
@overload
def __getitem__(self, idx: int) -> T: ...
@overload
def __getitem__(self, idx: slice) -> FSharpArray[T]: ...
def __iter__(self) -> Iterator[T]: ...
def __len__(self) -> int: ...
def __setitem__(self, idx: int | slice, value: Any) -> None: ...
# F# interop property
@property
def length(self) -> Int32: ...
# IEnumerable implementation (for .NET compatibility)
def GetEnumerator(self, __unit: Unit = UNIT) -> IEnumerator[T]: ...
# Static methods
@staticmethod
def create(count: SupportsInt, value: T) -> FSharpArray[T]: ...
@staticmethod
def initialize(
count: SupportsInt, initializer: Callable[[Int32], T], cons: Any | None = None
) -> FSharpArray[T]: ...
# Instance methods (alphabetically sorted)
def add_in_place(self, value: T) -> None: ...
def add_range_in_place(self, values: Iterable[T]) -> None: ...
def append(self, array2: FSharpArray[T], cons: FSharpCons[T] | None = None) -> FSharpArray[T]: ... # type: ignore[override] # ty: ignore[invalid-method-override]
def average(self, averager: IGenericAverager[T]) -> T: ...
def average_by[U](self, projection: Callable[[T], U], averager: IGenericAverager[U]) -> U: ...
def choose[U](self, chooser: Callable[[T], Option[U]], cons: FSharpCons[U] | None = None) -> FSharpArray[U]: ...
def chunk_by_size(self, size: SupportsInt) -> list[FSharpArray[T]]: ...
def collect[U](self, mapping: Callable[[T], FSharpArray[U]], cons: Any | None = None) -> FSharpArray[U]: ...
def compare_to(self, comparer: Callable[[T, T], SupportsInt], other: FSharpArray[T]) -> Int32: ...
def compare_with(self, comparer: Callable[[T, T], SupportsInt], other: FSharpArray[T]) -> Int32: ...
def contains(self, value: T, eq: IEqualityComparer_1[T] | None = None) -> bool: ...
def copy(self) -> FSharpArray[T]: ...
def copy_to(
self, source_index: SupportsInt, target: FSharpArray[T], target_index: SupportsInt, count: SupportsInt
) -> None: ...
def equals_with(self, equals: Callable[[T, T], bool], other: FSharpArray[T] | None) -> bool: ...
def exists(self, predicate: Callable[[T], bool]) -> bool: ...
def exists_offset(self, predicate: Callable[[T], bool], index: SupportsInt) -> bool: ...
def fill(self, target_index: SupportsInt, count: SupportsInt, value: T) -> FSharpArray[T]: ...
def filter(self, predicate: Callable[[T], bool]) -> FSharpArray[T]: ...
def find(self, predicate: Callable[[T], bool]) -> T: ...
def find_back(self, predicate: Callable[[T], bool]) -> T: ...
def find_index(self, predicate: Callable[[T], bool]) -> Int32: ...
def find_index_back(self, predicate: Callable[[T], bool]) -> Int32: ...
def find_last_index(self, predicate: Callable[[T], bool]) -> Int32: ...
def fold[S](self, folder: Callable[[S, T], S], state: S) -> S: ...
def fold_back[S](self, folder: Callable[[T, S], S], state: S) -> S: ...
def fold_back2[T1, T2, S](self, folder: Callable[[T1, T2, S], S], array2: FSharpArray[T2], state: S) -> S: ...
def fold_back_indexed[S](self, folder: Callable[[Int32, T, S], S], state: S) -> S: ...
def fold_indexed(
self, folder: Callable[[Int32, Any, Any], Any], state: Any
) -> Any: ... # Use Any for fold_indexed function types
def for_all(self, predicate: Callable[[T], bool]) -> bool: ...
def get_sub_array(
self, start_index: SupportsInt, count: SupportsInt, cons: FSharpCons[T] | None = None
) -> FSharpArray[T]: ...
def head(self) -> T: ...
def index_of(
self,
item: T,
start: SupportsInt | None = None,
count: SupportsInt | None = None,
eq: IEqualityComparer_1[T] | None = None,
) -> SupportsInt: ...
def indexed(self) -> FSharpArray[tuple[SupportsInt, T]]: ...
def insert(self, index: SupportsInt, value: Any) -> None: ...
def insert_at(self, index: SupportsInt, value: T, cons: Any | None = None) -> None: ...
def insert_many_at(self, index: SupportsInt, values: FSharpArray[T], cons: Any | None = None) -> FSharpArray[T]: ...
def insert_range_in_place(self, index: SupportsInt, values: Iterable[T]) -> None: ...
def item(self, index: SupportsInt) -> T: ...
def iterate(self, action: Callable[[Any], None]) -> None: ...
def iterate_indexed(self, action: Callable[[Int32, Any], None]) -> None: ...
def last(self) -> T: ...
def map[U](self, f: Callable[[T], U], cons: Any | None = None) -> FSharpArray[U]: ...
def map2[T1, T2, U](
self, f: Callable[[T1, T2], U], array1: FSharpArray[T1], array2: FSharpArray[T2], cons: Any | None = None
) -> FSharpArray[U]: ...
def map3[T1, T2, T3, U](
self,
f: Callable[[T1, T2, T3], U],
array1: FSharpArray[T1],
array2: FSharpArray[T2],
array3: FSharpArray[T3],
cons: Any | None = None,
) -> FSharpArray[U]: ...
def map_fold[S, R](
self,
mapping: Callable[[S, T], tuple[R, S]],
state: S,
cons: Any | None = None,
) -> tuple[FSharpArray[R], S]: ...
def map_fold_back[S, R](
self,
mapping: Callable[[T, S], tuple[R, S]],
state: S,
cons: Any | None = None,
) -> tuple[FSharpArray[R], S]: ...
def map_indexed[U](self, f: Callable[[Int32, T], U], cons: Any | None = None) -> FSharpArray[U]: ...
def map_indexed2[T1, T2, U](
self,
f: Callable[[Int32, T1, T2], U],
array1: FSharpArray[T1],
array2: FSharpArray[T2],
cons: Any | None = None,
) -> FSharpArray[U]: ...
def map_indexed3[T1, T2, T3, U](
self,
f: Callable[[Int32, T1, T2, T3], U],
array1: FSharpArray[T1],
array2: FSharpArray[T2],
array3: FSharpArray[T3],
cons: Any | None = None,
) -> FSharpArray[U]: ...
def max(self, comparer: IComparer_1[T]) -> T: ...
def max_by[U](self, projection: Callable[[T], U], comparer: IComparer_1[U]) -> T: ...
def min(self, comparer: IComparer_1[T]) -> T: ...
def min_by[U](self, projection: Callable[[T], U], comparer: IComparer_1[U]) -> T: ...
def pairwise(self) -> FSharpArray[tuple[T, T]]: ...
def partition(
self, f: Callable[[T], bool], cons: FSharpCons[T] | None = None
) -> tuple[FSharpArray[T], FSharpArray[T]]: ...
def permute(self, f: Callable[[Int32], SupportsInt], array: FSharpArray[T]) -> FSharpArray[T]: ...
def pick[U](self, chooser: Callable[[T], Option[U]]) -> U: ...
def random_choice(self) -> T: ...
def random_choice_by(self, randomizer: Callable[[], SupportsFloat]) -> T: ...
def random_choice_with(self, random: Any) -> T: ...
def random_choices(self, count: int) -> FSharpArray[T]: ...
def random_choices_by(self, randomizer: Callable[[], SupportsFloat], count: int) -> FSharpArray[T]: ...
def random_choices_with(self, random: Any, count: int) -> FSharpArray[T]: ...
def random_sample(self, count: int) -> FSharpArray[T]: ...
def random_sample_by(self, randomizer: Callable[[], SupportsFloat], count: int) -> FSharpArray[T]: ...
def random_sample_with(self, random: Any, count: int) -> FSharpArray[T]: ...
def random_shuffle(self) -> FSharpArray[T]: ...
def random_shuffle_by(self, randomizer: Callable[[], SupportsFloat]) -> FSharpArray[T]: ...
def random_shuffle_in_place(self) -> None: ...
def random_shuffle_in_place_by(self, randomizer: Callable[[], SupportsFloat]) -> None: ...
def random_shuffle_in_place_with(self, random: Any) -> None: ...
def random_shuffle_with(self, random: Any) -> FSharpArray[T]: ...
def reduce(self, folder: Callable[[Any, Any], Any], state: Any) -> Any: ...
def reduce_back(self, reduction: Callable[[Any, Any], Any], state: Any) -> Any: ...
def remove_all_in_place(self, predicate: Callable[[T], bool]) -> SupportsInt: ...
def remove_at(self, index: SupportsInt, cons: Any | None = None) -> FSharpArray[T]: ...
def remove_in_place(self, item: T) -> bool: ...
def resize(
self, new_size: SupportsInt, zero: T | None = None, cons: FSharpCons[T] | None = None
) -> FSharpArray[T]: ...
def reverse(self) -> FSharpArray[T]: ... # type: ignore # Override returns new array instead of None
def scan[S](self, folder: Callable[[S, T], S], state: S, cons: Any | None = None) -> FSharpArray[S]: ...
def scan_back[S](self, folder: Callable[[T, S], S], state: S, cons: Any | None = None) -> FSharpArray[S]: ...
def set_slice(self, target: FSharpArray[T], lower: SupportsInt | None, upper: SupportsInt | None) -> None: ...
def singleton(self, value: T, cons: Any | None = None) -> FSharpArray[T]: ...
def skip(self, count: SupportsInt, cons: FSharpCons[T] | None = None) -> FSharpArray[T]: ...
def skip_while(self, predicate: Callable[[T], bool], cons: FSharpCons[T] | None = None) -> FSharpArray[T]: ...
def sort(self, comparer: IComparer_1[T]) -> FSharpArray[T]: ...
def sort_by(self, projection: Callable[[T], Any], comparer: IComparer_1[T] | None = None) -> FSharpArray[T]: ...
def sort_in_place(self, comparer: IComparer_1[T]) -> None: ...
def sort_in_place_by[U](self, projection: Callable[[T], U], comparer: IComparer_1[U]) -> None: ...
def sort_in_place_with(self, comparer: Callable[[Any, Any], SupportsInt]) -> None: ...
def sort_with(self, comparer: Callable[[T, T], SupportsInt]) -> FSharpArray[T]: ...
def split_into(self, chunks: int) -> FSharpArray[FSharpArray[T]]: ...
def sum(self, adder: IGenericAdder[T]) -> T: ...
def sum_by[U](self, projection: Callable[[T], U], adder: IGenericAdder[U]) -> U: ...
def tail(self, cons: FSharpCons[T] | None = None) -> FSharpArray[T]: ...
def take(self, count: SupportsInt, cons: FSharpCons[T] | None = None) -> FSharpArray[T]: ...
def take_while(self, predicate: Callable[[T], bool], cons: FSharpCons[T] | None = None) -> FSharpArray[T]: ...
def transpose(self, cons: FSharpCons[T] | None = None) -> FSharpArray[FSharpArray[T]]: ...
def truncate(self, count: SupportsInt) -> FSharpArray[T]: ...
def try_find(self, predicate: Callable[[T], bool]) -> T | None: ...
def try_find_back(self, predicate: Callable[[Any], bool]) -> Any: ...
def try_find_index(self, predicate: Callable[[Any], bool]) -> SupportsInt | None: ...
def try_find_index_back(self, predicate: Callable[[Any], bool]) -> SupportsInt: ...
def try_head(self) -> T | None: ...
def try_item(self, index: SupportsInt) -> T | None: ...
def try_last(self) -> T | None: ...
def try_pick[U](self, chooser: Callable[[T], Option[U]]) -> U | None: ...
def unzip[U](self: FSharpArray[tuple[T, U]]) -> tuple[FSharpArray[T], FSharpArray[U]]: ...
def update_at(self, index: SupportsInt, value: T, cons: Any | None = None) -> FSharpArray[T]: ...
def windowed(self, window_size: SupportsInt) -> FSharpArray[FSharpArray[T]]: ...
def zip[U](self, array2: FSharpArray[U]) -> FSharpArray[tuple[T, U]]: ...
# Loose functions (alphabetically sorted)
# Note: Many functions accept Elements[T] (Iterable | IEnumerable) to support both Python and F# collections
def add_in_place[T](array: FSharpArray[T], value: T) -> None: ...
def add_range_in_place[T](array: FSharpArray[T], values: Elements[T]) -> None: ...
def allocate_array_from_cons[T](cons: FSharpCons[T] | None, length: SupportsInt) -> FSharpArray[T]: ...
def append[T](array1: Elements[T], array2: Elements[T], cons: FSharpCons[T] | None = None) -> FSharpArray[T]: ...
def average[T](array: Elements[T], averager: IGenericAverager[T]) -> T: ...
def average_by[T, U](projection: Callable[[T], U], array: Elements[T], averager: IGenericAverager[U]) -> U: ...
def choose[T, U](
chooser: Callable[[T], Option[U]], array: Elements[T], cons: FSharpCons[U] | None = None
) -> FSharpArray[U]: ...
def chunk_by_size[T](chunk_size: SupportsInt, array: Elements[T]) -> FSharpArray[FSharpArray[T]]: ...
def collect[T, U](
mapping: Callable[[T], FSharpArray[U]], array: Elements[T], cons: FSharpCons[U] | None = None
) -> FSharpArray[U]: ...
def compare_to[T](
comparer: Callable[[T, T], SupportsInt],
source1: Elements[T],
source2: Elements[T],
) -> Int32: ...
def compare_with[T](comparer: Callable[[T, T], SupportsInt], array1: Elements[T], array2: Elements[T]) -> Int32: ...
def concat[T](arrays: Elements[FSharpArray[T]], cons: FSharpCons[T] | None = None) -> FSharpArray[T]: ...
def contains[T](value: T, array: Elements[T], eq: IEqualityComparer_1[T] | None = None) -> bool: ...
def copy[T](array: Elements[T]) -> FSharpArray[T]: ...
def copy_to[T](
source: FSharpArray[T],
source_index: SupportsInt,
target: FSharpArray[T],
target_index: SupportsInt,
count: SupportsInt,
) -> None: ...
def create[T](count: SupportsInt, value: T) -> FSharpArray[T]: ...
# NOTE: zero_value is typed as `object` instead of `T` intentionally. When the F# compiler
# generates code for generic types, it passes `None` as the zero value. If we used `T`,
# pyright would infer `T = None`, resulting in `FSharpArray[None]`.
def zero_create[T](count: SupportsInt, zero_value: object) -> FSharpArray[T]: ... # pyright: ignore[reportInvalidTypeVarUse]
def empty[T](cons: FSharpCons[T] | None = None) -> FSharpArray[T]: ...
def equals_with[T](
equals_func: Callable[[T, T], bool],
array1: Elements[T] | None,
array2: Elements[T] | None,
) -> bool: ...
def exists[T](predicate: Callable[[T], bool], array: Elements[T]) -> bool: ...
def exists2[T1, T2](predicate: Callable[[T1, T2], bool], array1: Elements[T1], array2: Elements[T2]) -> bool: ...
def exists_offset[T](predicate: Callable[[T], bool], array: Elements[T], index: int) -> bool: ...
def fill[T](array: FSharpArray[T], target_index: int, count: int, value: T) -> FSharpArray[T]: ...
def filter[T](predicate: Callable[[T], bool], array: Elements[T]) -> FSharpArray[T]: ...
def find[T](predicate: Callable[[T], bool], array: Elements[T]) -> T: ...
def find_back[T](predicate: Callable[[T], bool], array: Elements[T]) -> T: ...
def find_index[T](predicate: Callable[[T], bool], array: Elements[T]) -> int: ...
def find_index_back[T](predicate: Callable[[T], bool], array: Elements[T]) -> int: ...
def find_last_index[T](predicate: Callable[[T], bool], array: Elements[T]) -> int: ...
def fold[T, S](folder: Callable[[S, T], S], state: S, array: Elements[T]) -> S: ...
def fold2[T1, T2, S](folder: Callable[[S, T1, T2], S], state: S, array1: Elements[T1], array2: Elements[T2]) -> S: ...
def fold_back[T, S](folder: Callable[[T, S], S], array: Elements[T], state: S) -> S: ...
def fold_back2[T1, T2, S](
folder: Callable[[T1, T2, S], S],
array1: Elements[T1],
array2: Elements[T2],
state: S,
) -> S: ...
def fold_back_indexed[T, S](folder: Callable[[Int32, T, S], S], array: Elements[T], state: S) -> S: ...
def fold_back_indexed2[T1, T2, S](
folder: Callable[[Int32, T1, T2, S], S],
array1: Elements[T1],
array2: Elements[T2],
state: S,
) -> S: ...
def fold_indexed[T, S](folder: Callable[[Int32, Any, Any], Any], state: Any, array: Elements[T]) -> Any: ...
def for_all[T](predicate: Callable[[T], bool], array: Elements[T]) -> bool: ...
def for_all2[T1, T2](predicate: Callable[[T1, T2], bool], array1: Elements[T1], array2: Elements[T2]) -> bool: ...
def get_sub_array[T](
array: Elements[T], start_index: SupportsInt, count: SupportsInt, cons: FSharpCons[T] | None = None
) -> FSharpArray[T]: ...
def head[T](array: Elements[T]) -> T: ...
def index_of[T](
array: Elements[T],
item: T,
start: SupportsInt | None = None,
count: SupportsInt | None = None,
eq: IEqualityComparer_1[T] | None = None,
) -> SupportsInt: ...
def indexed[T](array: Elements[T]) -> FSharpArray[tuple[SupportsInt, T]]: ...
def initialize[T](
count: SupportsInt, initializer: Callable[[Int32], T], cons: FSharpCons[T] | None = None
) -> FSharpArray[T]: ...
def insert_at[T](
index: SupportsInt, value: T, array: Elements[T], cons: FSharpCons[T] | None = None
) -> FSharpArray[T]: ...
def insert_many_at[T](
index: SupportsInt,
values: Elements[T],
array: Elements[T],
cons: FSharpCons[T] | None = None,
) -> FSharpArray[T]: ...
def insert_range_in_place[T](array: FSharpArray[T], index: SupportsInt, values: Elements[T]) -> None: ...
def item[T](index: SupportsInt, array: Elements[T]) -> T: ...
def iterate[T](action: Callable[[T], None], array: Elements[T]) -> None: ...
def iterate2[T1, T2](action: Callable[[T1, T2], None], array1: Elements[T1], array2: Elements[T2]) -> None: ...
def iterate_indexed[T](action: Callable[[Int32, T], None], array: Elements[T]) -> None: ...
def iterate_indexed2[T1, T2](action: Callable[[Int32, T1, T2], None], array1: Elements[T1], array2: Elements[T2]) -> None: ...
def last[T](array: Elements[T]) -> T: ...
def map[T, U](f: Callable[[T], U], array: Elements[T], cons: FSharpCons[U] | None = None) -> FSharpArray[U]: ...
def map2[T1, T2, U](
f: Callable[[T1, T2], U],
array1: Elements[T1],
array2: Elements[T2],
cons: FSharpCons[U] | None = None,
) -> FSharpArray[U]: ...
def map3[T1, T2, T3, U](
f: Callable[[T1, T2, T3], U],
array1: Elements[T1],
array2: Elements[T2],
array3: Elements[T3],
cons: FSharpCons[U] | None = None,
) -> FSharpArray[U]: ...
def map_fold[T, S, R](
mapping: Callable[[S, T], tuple[R, S]],
state: S,
array: Elements[T],
cons: FSharpCons[R] | None = None,
) -> tuple[FSharpArray[R], S]: ...
def map_fold_back[T, S, R](
mapping: Callable[[T, S], tuple[R, S]],
array: Elements[T],
state: S,
cons: FSharpCons[R] | None = None,
) -> tuple[FSharpArray[R], S]: ...
def map_indexed[T, U](
f: Callable[[Int32, T], U], array: Elements[T], cons: FSharpCons[U] | None = None
) -> FSharpArray[U]: ...
def map_indexed2[T1, T2, U](
f: Callable[[Int32, T1, T2], U],
array1: Elements[T1],
array2: Elements[T2],
cons: FSharpCons[U] | None = None,
) -> FSharpArray[U]: ...
def map_indexed3[T1, T2, T3, U](
f: Callable[[Int32, T1, T2, T3], U],
array1: Elements[T1],
array2: Elements[T2],
array3: Elements[T3],
cons: FSharpCons[U] | None = None,
) -> FSharpArray[U]: ...
def max[T](array: Elements[T], comparer: IComparer_1[T]) -> T: ...
def max_by[T, U](projection: Callable[[T], U], array: Elements[T], comparer: IComparer_1[U]) -> T: ...
def min[T](array: Elements[T], comparer: IComparer_1[T]) -> T: ...
def min_by[T, U](projection: Callable[[T], U], array: Elements[T], comparer: IComparer_1[U]) -> T: ...
def of_seq[T](seq: Elements[T], cons: FSharpCons[T] | None = None) -> FSharpArray[T]: ...
def pairwise[T](array: Elements[T]) -> FSharpArray[tuple[T, T]]: ...
def partition[T](
f: Callable[[T], bool], array: Elements[T], cons: FSharpCons[T] | None = None
) -> tuple[FSharpArray[T], FSharpArray[T]]: ...
def permute[T](f: Callable[[Int32], SupportsInt], array: Elements[T]) -> FSharpArray[T]: ...
def pick[T, U](chooser: Callable[[T], Option[U]], array: Elements[T]) -> U: ...
def random_choice[T](xs: Elements[T]) -> T: ...
def random_choice_by[T](randomizer: Callable[[], SupportsFloat], xs: Elements[T]) -> T: ...
def random_choice_with[T](random: Any, xs: Elements[T]) -> T: ...
def random_choices[T](count: int, xs: Elements[T]) -> FSharpArray[T]: ...
def random_choices_by[T](randomizer: Callable[[], SupportsFloat], count: int, xs: Elements[T]) -> FSharpArray[T]: ...
def random_choices_with[T](random: Any, count: int, xs: Elements[T]) -> FSharpArray[T]: ...
def random_sample[T](count: int, xs: Elements[T]) -> FSharpArray[T]: ...
def random_sample_by[T](randomizer: Callable[[], SupportsFloat], count: int, xs: Elements[T]) -> FSharpArray[T]: ...
def random_sample_with[T](random: Any, count: int, xs: Elements[T]) -> FSharpArray[T]: ...
def random_shuffle[T](xs: Elements[T]) -> FSharpArray[T]: ...
def random_shuffle_by[T](randomizer: Callable[[], SupportsFloat], xs: Elements[T]) -> FSharpArray[T]: ...
def random_shuffle_in_place[T](xs: FSharpArray[T]) -> None: ...
def random_shuffle_in_place_by[T](randomizer: Callable[[], SupportsFloat], xs: FSharpArray[T]) -> None: ...
def random_shuffle_in_place_with[T](random: Any, xs: FSharpArray[T]) -> None: ...
def random_shuffle_with[T](random: Any, xs: Elements[T]) -> FSharpArray[T]: ...
def reduce[T](reduction: Callable[[T, T], T], array: Elements[T]) -> T: ...
def reduce_back[T](reduction: Callable[[T, T], T], array: Elements[T]) -> T: ...
def remove_all_in_place[T](array: FSharpArray[T], predicate: Callable[[T], bool]) -> SupportsInt: ...
def remove_at[T](index: SupportsInt, array: FSharpArray[T], cons: FSharpCons[T] | None = None) -> FSharpArray[T]: ...
def remove_in_place[T](array: FSharpArray[T], item: T) -> bool: ...
def remove_many_at[T](index: SupportsInt, count: SupportsInt, array: FSharpArray[T]) -> FSharpArray[T]: ...
def resize[T](
array: FSharpRef[FSharpArray[T]], new_size: SupportsInt, zero: T | None = None, cons: FSharpCons[T] | None = None
) -> FSharpArray[T]: ...
def reverse[T](array: Elements[T]) -> FSharpArray[T]: ...
def scan[T, S](
folder: Callable[[S, T], S], state: S, array: Elements[T], cons: FSharpCons[S] | None = None
) -> FSharpArray[S]: ...
def scan_back[T, S](
folder: Callable[[T, S], S], array: Elements[T], state: S, cons: FSharpCons[S] | None = None
) -> FSharpArray[S]: ...
def set_slice[T](
target: FSharpArray[T], lower: SupportsInt | None, upper: SupportsInt | None, array: FSharpArray[T]
) -> None: ...
def singleton[T](value: T, cons: FSharpCons[T] | None = None) -> FSharpArray[T]: ...
def skip[T](count: SupportsInt, array: Elements[T], cons: FSharpCons[T] | None = None) -> FSharpArray[T]: ...
def skip_while[T](
predicate: Callable[[T], bool], array: Elements[T], cons: FSharpCons[T] | None = None
) -> FSharpArray[T]: ...
def sort[T](array: Elements[T], comparer: IComparer_1[T]) -> FSharpArray[T]: ...
def sort_by[T](
projection: Callable[[T], Any], array: Elements[T], comparer: IComparer_1[T] | None = None
) -> FSharpArray[T]: ...
def sort_by_descending[T, U](
projection: Callable[[T], U], array: Elements[T], comparer: IComparer_1[U] | None = None
) -> FSharpArray[T]: ...
def sort_descending[T](array: Elements[T], comparer: IComparer_1[T]) -> FSharpArray[T]: ...
def sort_in_place[T](array: FSharpArray[T], comparer: IComparer_1[T]) -> None: ...
def sort_in_place_by[T, U](projection: Callable[[T], U], array: FSharpArray[T], comparer: IComparer_1[U]) -> None: ...
def sort_in_place_with[T](compare_func: Callable[[T, T], SupportsInt], array: FSharpArray[T]) -> None: ...
def sort_with[T](comparer: Callable[[T, T], SupportsInt], array: Elements[T]) -> FSharpArray[T]: ...
def split_into[T](chunks: SupportsInt, array: Elements[T]) -> FSharpArray[FSharpArray[T]]: ...
def sum[T](array: Elements[T], adder: IGenericAdder[T]) -> T: ...
def sum_by[T, U](projection: Callable[[T], U], array: Elements[T], adder: IGenericAdder[U]) -> U: ...
def tail[T](array: Elements[T], cons: FSharpCons[T] | None = None) -> FSharpArray[T]: ...
def take[T](count: SupportsInt, array: Elements[T], cons: FSharpCons[T] | None = None) -> FSharpArray[T]: ...
def take_while[T](
predicate: Callable[[T], bool], array: Elements[T], cons: FSharpCons[T] | None = None
) -> FSharpArray[T]: ...
def transpose[T](array: Elements[FSharpArray[T]], cons: FSharpCons[T] | None = None) -> FSharpArray[FSharpArray[T]]: ...
def truncate[T](count: SupportsInt, array: Elements[T]) -> FSharpArray[T]: ...
def exactly_one[T](array: Elements[T]) -> T: ...
def try_find[T](predicate: Callable[[T], bool], array: Elements[T]) -> T | None: ...
def try_find_back[T](predicate: Callable[[T], bool], array: Elements[T]) -> T | None: ...
def try_find_index[T](predicate: Callable[[T], bool], array: Elements[T]) -> Int32 | None: ...
def try_find_index_back[T](predicate: Callable[[T], bool], array: Elements[T]) -> Int32 | None: ...
def try_head[T](array: Elements[T]) -> T | None: ...
def try_exactly_one[T](array: Elements[T]) -> T | None: ...
def try_item[T](index: SupportsInt, array: Elements[T]) -> T | None: ...
def try_last[T](array: Elements[T]) -> T | None: ...
def try_pick[T, U](chooser: Callable[[T], Option[U]], array: Elements[T]) -> U | None: ...
def unzip[T, U](array: Elements[tuple[T, U]]) -> tuple[FSharpArray[T], FSharpArray[U]]: ...
def unzip3[T1, T2, T3](array: Elements[tuple[T1, T2, T3]]) -> tuple[FSharpArray[T1], FSharpArray[T2], FSharpArray[T3]]: ...
def update_at[T](
index: SupportsInt, value: T, array: Elements[T], cons: FSharpCons[T] | None = None
) -> FSharpArray[T]: ...
def windowed[T](window_size: SupportsInt, array: Elements[T]) -> FSharpArray[FSharpArray[T]]: ...
def where[T](predicate: Callable[[T], bool], array: Elements[T]) -> FSharpArray[T]: ...
def all_pairs[T, U](array1: Elements[T], array2: Elements[U]) -> FSharpArray[tuple[T, U]]: ...
def zip[T, U](array1: Elements[T], array2: Elements[U]) -> FSharpArray[tuple[T, U]]: ...
def zip3[T1, T2, T3](array1: Elements[T1], array2: Elements[T2], array3: Elements[T3]) -> FSharpArray[tuple[T1, T2, T3]]: ...
# Typed array subclasses (for isinstance checks and type annotations)
class Int8Array(FSharpArray[int]): ...
class UInt8Array(FSharpArray[int]): ...
class Int16Array(FSharpArray[int]): ...
class UInt16Array(FSharpArray[int]): ...
class Int32Array(FSharpArray[int]): ...
class UInt32Array(FSharpArray[int]): ...
class Int64Array(FSharpArray[int]): ...
class UInt64Array(FSharpArray[int]): ...
class Float32Array(FSharpArray[float]): ...
class Float64Array(FSharpArray[float]): ...
class BoolArray(FSharpArray[bool]): ...
class GenericArray[T](FSharpArray[T]): ...
class FSharpCons[T]:
array_type: ClassVar[str]
def __init__(self, array_type: ArrayType) -> None: ...
def __call__(self, length: SupportsInt) -> FSharpArray[T]: ...
def allocate(self, length: SupportsInt) -> FSharpArray[T]: ...