Skip to content

CLN: Remove unused private code in sas module #57819

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

Merged
merged 1 commit into from
Mar 12, 2024
Merged
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
26 changes: 1 addition & 25 deletions pandas/io/sas/sas7bdat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -44,7 +41,6 @@
from pandas import (
DataFrame,
Timestamp,
isna,
)

from pandas.io.common import get_handle
Expand All @@ -55,7 +51,6 @@
from pandas._typing import (
CompressionOptions,
FilePath,
NaTType,
ReadBuffer,
)

Expand All @@ -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.
Expand Down Expand Up @@ -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:
Expand Down