-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Convert sizes to `Py_ssize_t`, which Python uses for this info * Type file offsets with `off_t` * Update default values to work with typing * Simplify and optimize `parse_buffer_argument` * Add `.pxd` file for `RemoteHandle` to allow leveraging it in Cython
- Loading branch information
Showing
6 changed files
with
74 additions
and
53 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
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,27 @@ | ||
# Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved. | ||
# See file LICENSE for terms. | ||
|
||
# distutils: language = c++ | ||
# cython: language_level=3 | ||
|
||
from cython cimport Py_ssize_t | ||
from libcpp.memory cimport unique_ptr | ||
|
||
from kvikio._lib.future cimport IOFuture | ||
|
||
|
||
cdef class RemoteFile: | ||
cdef unique_ptr[cpp_RemoteHandle] _handle | ||
|
||
@classmethod | ||
cpdef open_http( | ||
cls, | ||
url: str, | ||
nbytes: Py_ssize_t = -1, | ||
) -> RemoteFile | ||
|
||
cpdef nbytes(self) -> Py_ssize_t | ||
|
||
cpdef read(self, buf, size: Py_ssize_t = -1, file_offset: Py_ssize_t = 0) -> Py_ssize_t | ||
|
||
cpdef pread(self, buf, size: Py_ssize_t = -1, file_offset: Py_ssize_t = 0) -> IOFuture |
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