Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(bindings/python): let path can be PathLike #5636

Merged
merged 9 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 32 additions & 25 deletions bindings/python/python/opendal/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,23 @@

from typing import AsyncIterable, Iterable, Optional, final, Union, Type
from types import TracebackType
import os

from opendal import exceptions as exceptions
from opendal import layers as layers
from opendal.layers import Layer
from opendal.__base import _Base

PathBuf = Union[str, os.PathLike]

@final
class Operator(_Base):
def layer(self, layer: Layer) -> "Operator": ...
def open(self, path: str, mode: str) -> File: ...
def read(self, path: str) -> bytes: ...
def open(self, path: PathBuf, mode: str) -> File: ...
def read(self, path: PathBuf) -> bytes: ...
def write(
self,
path: str,
path: PathBuf,
bs: bytes,
*,
append: bool = ...,
Expand All @@ -39,25 +42,25 @@ class Operator(_Base):
content_disposition: str = ...,
cache_control: str = ...,
) -> None: ...
def stat(self, path: str) -> Metadata: ...
def create_dir(self, path: str) -> None: ...
def delete(self, path: str) -> None: ...
def list(self, path: str) -> Iterable[Entry]: ...
def scan(self, path: str) -> Iterable[Entry]: ...
def stat(self, path: PathBuf) -> Metadata: ...
def create_dir(self, path: PathBuf) -> None: ...
def delete(self, path: PathBuf) -> None: ...
def list(self, path: PathBuf) -> Iterable[Entry]: ...
def scan(self, path: PathBuf) -> Iterable[Entry]: ...
def capability(self) -> Capability: ...
def copy(self, source: str, target: str) -> None: ...
def rename(self, source: str, target: str) -> None: ...
def remove_all(self, path: str) -> None: ...
def copy(self, source: PathBuf, target: PathBuf) -> None: ...
def rename(self, source: PathBuf, target: PathBuf) -> None: ...
def remove_all(self, path: PathBuf) -> None: ...
def to_async_operator(self) -> AsyncOperator: ...

@final
class AsyncOperator(_Base):
def layer(self, layer: Layer) -> "AsyncOperator": ...
async def open(self, path: str, mode: str) -> AsyncFile: ...
async def read(self, path: str) -> bytes: ...
async def open(self, path: PathBuf, mode: str) -> AsyncFile: ...
async def read(self, path: PathBuf) -> bytes: ...
async def write(
self,
path: str,
path: PathBuf,
bs: bytes,
*,
append: bool = ...,
Expand All @@ -66,20 +69,24 @@ class AsyncOperator(_Base):
content_disposition: str = ...,
cache_control: str = ...,
) -> None: ...
async def stat(self, path: str) -> Metadata: ...
async def create_dir(self, path: str) -> None: ...
async def delete(self, path: str) -> None: ...
async def list(self, path: str) -> AsyncIterable[Entry]: ...
async def scan(self, path: str) -> AsyncIterable[Entry]: ...
async def presign_stat(self, path: str, expire_second: int) -> PresignedRequest: ...
async def presign_read(self, path: str, expire_second: int) -> PresignedRequest: ...
async def stat(self, path: PathBuf) -> Metadata: ...
async def create_dir(self, path: PathBuf) -> None: ...
async def delete(self, path: PathBuf) -> None: ...
async def list(self, path: PathBuf) -> AsyncIterable[Entry]: ...
async def scan(self, path: PathBuf) -> AsyncIterable[Entry]: ...
async def presign_stat(
self, path: PathBuf, expire_second: int
) -> PresignedRequest: ...
async def presign_read(
self, path: PathBuf, expire_second: int
) -> PresignedRequest: ...
async def presign_write(
self, path: str, expire_second: int
self, path: PathBuf, expire_second: int
) -> PresignedRequest: ...
def capability(self) -> Capability: ...
async def copy(self, source: str, target: str) -> None: ...
async def rename(self, source: str, target: str) -> None: ...
async def remove_all(self, path: str) -> None: ...
async def copy(self, source: PathBuf, target: PathBuf) -> None: ...
async def rename(self, source: PathBuf, target: PathBuf) -> None: ...
async def remove_all(self, path: PathBuf) -> None: ...
def to_operator(self) -> Operator: ...

@final
Expand Down
Loading