"""
This type stub file was generated by pyright.
"""

from abc import ABCMeta, abstractmethod
from typing import Hashable, TYPE_CHECKING, overload
from pandas._typing import CompressionOptions, FilePath, ReadBuffer
from pandas.util._decorators import deprecate_nonkeyword_arguments, doc
from pandas.core.shared_docs import _shared_docs
from pandas import DataFrame

"""
Read SAS sas7bdat or xport files.
"""
if TYPE_CHECKING:
    ...
class ReaderBase(metaclass=ABCMeta):
    """
    Protocol for XportReader and SAS7BDATReader classes.
    """
    @abstractmethod
    def read(self, nrows: int | None = ...) -> DataFrame:
        ...
    
    @abstractmethod
    def close(self) -> None:
        ...
    
    def __enter__(self) -> ReaderBase:
        ...
    
    def __exit__(self, exc_type, exc_value, traceback) -> None:
        ...
    


@overload
def read_sas(filepath_or_buffer: FilePath | ReadBuffer[bytes], format: str | None = ..., index: Hashable | None = ..., encoding: str | None = ..., chunksize: int = ..., iterator: bool = ..., compression: CompressionOptions = ...) -> ReaderBase:
    ...

@overload
def read_sas(filepath_or_buffer: FilePath | ReadBuffer[bytes], format: str | None = ..., index: Hashable | None = ..., encoding: str | None = ..., chunksize: None = ..., iterator: bool = ..., compression: CompressionOptions = ...) -> DataFrame | ReaderBase:
    ...

@deprecate_nonkeyword_arguments(version=None, allowed_args=["filepath_or_buffer"])
@doc(decompression_options=_shared_docs["decompression_options"] % "filepath_or_buffer")
def read_sas(filepath_or_buffer: FilePath | ReadBuffer[bytes], format: str | None = ..., index: Hashable | None = ..., encoding: str | None = ..., chunksize: int | None = ..., iterator: bool = ..., compression: CompressionOptions = ...) -> DataFrame | ReaderBase:
    """
    Read SAS files stored as either XPORT or SAS7BDAT format files.

    Parameters
    ----------
    filepath_or_buffer : str, path object, or file-like object
        String, path object (implementing ``os.PathLike[str]``), or file-like
        object implementing a binary ``read()`` function. The string could be a URL.
        Valid URL schemes include http, ftp, s3, and file. For file URLs, a host is
        expected. A local file could be:
        ``file://localhost/path/to/table.sas``.
    format : str {{'xport', 'sas7bdat'}} or None
        If None, file format is inferred from file extension. If 'xport' or
        'sas7bdat', uses the corresponding format.
    index : identifier of index column, defaults to None
        Identifier of column that should be used as index of the DataFrame.
    encoding : str, default is None
        Encoding for text data.  If None, text data are stored as raw bytes.
    chunksize : int
        Read file `chunksize` lines at a time, returns iterator.

        .. versionchanged:: 1.2

            ``TextFileReader`` is a context manager.
    iterator : bool, defaults to False
        If True, returns an iterator for reading the file incrementally.

        .. versionchanged:: 1.2

            ``TextFileReader`` is a context manager.
    {decompression_options}

    Returns
    -------
    DataFrame if iterator=False and chunksize=None, else SAS7BDATReader
    or XportReader
    """
    ...

