Skip to content

Commit 7fe950a

Browse files
nstarmanclaude
andcommitted
♻️ refactor: drop from __future__ import annotations
No longer needed now that the minimum supported Python is 3.10. Forward references in `_core.py` (`Comparator`, `OptionalDependencyEnum`) are quoted since they are now evaluated at runtime. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent a53f087 commit 7fe950a

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

src/optional_dependencies/_core.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
"""Optional dependencies."""
22

3-
from __future__ import annotations
4-
53
__all__: list[str] = []
64

75
import operator
6+
from collections.abc import Callable
87
from dataclasses import dataclass
98
from enum import Enum
109
from types import MethodType
11-
from typing import Callable, Literal, cast
10+
from typing import Literal, cast
1211

1312
from packaging.utils import canonicalize_name
1413
from packaging.version import Version
@@ -25,9 +24,9 @@ class Comparator:
2524

2625
def __get__(
2726
self,
28-
instance: OptionalDependencyEnum | None,
29-
owner: type[OptionalDependencyEnum] | None,
30-
) -> Comparator | MethodType:
27+
instance: "OptionalDependencyEnum | None",
28+
owner: "type[OptionalDependencyEnum] | None",
29+
) -> "Comparator | MethodType":
3130
"""Get the descriptor.
3231
3332
Parameters
@@ -49,7 +48,7 @@ def __get__(
4948
# Bind the descriptor to the instance
5049
return MethodType(self.__call__, instance)
5150

52-
def __call__(self, enum: OptionalDependencyEnum, other: object) -> bool:
51+
def __call__(self, enum: "OptionalDependencyEnum", other: object) -> bool:
5352
"""Compare two versions.
5453
5554
Returns

src/optional_dependencies/utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Optional dependencies."""
22

3-
from __future__ import annotations
4-
53
__all__ = [
64
"InstalledState",
75
"NOT_INSTALLED",

0 commit comments

Comments
 (0)