[stdlib] Add missing Final (#14613)

This commit is contained in:
Semyon Moroz
2025-08-21 12:18:20 +02:00
committed by GitHub
parent 9b5b3ecb0a
commit 9bb8c4f1f9
30 changed files with 197 additions and 187 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import sys
from _typeshed import ReadableBuffer, StrPath, SupportsRead, _T_co
from collections.abc import Iterable
from typing import Protocol, type_check_only
from typing import Final, Protocol, type_check_only
from typing_extensions import TypeAlias
from xml.sax._exceptions import (
SAXException as SAXException,
@@ -19,7 +19,7 @@ class _SupportsReadClose(SupportsRead[_T_co], Protocol[_T_co]):
_Source: TypeAlias = StrPath | _SupportsReadClose[bytes] | _SupportsReadClose[str]
default_parser_list: list[str]
default_parser_list: Final[list[str]]
def make_parser(parser_list: Iterable[str] = ()) -> XMLReader: ...
def parse(source: _Source, handler: ContentHandler, errorHandler: ErrorHandler = ...) -> None: ...
+2 -2
View File
@@ -1,7 +1,7 @@
import sys
from _typeshed import ReadableBuffer
from collections.abc import Mapping
from typing import Any, Literal, overload
from typing import Any, Final, Literal, overload
from typing_extensions import TypeAlias
from xml.sax import _Source, xmlreader
from xml.sax.handler import _ContentHandlerProtocol
@@ -11,7 +11,7 @@ if sys.version_info >= (3, 10):
_BoolType: TypeAlias = Literal[0, 1] | bool
version: str
version: Final[str]
AttributesImpl = xmlreader.AttributesImpl
AttributesNSImpl = xmlreader.AttributesNSImpl
+16 -16
View File
@@ -1,8 +1,8 @@
import sys
from typing import Literal, NoReturn, Protocol, type_check_only
from typing import Final, NoReturn, Protocol, type_check_only
from xml.sax import xmlreader
version: str
version: Final[str]
@type_check_only
class _ErrorHandlerProtocol(Protocol): # noqa: Y046 # Protocol is not used
@@ -62,20 +62,20 @@ class _EntityResolverProtocol(Protocol): # noqa: Y046 # Protocol is not used
class EntityResolver:
def resolveEntity(self, publicId: str | None, systemId: str) -> str: ...
feature_namespaces: str
feature_namespace_prefixes: str
feature_string_interning: str
feature_validation: str
feature_external_ges: str
feature_external_pes: str
all_features: list[str]
property_lexical_handler: Literal["http://xml.org/sax/properties/lexical-handler"]
property_declaration_handler: Literal["http://xml.org/sax/properties/declaration-handler"]
property_dom_node: Literal["http://xml.org/sax/properties/dom-node"]
property_xml_string: Literal["http://xml.org/sax/properties/xml-string"]
property_encoding: Literal["http://www.python.org/sax/properties/encoding"]
property_interning_dict: Literal["http://www.python.org/sax/properties/interning-dict"]
all_properties: list[str]
feature_namespaces: Final = "http://xml.org/sax/features/namespaces"
feature_namespace_prefixes: Final = "http://xml.org/sax/features/namespace-prefixes"
feature_string_interning: Final = "http://xml.org/sax/features/string-interning"
feature_validation: Final = "http://xml.org/sax/features/validation"
feature_external_ges: Final[str] # too long string
feature_external_pes: Final[str] # too long string
all_features: Final[list[str]]
property_lexical_handler: Final = "http://xml.org/sax/properties/lexical-handler"
property_declaration_handler: Final = "http://xml.org/sax/properties/declaration-handler"
property_dom_node: Final = "http://xml.org/sax/properties/dom-node"
property_xml_string: Final = "http://xml.org/sax/properties/xml-string"
property_encoding: Final = "http://www.python.org/sax/properties/encoding"
property_interning_dict: Final[str] # too long string
all_properties: Final[list[str]]
if sys.version_info >= (3, 10):
class LexicalHandler: