Skip to content

Commit fea5c47

Browse files
committed
_colorize: modernize typing imports
1 parent 884ac3e commit fea5c47

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

Lib/_colorize.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44

55
from collections.abc import Callable, Iterator, Mapping
66
from dataclasses import dataclass, field, Field
7+
lazy from typing import IO, Literal, Self, ClassVar
78

89
COLORIZE = True
910

10-
11-
# types
12-
if False:
13-
from typing import IO, Literal, Self, ClassVar
14-
_theme: Theme
11+
_theme: Theme
12+
type BackgroundStyle = Literal["dark", "light"]
1513

1614

1715
class ANSIColors:
@@ -319,7 +317,7 @@ class LiveProfiler(ThemeSection):
319317
medal_bronze_fg: int = CursesColors.GREEN
320318

321319
# Background style: 'dark' or 'light'
322-
background_style: Literal["dark", "light"] = "dark"
320+
background_style: BackgroundStyle = "dark"
323321

324322

325323
LiveProfilerLight = LiveProfiler(

Lib/test/test__colorize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class TestImportTime(unittest.TestCase):
2828
@cpython_only
2929
def test_lazy_import(self):
3030
import_helper.ensure_lazy_imports(
31-
"_colorize", {"copy", "re", "inspect"}
31+
"_colorize", {"copy", "re", "inspect", "typing"}
3232
)
3333

3434

0 commit comments

Comments
 (0)