panpath.azure_async_client
Async Azure Blob Storage client implementation.
AsyncAzureBlobClient— Asynchronous Azure Blob Storage client implementation.</>AzureAsyncFileHandle— Async file handle for Azure with chunked streaming support.</>
panpath.azure_async_client.AsyncAzureBlobClient(connection_string=None, **kwargs)
Asynchronous Azure Blob Storage client implementation.
__aenter__()(AsyncClient) — Enter async context manager.</>__aexit__(exc_type,exc_val,exc_tb)— Exit async context manager.</>close()— Close the client and cleanup resources.</>copy(source,target,follow_symlinks)— Copy file to target.</>copytree(source,target,follow_symlinks)— Copy directory tree to target recursively.</>delete(path)— Delete Azure blob.</>exists(path)(bool) — Check if Azure blob exists.</>get_metadata(path)(dict) — Get blob metadata.</>glob(path,pattern)— Glob for files matching pattern.</>is_dir(path)(bool) — Check if Azure path is a directory.</>is_file(path)(bool) — Check if Azure path is a file.</>is_symlink(path)(bool) — Check if path is a symlink (has symlink metadata).</>list_dir(path)(list) — List Azure blobs with prefix.</>mkdir(path,parents,exist_ok)— Create a directory marker (empty blob with trailing slash).</>open(path,mode,encoding,**kwargs)(Any) — Open Azure blob for reading/writing.</>read_bytes(path)(bytes) — Read Azure blob as bytes.</>read_text(path,encoding)(str) — Read Azure blob as text.</>readlink(path)(str) — Read symlink target from metadata.</>rename(source,target)— Rename/move file.</>rmdir(path)— Remove directory marker.</>rmtree(path,ignore_errors,onerror)— Remove directory and all its contents recursively.</>set_metadata(path,metadata)— Set blob metadata.</>stat(path)(stat_result) — Get Azure blob metadata.</>symlink_to(path,target)— Create symlink by storing target in metadata.</>touch(path,mode,exist_ok)— Create empty file.</>walk(path)— Walk directory tree.</>write_bytes(path,data)— Write bytes to Azure blob.</>write_text(path,data,encoding)(int) — Write text to Azure blob.</>
__aenter__() → AsyncClient
Enter async context manager.
__aexit__(exc_type, exc_val, exc_tb)
Exit async context manager.
read_text(path, encoding='utf-8') → str
Read Azure blob as text.
write_text(path, data, encoding='utf-8') → int
Write text to Azure blob.
is_symlink(path)
Check if path is a symlink (has symlink metadata).
path(str) — Cloud path
True if path is a symlink
readlink(path)
Read symlink target from metadata.
path(str) — Cloud path
Symlink target path
close()
Close the client and cleanup resources.
exists(path) → bool
Check if Azure blob exists.
read_bytes(path) → bytes
Read Azure blob as bytes.
write_bytes(path, data)
Write bytes to Azure blob.
delete(path)
Delete Azure blob.
list_dir(path) → list
List Azure blobs with prefix.
is_dir(path) → bool
Check if Azure path is a directory.
is_file(path) → bool
Check if Azure path is a file.
stat(path) → stat_result
Get Azure blob metadata.
open(path, mode='r', encoding=None, **kwargs) → Any
Open Azure blob for reading/writing.
Note: For better streaming support, use a_open() instead. This method returns a file-like object that supports the standard file API.
path(str) — Azure pathmode(str, optional) — File modeencoding(Optional, optional) — Text encoding**kwargs(Any) — Additional arguments (chunk_size, upload_warning_threshold,upload_interval supported)
mkdir(path, parents=False, exist_ok=False)
Create a directory marker (empty blob with trailing slash).
path(str) — Azure path (az://container/path or azure://container/path)parents(bool, optional) — If True, create parent directories as needed (ignored for Azure)exist_ok(bool, optional) — If True, don't raise error if directory already exists
get_metadata(path)
Get blob metadata.
path(str) — Azure path
Dictionary of metadata key-value pairs
set_metadata(path, metadata)
Set blob metadata.
path(str) — Azure pathmetadata(dict) — Dictionary of metadata key-value pairs
symlink_to(path, target)
Create symlink by storing target in metadata.
path(str) — Azure path for the symlinktarget(str) — Target path the symlink should point to
glob(path, pattern)
Glob for files matching pattern.
path(str) — Base Azure pathpattern(str) — Glob pattern (e.g., ".txt", "**/.py")
Matching paths as strings or PanPath objects
walk(path)
Walk directory tree.
path(str) — Base Azure path
Tuples of (dirpath, dirnames, filenames)
touch(path, mode=None, exist_ok=True)
Create empty file.
path(str) — Azure pathexist_ok(bool, optional) — If False, raise error if file exists
rename(source, target)
Rename/move file.
source(str) — Source Azure pathtarget(str) — Target Azure path
rmdir(path)
Remove directory marker.
path(str) — Azure path
rmtree(path, ignore_errors=False, onerror=None)
Remove directory and all its contents recursively.
path(str) — Azure pathignore_errors(bool, optional) — If True, errors are ignoredonerror(Optional, optional) — Callable that accepts (function, path, excinfo)
copy(source, target, follow_symlinks=True)
Copy file to target.
source(str) — Source Azure pathtarget(str) — Target Azure pathfollow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
copytree(source, target, follow_symlinks=True)
Copy directory tree to target recursively.
source(str) — Source Azure pathtarget(str) — Target Azure pathfollow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
panpath.azure_async_client.AzureAsyncFileHandle(*args, **kwargs)
Async file handle for Azure with chunked streaming support.
Uses Azure SDK's download_blob streaming API.
closed(bool) — Check if file is closed.</>
__aenter__()(AsyncFileHandle) — Enter async context manager.</>__aexit__(exc_type,exc_val,exc_tb)— Exit async context manager.</>__aiter__()(AsyncFileHandle) — Support async iteration over lines.</>__anext__()(Union) — Get next line in async iteration.</>close()— Close the file and flush write buffer to cloud storage.</>flush()— Flush write buffer to cloud storage.</>read(size)(Union) — Read and return up to size bytes/characters.</>readline(size)(Union) — Read and return one line from the file.</>readlines()(List) — Read and return all lines from the file.</>reset_stream()— Reset the underlying stream to the beginning.</>seek(offset,whence)(int) — Change stream position (forward seeking only).</>tell()(int) — Return current stream position.</>write(data)(int) — Write data to the file.</>writelines(lines)— Write a list of lines to the file.</>
flush()
Flush write buffer to cloud storage.
After open, all flushes append to existing content using provider-native append operations. The difference between 'w' and 'a' modes is that 'w' clears existing content on open, while 'a' preserves it.
__aenter__() → AsyncFileHandle
Enter async context manager.
__aexit__(exc_type, exc_val, exc_tb)
Exit async context manager.
read(size=-1)
Read and return up to size bytes/characters.
size(int, optional) — Number of bytes/chars to read (-1 for all)
Data read from file
readline(size=-1) → Union
Read and return one line from the file.
readlines() → List
Read and return all lines from the file.
write(data) → int
Write data to the file.
writelines(lines)
Write a list of lines to the file.
close()
Close the file and flush write buffer to cloud storage.
__aiter__() → AsyncFileHandle
Support async iteration over lines.
__anext__() → Union
Get next line in async iteration.
tell()
Return current stream position.
Current position in the file
seek(offset, whence=0)
Change stream position (forward seeking only).
offset(int) — Position offsetwhence(int, optional) — Reference point (0=start, 1=current, 2=end)
New absolute position
OSError— If backward seeking is attemptedValueError— If called in write mode or on closed file
Note
- Only forward seeking is supported due to streaming limitations
- SEEK_END (whence=2) is not supported as blob size may be unknown
- Backward seeking requires re-opening the stream
reset_stream()
Reset the underlying stream to the beginning.