Skip to content

Commit 2afcddc

Browse files
committed
Fix annotations of _colorize.FancyCompleter
1 parent 8a466fa commit 2afcddc

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

Lib/_colorize.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import builtins
12
import os
23
import sys
34

@@ -202,25 +203,25 @@ class Difflib(ThemeSection):
202203
@dataclass(frozen=True, kw_only=True)
203204
class FancyCompleter(ThemeSection):
204205
# functions and methods
205-
function: str = ANSIColors.BOLD_BLUE
206-
builtin_function_or_method: str = ANSIColors.BOLD_BLUE
207-
method: str = ANSIColors.BOLD_CYAN
208-
method_wrapper: str = ANSIColors.BOLD_CYAN
209-
wrapper_descriptor: str = ANSIColors.BOLD_CYAN
210-
method_descriptor: str = ANSIColors.BOLD_CYAN
206+
function: builtins.str = ANSIColors.BOLD_BLUE
207+
builtin_function_or_method: builtins.str = ANSIColors.BOLD_BLUE
208+
method: builtins.str = ANSIColors.BOLD_CYAN
209+
method_wrapper: builtins.str = ANSIColors.BOLD_CYAN
210+
wrapper_descriptor: builtins.str = ANSIColors.BOLD_CYAN
211+
method_descriptor: builtins.str = ANSIColors.BOLD_CYAN
211212

212213
# numbers
213-
int: str = ANSIColors.BOLD_YELLOW
214-
float: str = ANSIColors.BOLD_YELLOW
215-
complex: str = ANSIColors.BOLD_YELLOW
216-
bool: str = ANSIColors.BOLD_YELLOW
214+
int: builtins.str = ANSIColors.BOLD_YELLOW
215+
float: builtins.str = ANSIColors.BOLD_YELLOW
216+
complex: builtins.str = ANSIColors.BOLD_YELLOW
217+
bool: builtins.str = ANSIColors.BOLD_YELLOW
217218

218219
# others
219-
type: str = ANSIColors.BOLD_MAGENTA
220-
module: str = ANSIColors.CYAN
221-
NoneType: str = ANSIColors.GREY
222-
bytes: str = ANSIColors.BOLD_GREEN
223-
str: str = ANSIColors.BOLD_GREEN
220+
type: builtins.str = ANSIColors.BOLD_MAGENTA
221+
module: builtins.str = ANSIColors.CYAN
222+
NoneType: builtins.str = ANSIColors.GREY
223+
bytes: builtins.str = ANSIColors.BOLD_GREEN
224+
str: builtins.str = ANSIColors.BOLD_GREEN
224225

225226

226227
@dataclass(frozen=True, kw_only=True)

Lib/test/test__colorize.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import unittest
66
import unittest.mock
77
import _colorize
8+
from test.support import cpython_only, import_helper
89
from test.support.os_helper import EnvironmentVarGuard
910

1011

@@ -22,6 +23,15 @@ def supports_virtual_terminal():
2223
return contextlib.nullcontext()
2324

2425

26+
class TestImportTime(unittest.TestCase):
27+
28+
@cpython_only
29+
def test_lazy_import(self):
30+
import_helper.ensure_lazy_imports(
31+
"_colorize", {"re", "copy"}
32+
)
33+
34+
2535
class TestTheme(unittest.TestCase):
2636

2737
def test_attributes(self):

0 commit comments

Comments
 (0)