buffer
Buffer
Bases: FTyped[BufferFType[FT]], ABC
Abstract base class for buffer-like data structures. Buffers support random access, and can be resized. They are used to store data in a way that allows for efficient reading and writing of elements.
Source code in src/finch/finch_assembly/buffer.py
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 | |
element_type
property
Return the type of elements stored in the buffer. This is typically the same as the dtype used to create the buffer.
length_type
property
Return the type of indices used to access elements in the buffer. This is typically an integer type.
length()
abstractmethod
Return the length of the buffer.
Source code in src/finch/finch_assembly/buffer.py
52 53 54 55 56 57 | |
resize(len)
abstractmethod
Resize the buffer to the new length.
Source code in src/finch/finch_assembly/buffer.py
81 82 83 84 85 86 | |
BufferFType
Abstract base class for the ftype of arguments. The ftype defines how the data structures store data, and can construct a data structure with the call method.
Source code in src/finch/finch_assembly/buffer.py
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 | |
element_type
abstractmethod
property
Return the type of elements stored in the buffer. This is typically the same as the dtype used to create the buffer.
length_type
property
Returns the type used for the length of the buffer.
__call__(*args, **kwargs)
abstractmethod
Create an instance of an object in this ftype with the given arguments.
Source code in src/finch/finch_assembly/buffer.py
18 19 20 21 22 23 | |
length_type(arg)
The length type of the given argument. The length type is the type of the value returned by len(arg).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arg
|
FTyped | FType
|
The object to determine the length type for. |
required |
Returns:
| Type | Description |
|---|---|
FDTypeInteger
|
The length type of the given object. |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If the length type is not implemented for the given type. |
Source code in src/finch/finch_assembly/buffer.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |