-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(python): Split buffer Cython internals into a separate module (
#549) Continuing the saga, this splits the buffer internals into their own module. The definition of `Extension`s in setup.py was also getting unwieldy, so I factored that out into a function. This should better support future linking to a common nanoarrow static or shared library (instead of just compiling in the sources for whatever we need in that module).
- Loading branch information
1 parent
a24aa23
commit c74bb37
Showing
9 changed files
with
1,139 additions
and
1,045 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# cython: language_level = 3 | ||
|
||
from libc.stdint cimport int64_t | ||
|
||
from nanoarrow_c cimport ( | ||
ArrowBuffer, | ||
ArrowBufferView, | ||
ArrowType, | ||
) | ||
|
||
from nanoarrow._device cimport Device | ||
|
||
|
||
cdef class CBufferView: | ||
cdef object _base | ||
cdef ArrowBufferView _ptr | ||
cdef ArrowType _data_type | ||
cdef Device _device | ||
cdef Py_ssize_t _element_size_bits | ||
cdef Py_ssize_t _shape | ||
cdef Py_ssize_t _strides | ||
cdef int64_t _n_elements | ||
cdef char _format[128] | ||
|
||
cdef _check_copy_into_bounds(self, Py_buffer* dest, int64_t offset, int64_t length, | ||
int64_t dest_offset, int64_t dest_itemsize) | ||
|
||
cdef Py_ssize_t _item_size(self) | ||
|
||
cdef _do_getbuffer(self, Py_buffer *buffer, int flags) | ||
|
||
cdef _do_releasebuffer(self, Py_buffer* buffer) | ||
|
||
cdef class CBuffer: | ||
cdef object _base | ||
cdef ArrowBuffer* _ptr | ||
cdef ArrowType _data_type | ||
cdef int _element_size_bits | ||
cdef char _format[32] | ||
cdef Device _device | ||
cdef CBufferView _view | ||
cdef int _get_buffer_count | ||
|
||
cdef _assert_valid(self) | ||
|
||
cdef _assert_buffer_count_zero(self) | ||
|
||
cdef _populate_view(self) |
Oops, something went wrong.