From 06fe6f70e91edbcec09596a723a4093690a53baf Mon Sep 17 00:00:00 2001 From: Anh Trinh Date: Tue, 12 Mar 2024 07:08:29 +0100 Subject: [PATCH] Remove unused private code in sas module --- pandas/io/sas/sas7bdat.py | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/pandas/io/sas/sas7bdat.py b/pandas/io/sas/sas7bdat.py index 49287ddf5ff38..6a392a0f02caf 100644 --- a/pandas/io/sas/sas7bdat.py +++ b/pandas/io/sas/sas7bdat.py @@ -17,10 +17,7 @@ from __future__ import annotations from collections import abc -from datetime import ( - datetime, - timedelta, -) +from datetime import datetime import sys from typing import TYPE_CHECKING @@ -44,7 +41,6 @@ from pandas import ( DataFrame, Timestamp, - isna, ) from pandas.io.common import get_handle @@ -55,7 +51,6 @@ from pandas._typing import ( CompressionOptions, FilePath, - NaTType, ReadBuffer, ) @@ -64,20 +59,6 @@ _sas_origin = Timestamp("1960-01-01") -def _parse_datetime(sas_datetime: float, unit: str) -> datetime | NaTType: - if isna(sas_datetime): - return pd.NaT - - if unit == "s": - return datetime(1960, 1, 1) + timedelta(seconds=sas_datetime) - - elif unit == "d": - return datetime(1960, 1, 1) + timedelta(days=sas_datetime) - - else: - raise ValueError("unit must be 'd' or 's'") - - def _convert_datetimes(sas_datetimes: pd.Series, unit: str) -> pd.Series: """ Convert to Timestamp if possible, otherwise to datetime.datetime. @@ -370,11 +351,6 @@ def _read_bytes(self, offset: int, length: int): raise ValueError("The cached page is too small.") return self._cached_page[offset : offset + length] - def _read_and_convert_header_text(self, offset: int, length: int) -> str | bytes: - return self._convert_header_text( - self._read_bytes(offset, length).rstrip(b"\x00 ") - ) - def _parse_metadata(self) -> None: done = False while not done: