Skip to content

Automatic PR for fd9d5d13-dccd-4f47-b8de-28701ba1b979 #94

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: fd9d5d13-dccd-4f47-b8de-28701ba1b979-base
Choose a base branch
from
Open
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
16 changes: 11 additions & 5 deletions pandas/io/sas/sasreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
"""
from __future__ import annotations

from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
TYPE_CHECKING,
Hashable,
Protocol,
overload,
)

Expand All @@ -28,16 +31,19 @@
from pandas import DataFrame


class ReaderBase(Protocol):
# TODO(PY38): replace with Protocol in Python 3.8
class ReaderBase(metaclass=ABCMeta):
"""
Protocol for XportReader and SAS7BDATReader classes.
"""

@abstractmethod
def read(self, nrows: int | None = None) -> DataFrame:
...
pass

@abstractmethod
def close(self) -> None:
...
pass

def __enter__(self) -> ReaderBase:
return self
Expand Down Expand Up @@ -173,4 +179,4 @@ def read_sas(
return reader

with reader:
return reader.read()
return reader.read()