Skip to content

Commit b943f31

Browse files
authored
logging.config: Add @type_check_only markers (#13674)
1 parent 5a8f8aa commit b943f31

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

stdlib/logging/config.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from collections.abc import Callable, Hashable, Iterable, Mapping, Sequence
44
from configparser import RawConfigParser
55
from re import Pattern
66
from threading import Thread
7-
from typing import IO, Any, Final, Literal, SupportsIndex, TypedDict, overload
7+
from typing import IO, Any, Final, Literal, SupportsIndex, TypedDict, overload, type_check_only
88
from typing_extensions import Required, TypeAlias
99

1010
from . import Filter, Filterer, Formatter, Handler, Logger, _FilterType, _FormatStyle, _Level
@@ -14,24 +14,28 @@ RESET_ERROR: Final[int] # undocumented
1414
IDENTIFIER: Final[Pattern[str]] # undocumented
1515

1616
if sys.version_info >= (3, 11):
17+
@type_check_only
1718
class _RootLoggerConfiguration(TypedDict, total=False):
1819
level: _Level
1920
filters: Sequence[str | _FilterType]
2021
handlers: Sequence[str]
2122

2223
else:
24+
@type_check_only
2325
class _RootLoggerConfiguration(TypedDict, total=False):
2426
level: _Level
2527
filters: Sequence[str]
2628
handlers: Sequence[str]
2729

30+
@type_check_only
2831
class _LoggerConfiguration(_RootLoggerConfiguration, TypedDict, total=False):
2932
propagate: bool
3033

3134
_FormatterConfigurationTypedDict = TypedDict(
3235
"_FormatterConfigurationTypedDict", {"class": str, "format": str, "datefmt": str, "style": _FormatStyle}, total=False
3336
)
3437

38+
@type_check_only
3539
class _FilterConfigurationTypedDict(TypedDict):
3640
name: str
3741

@@ -43,6 +47,7 @@ _FilterConfiguration: TypeAlias = _FilterConfigurationTypedDict | dict[str, Any]
4347
# Handler config can have additional keys even when not providing a custom factory so we just use `dict`.
4448
_HandlerConfiguration: TypeAlias = dict[str, Any]
4549

50+
@type_check_only
4651
class _DictConfigArgs(TypedDict, total=False):
4752
version: Required[Literal[1]]
4853
formatters: dict[str, _FormatterConfiguration]

0 commit comments

Comments
 (0)