Skip to content

Commit 826716f

Browse files
committed
add future annotations
1 parent bdd9314 commit 826716f

33 files changed

+103
-48
lines changed

.pre-commit-config.yaml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ repos:
9494
stages: [manual]
9595
additional_dependencies: &pyright_dependencies
9696
97-
- repo: local
98-
hooks:
9997
- id: pyright_reportGeneralTypeIssues
10098
name: pyright reportGeneralTypeIssues
10199
entry: pyright --skipunannotated -p pyright_reportGeneralTypeIssues.json
@@ -105,8 +103,6 @@ repos:
105103
types: [python]
106104
stages: [manual]
107105
additional_dependencies: *pyright_dependencies
108-
- repo: local
109-
hooks:
110106
- id: mypy
111107
name: mypy
112108
entry: mypy
@@ -115,8 +111,6 @@ repos:
115111
pass_filenames: false
116112
types: [python]
117113
stages: [manual]
118-
- repo: local
119-
hooks:
120114
- id: flake8-rst
121115
name: flake8-rst
122116
description: Run flake8 on code snippets in docstrings or RST files
@@ -237,3 +231,15 @@ repos:
237231
additional_dependencies:
238232
- flake8==4.0.1
239233
- flake8-pyi==22.5.1
234+
- id: future-annotations
235+
name: import annotations from __future__
236+
entry: 'from __future__ import annotations'
237+
language: pygrep
238+
args: [--negate]
239+
files: ^pandas/
240+
types: [python]
241+
exclude: |
242+
(?x)
243+
/(__init__\.py)|(api\.py)|(_version\.py)$
244+
|/tests/
245+
|/_testing/

pandas/_config/dates.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
22
config for datetime formatting
33
"""
4+
from __future__ import annotations
5+
46
from pandas._config import config as cf
57

68
pc_date_dayfirst_doc = """

pandas/compat/chainmap.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from typing import (
24
ChainMap,
35
TypeVar,

pandas/compat/pyarrow.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
""" support pyarrow compatibility across versions """
22

3+
from __future__ import annotations
4+
35
from pandas.util.version import Version
46

57
try:

pandas/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
- Misc
1919
"""
2020

21+
from __future__ import annotations
22+
2123
from collections import abc
2224
from datetime import (
2325
date,

pandas/core/_numba/kernels/shared.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import numba
24
import numpy as np
35

pandas/core/array_algos/transforms.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
transforms.py is for shape-preserving functions.
33
"""
44

5+
from __future__ import annotations
6+
57
import numpy as np
68

79

pandas/core/arraylike.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Index
55
ExtensionArray
66
"""
7+
from __future__ import annotations
8+
79
import operator
810
from typing import Any
911
import warnings

pandas/core/computation/check.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from pandas.compat._optional import import_optional_dependency
24

35
ne = import_optional_dependency("numexpr", errors="warn")

pandas/core/computation/common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from functools import reduce
24

35
import numpy as np

0 commit comments

Comments
 (0)