Skip to content

Commit f4c0035

Browse files
committed
Remove ge 311 checks
1 parent 409767f commit f4c0035

File tree

16 files changed

+21
-92
lines changed

16 files changed

+21
-92
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ repos:
4545
hooks:
4646
- id: codespell
4747
types_or: [python, rst, markdown, cython, c]
48-
additional_dependencies: [tomli]
4948
- repo: https://github.com/MarcoGorelli/cython-lint
5049
rev: v0.16.7
5150
hooks:
@@ -235,7 +234,7 @@ repos:
235234
entry: python scripts/generate_pip_deps_from_conda.py
236235
files: ^(environment.yml|requirements-dev.txt)$
237236
pass_filenames: false
238-
additional_dependencies: [tomli, pyyaml]
237+
additional_dependencies: [pyyaml]
239238
- id: title-capitalization
240239
name: Validate correct capitalization among titles in documentation
241240
entry: python scripts/validate_rst_title_capitalization.py
@@ -290,7 +289,7 @@ repos:
290289
entry: python -m scripts.validate_min_versions_in_sync
291290
language: python
292291
files: ^(ci/deps/actions-.*-minimum_versions\.yaml|pandas/compat/_optional\.py)$
293-
additional_dependencies: [tomli, pyyaml]
292+
additional_dependencies: [pyyaml]
294293
pass_filenames: false
295294
- id: validate-errors-locations
296295
name: Validate errors locations

ci/meta.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ requirements:
3131
- numpy >=1.21.6 # [py<311]
3232
- numpy >=1.23.2 # [py>=311]
3333
- versioneer
34-
- tomli # [py<311]
3534
run:
3635
- python
3736
- numpy >=1.21.6 # [py<311]
@@ -66,7 +65,6 @@ test:
6665
- pytest-xdist >=3.4.0
6766
- pytest-cov
6867
- hypothesis >=6.84.0
69-
- tomli # [py<311]
7068

7169
about:
7270
home: http://pandas.pydata.org

pandas/_testing/_warnings.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
)
1717
import warnings
1818

19-
from pandas.compat import PY311
20-
2119
if TYPE_CHECKING:
2220
from collections.abc import (
2321
Generator,
@@ -216,7 +214,7 @@ def _assert_caught_no_extra_warnings(
216214
# due to these open files.
217215
if any("matplotlib" in mod for mod in sys.modules):
218216
continue
219-
if PY311 and actual_warning.category == EncodingWarning:
217+
if actual_warning.category == EncodingWarning:
220218
# EncodingWarnings are checked in the CI
221219
# pyproject.toml errors on EncodingWarnings in pandas
222220
# Ignore EncodingWarnings from other libraries

pandas/compat/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from pandas.compat._constants import (
1919
IS64,
2020
ISMUSL,
21-
PY311,
2221
PY312,
2322
PYPY,
2423
WASM,
@@ -155,7 +154,6 @@ def is_ci_environment() -> bool:
155154
"HAS_PYARROW",
156155
"IS64",
157156
"ISMUSL",
158-
"PY311",
159157
"PY312",
160158
"PYPY",
161159
"WASM",

pandas/compat/_constants.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,15 @@
1313

1414
IS64 = sys.maxsize > 2**32
1515

16-
PY311 = sys.version_info >= (3, 11)
1716
PY312 = sys.version_info >= (3, 12)
1817
PYPY = platform.python_implementation() == "PyPy"
1918
WASM = (sys.platform == "emscripten") or (platform.machine() in ["wasm32", "wasm64"])
2019
ISMUSL = "musl" in (sysconfig.get_config_var("HOST_GNU_TYPE") or "")
21-
REF_COUNT = 2 if PY311 else 3
20+
REF_COUNT = 2
2221

2322
__all__ = [
2423
"IS64",
2524
"ISMUSL",
26-
"PY311",
2725
"PY312",
2826
"PYPY",
2927
"WASM",

pandas/tests/arrays/categorical/test_api.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import numpy as np
44
import pytest
55

6-
from pandas.compat import PY311
7-
86
from pandas import (
97
Categorical,
108
CategoricalIndex,
@@ -47,11 +45,7 @@ def test_set_ordered(self):
4745
assert not cat2.set_ordered(False).ordered
4846

4947
# removed in 0.19.0
50-
msg = (
51-
"property 'ordered' of 'Categorical' object has no setter"
52-
if PY311
53-
else "can't set attribute"
54-
)
48+
msg = "property 'ordered' of 'Categorical' object has no setter"
5549
with pytest.raises(AttributeError, match=msg):
5650
cat.ordered = True
5751
with pytest.raises(AttributeError, match=msg):
@@ -435,11 +429,7 @@ def test_codes_immutable(self):
435429
tm.assert_numpy_array_equal(c.codes, exp)
436430

437431
# Assignments to codes should raise
438-
msg = (
439-
"property 'codes' of 'Categorical' object has no setter"
440-
if PY311
441-
else "can't set attribute"
442-
)
432+
msg = "property 'codes' of 'Categorical' object has no setter"
443433
with pytest.raises(AttributeError, match=msg):
444434
c.codes = np.array([0, 1, 2, 0, 1], dtype="int8")
445435

pandas/tests/extension/test_arrow.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
from pandas._libs import lib
3636
from pandas._libs.tslibs import timezones
3737
from pandas.compat import (
38-
PY311,
3938
PY312,
4039
is_ci_environment,
4140
is_platform_windows,
@@ -344,13 +343,7 @@ def test_from_sequence_pa_array_notimplemented(self, request):
344343

345344
def test_from_sequence_of_strings_pa_array(self, data, request):
346345
pa_dtype = data.dtype.pyarrow_dtype
347-
if pa.types.is_time64(pa_dtype) and pa_dtype.equals("time64[ns]") and not PY311:
348-
request.applymarker(
349-
pytest.mark.xfail(
350-
reason="Nanosecond time parsing not supported.",
351-
)
352-
)
353-
elif pa.types.is_timestamp(pa_dtype) and pa_dtype.tz is not None:
346+
if pa.types.is_timestamp(pa_dtype) and pa_dtype.tz is not None:
354347
_require_timezone_database(request)
355348

356349
pa_array = data._pa_array.cast(pa.string())

pandas/tests/indexes/multi/test_get_set.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import numpy as np
22
import pytest
33

4-
from pandas.compat import PY311
5-
64
from pandas.core.dtypes.dtypes import DatetimeTZDtype
75

86
import pandas as pd
@@ -150,11 +148,7 @@ def test_set_levels_codes_directly(idx):
150148
with pytest.raises(AttributeError, match=msg):
151149
idx.levels = new_levels
152150

153-
msg = (
154-
"property 'codes' of 'MultiIndex' object has no setter"
155-
if PY311
156-
else "can't set attribute"
157-
)
151+
msg = "property 'codes' of 'MultiIndex' object has no setter"
158152
with pytest.raises(AttributeError, match=msg):
159153
idx.codes = new_codes
160154

pandas/tests/indexes/period/test_freq_attr.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import pytest
22

3-
from pandas.compat import PY311
4-
53
from pandas import (
64
offsets,
75
period_range,
@@ -19,10 +17,6 @@ def test_freq_setter_deprecated(self):
1917
idx.freq
2018

2119
# warning for setter
22-
msg = (
23-
"property 'freq' of 'PeriodArray' object has no setter"
24-
if PY311
25-
else "can't set attribute"
26-
)
20+
msg = "property 'freq' of 'PeriodArray' object has no setter"
2721
with pytest.raises(AttributeError, match=msg):
2822
idx.freq = offsets.Day()

pandas/tests/io/parser/common/test_read_errors.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import numpy as np
1313
import pytest
1414

15-
from pandas.compat import PY311
1615
from pandas.errors import (
1716
EmptyDataError,
1817
ParserError,
@@ -227,12 +226,10 @@ def test_null_byte_char(request, all_parsers):
227226
names = ["a", "b"]
228227
parser = all_parsers
229228

230-
if parser.engine == "c" or (parser.engine == "python" and PY311):
231-
if parser.engine == "python" and PY311:
229+
if parser.engine in ["c", "python"]:
230+
if parser.engine == "python":
232231
request.applymarker(
233-
pytest.mark.xfail(
234-
reason="In Python 3.11, this is read as an empty character not null"
235-
)
232+
pytest.mark.xfail(reason="This is read as an empty character not null")
236233
)
237234
expected = DataFrame([[np.nan, "foo"]], columns=names)
238235
out = parser.read_csv(StringIO(data), names=names)

0 commit comments

Comments
 (0)