From 038eb50236d2a916314385738d9c498699739f79 Mon Sep 17 00:00:00 2001 From: Dawid Makar Date: Wed, 27 Sep 2023 01:58:41 +0200 Subject: [PATCH] Automatic refactoring. Refactoring step id: UUID('fd9d5d13-dccd-4f47-b8de-28701ba1b979') --- pandas/io/sas/sasreader.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pandas/io/sas/sasreader.py b/pandas/io/sas/sasreader.py index 2a395f790a5b5..6c43f0f7c0179 100644 --- a/pandas/io/sas/sasreader.py +++ b/pandas/io/sas/sasreader.py @@ -3,10 +3,13 @@ """ from __future__ import annotations +from abc import ( + ABCMeta, + abstractmethod, +) from typing import ( TYPE_CHECKING, Hashable, - Protocol, overload, ) @@ -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 @@ -173,4 +179,4 @@ def read_sas( return reader with reader: - return reader.read() + return reader.read() \ No newline at end of file