Skip to content

Commit 7fc4089

Browse files
Remove Python 3.10+ redundant patterns
- Remove `from __future__ import annotations` (default in Python 3.10+) - Remove TYPE_CHECKING guard for Final imports (not needed in 3.10+) - Import Final directly from typing module - Use forward references for IniConfig in SectionWrapper These patterns are no longer needed since we require Python >= 3.10 and PEP 563 postponed evaluation is the default. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1dab01a commit 7fc4089

File tree

4 files changed

+4
-18
lines changed

4 files changed

+4
-18
lines changed

src/iniconfig/__init__.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,14 @@
22
(C) Ronny Pfannschmidt, Holger Krekel -- MIT licensed
33
"""
44

5-
from __future__ import annotations
6-
75
import os
86
from collections.abc import Callable
97
from collections.abc import Iterator
108
from collections.abc import Mapping
11-
from typing import TYPE_CHECKING
9+
from typing import Final
1210
from typing import TypeVar
1311
from typing import overload
1412

15-
if TYPE_CHECKING:
16-
from typing import Final
17-
1813
__all__ = ["IniConfig", "ParseError", "COMMENTCHARS", "iscommentline"]
1914

2015
from . import _parse
@@ -27,10 +22,10 @@
2722

2823

2924
class SectionWrapper:
30-
config: Final[IniConfig]
25+
config: Final["IniConfig"]
3126
name: Final[str]
3227

33-
def __init__(self, config: IniConfig, name: str) -> None:
28+
def __init__(self, config: "IniConfig", name: str) -> None:
3429
self.config = config
3530
self.name = name
3631

src/iniconfig/_parse.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import annotations
2-
31
from typing import NamedTuple
42

53
from .exceptions import ParseError

src/iniconfig/exceptions.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
from __future__ import annotations
2-
3-
from typing import TYPE_CHECKING
4-
5-
if TYPE_CHECKING:
6-
from typing import Final
1+
from typing import Final
72

83

94
class ParseError(Exception):

testing/test_iniconfig.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import annotations
2-
31
from pathlib import Path
42
from textwrap import dedent
53

0 commit comments

Comments
 (0)