11import logging
22import re
3- from typing import Final , Protocol , TypeAlias , overload
3+ from typing import Final , Protocol , TypeAlias , overload , type_check_only
44from typing_extensions import LiteralString
55
66import regex
77
8- Pattern : TypeAlias = re .Pattern [str ] | regex .Pattern [str ]
8+ _Pattern : TypeAlias = re .Pattern [str ] | regex .Pattern [str ]
99
1010__all__ = ["titlecase" ]
1111__version__ : Final [str ]
@@ -16,20 +16,21 @@ REGEX_AVAILABLE: Final[bool]
1616SMALL : Final [str ]
1717PUNCT : Final [str ]
1818
19- SMALL_WORDS : Pattern
20- SMALL_FIRST : Pattern
21- SMALL_LAST : Pattern
22- SUBPHRASE : Pattern
23-
24- MAC_MC : Final [Pattern ]
25- MR_MRS_MS_DR : Final [Pattern ]
26- INLINE_PERIOD : Final [Pattern ]
27- UC_ELSEWHERE : Final [Pattern ]
28- CAPFIRST : Final [Pattern ]
29- APOS_SECOND : Final [Pattern ]
30- UC_INITIALS : Final [Pattern ]
31-
32- class CallbackProtocol (Protocol ):
19+ SMALL_WORDS : _Pattern
20+ SMALL_FIRST : _Pattern
21+ SMALL_LAST : _Pattern
22+ SUBPHRASE : _Pattern
23+
24+ MAC_MC : Final [_Pattern ]
25+ MR_MRS_MS_DR : Final [_Pattern ]
26+ INLINE_PERIOD : Final [_Pattern ]
27+ UC_ELSEWHERE : Final [_Pattern ]
28+ CAPFIRST : Final [_Pattern ]
29+ APOS_SECOND : Final [_Pattern ]
30+ UC_INITIALS : Final [_Pattern ]
31+
32+ @type_check_only
33+ class _CallbackProtocol (Protocol ):
3334 def __call__ (self , word : str , / , * , all_caps : bool ) -> str | None : ...
3435
3536class Immutable : ...
@@ -42,7 +43,7 @@ def set_small_word_list() -> None: ...
4243def set_small_word_list (small : str ) -> None : ...
4344
4445def titlecase (
45- text : str , callback : CallbackProtocol | None = None , small_first_last : bool = True , preserve_blank_lines : bool = False
46+ text : str , callback : _CallbackProtocol | None = None , small_first_last : bool = True , preserve_blank_lines : bool = False
4647) -> LiteralString : ...
47- def create_wordlist_filter_from_file (file_path : str | None ) -> CallbackProtocol : ...
48+ def create_wordlist_filter_from_file (file_path : str | None ) -> _CallbackProtocol : ...
4849def cmd () -> None : ...
0 commit comments