From d60e1e8a32828cb6e1ff7790eb925a8d4ec332cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20W=C3=B6rtwein?= Date: Thu, 28 Oct 2021 17:46:38 -0400 Subject: [PATCH 1/2] CLN: remove checks for python < 3.8 --- pandas/_libs/tslibs/timestamps.pyi | 25 ++++--------------- .../tests/io/json/test_json_table_schema.py | 2 -- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/pandas/_libs/tslibs/timestamps.pyi b/pandas/_libs/tslibs/timestamps.pyi index ff6b18835322e..1ca21d140cf79 100644 --- a/pandas/_libs/tslibs/timestamps.pyi +++ b/pandas/_libs/tslibs/timestamps.pyi @@ -89,16 +89,8 @@ class Timestamp(datetime): def today(cls: Type[_S]) -> _S: ... @classmethod def fromordinal(cls: Type[_S], n: int) -> _S: ... - if sys.version_info >= (3, 8): - @classmethod - def now(cls: Type[_S], tz: _tzinfo | str | None = ...) -> _S: ... - else: - @overload - @classmethod - def now(cls: Type[_S], tz: None = ...) -> _S: ... - @overload - @classmethod - def now(cls, tz: _tzinfo) -> datetime: ... + @classmethod + def now(cls: Type[_S], tz: _tzinfo | str | None = ...) -> _S: ... @classmethod def utcnow(cls: Type[_S]) -> _S: ... @classmethod @@ -129,10 +121,7 @@ class Timestamp(datetime): *, fold: int = ..., ) -> datetime: ... - if sys.version_info >= (3, 8): - def astimezone(self: _S, tz: _tzinfo | None = ...) -> _S: ... - else: - def astimezone(self, tz: _tzinfo | None = ...) -> datetime: ... + def astimezone(self: _S, tz: _tzinfo | None = ...) -> _S: ... def ctime(self) -> str: ... def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ... @classmethod @@ -144,12 +133,8 @@ class Timestamp(datetime): def __lt__(self, other: datetime) -> bool: ... # type: ignore def __ge__(self, other: datetime) -> bool: ... # type: ignore def __gt__(self, other: datetime) -> bool: ... # type: ignore - if sys.version_info >= (3, 8): - def __add__(self: _S, other: timedelta) -> _S: ... - def __radd__(self: _S, other: timedelta) -> _S: ... - else: - def __add__(self, other: timedelta) -> datetime: ... - def __radd__(self, other: timedelta) -> datetime: ... + def __add__(self: _S, other: timedelta) -> _S: ... + def __radd__(self: _S, other: timedelta) -> _S: ... @overload # type: ignore def __sub__(self, other: datetime) -> timedelta: ... @overload diff --git a/pandas/tests/io/json/test_json_table_schema.py b/pandas/tests/io/json/test_json_table_schema.py index 71f1d03ea6d1f..72b9cdb209fdc 100644 --- a/pandas/tests/io/json/test_json_table_schema.py +++ b/pandas/tests/io/json/test_json_table_schema.py @@ -691,7 +691,6 @@ class TestTableOrientReader: }, ], ) - @pytest.mark.skipif(sys.version_info[:3] == (3, 7, 0), reason="GH-35309") def test_read_json_table_orient(self, index_nm, vals, recwarn): df = DataFrame(vals, index=pd.Index(range(4), name=index_nm)) out = df.to_json(orient="table") @@ -741,7 +740,6 @@ def test_read_json_table_orient_raises(self, index_nm, vals, recwarn): }, ], ) - @pytest.mark.skipif(sys.version_info[:3] == (3, 7, 0), reason="GH-35309") def test_read_json_table_timezones_orient(self, idx, vals, recwarn): # GH 35973 df = DataFrame(vals, index=idx) From b3d7fa83c181548be170c3d2442c1cbd83239fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20W=C3=B6rtwein?= Date: Thu, 28 Oct 2021 18:00:35 -0400 Subject: [PATCH 2/2] remove import sys --- pandas/_libs/tslibs/timestamps.pyi | 1 - pandas/tests/io/json/test_json_table_schema.py | 1 - 2 files changed, 2 deletions(-) diff --git a/pandas/_libs/tslibs/timestamps.pyi b/pandas/_libs/tslibs/timestamps.pyi index 1ca21d140cf79..a89d0aecfc26c 100644 --- a/pandas/_libs/tslibs/timestamps.pyi +++ b/pandas/_libs/tslibs/timestamps.pyi @@ -5,7 +5,6 @@ from datetime import ( timedelta, tzinfo as _tzinfo, ) -import sys from time import struct_time from typing import ( ClassVar, diff --git a/pandas/tests/io/json/test_json_table_schema.py b/pandas/tests/io/json/test_json_table_schema.py index 72b9cdb209fdc..89b8783462f7e 100644 --- a/pandas/tests/io/json/test_json_table_schema.py +++ b/pandas/tests/io/json/test_json_table_schema.py @@ -1,7 +1,6 @@ """Tests for Table Schema integration.""" from collections import OrderedDict import json -import sys import numpy as np import pytest