from typing import BinaryIO

from polars import DataFrame
from polars._typing import SchemaDict

class DbaseIter:
    def next(self) -> DataFrame | None: ...

class DbaseSource:
    def __init__(
        self,
        paths: list[str],
        buffs: list[BinaryIO],
        single_col_name: str | None = ...,
        encoding: str | None = ...,
        character_trim: str | None = ...,
        skip_deleted: bool | None = ...,
        validate_schema: bool | None = ...,
        compressed: bool | None = ...,
    ) -> None: ...
    def schema(self) -> SchemaDict: ...
    def batch_iter(self, batch_size: int, with_columns: list[str] | None = ...) -> DbaseIter: ...
    def batch_iter_with_progress(
        self, batch_size: int, with_columns: list[str] | None = ..., progress: bool = ...
    ) -> DbaseIter: ...

def write_dbase_file(
    frames: list[DataFrame],
    dest: str,
    encoding: str | None = ...,
    overwrite: bool | None = ...,
    memo_threshold: int | None = ...,
) -> None: ...
def write_dbase_buff(
    frames: list[DataFrame], buff: BinaryIO, encoding: str | None = ..., memo_threshold: int | None = ...
) -> None: ...
def get_record_count(path: str) -> int: ...

class DbaseError(Exception): ...
class EmptySources(ValueError): ...
class SchemaMismatch(ValueError): ...
class EncodingError(ValueError): ...
class DbcError(ValueError): ...
