Add @final to many unsubclassable stdlib classes (#6299)

This commit is contained in:
Alex Waygood
2021-11-15 13:45:24 +00:00
committed by GitHub
parent 5b94c6a94d
commit 10c9d8cfce
17 changed files with 48 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
from typing import Any
from typing_extensions import Literal
from typing_extensions import Literal, final
# _tkinter is meant to be only used internally by tkinter, but some tkinter
# functions e.g. return _tkinter.Tcl_Obj objects. Tcl_Obj represents a Tcl
@@ -14,6 +14,7 @@ from typing_extensions import Literal
# >>> text.tag_add('foo', '1.0', 'end')
# >>> text.tag_ranges('foo')
# (<textindex object: '1.0'>, <textindex object: '2.0'>)
@final
class Tcl_Obj:
string: str # str(tclobj) returns this
typename: str
@@ -37,6 +38,7 @@ class TclError(Exception): ...
#
# eval always returns str because _tkinter_tkapp_eval_impl in _tkinter.c calls
# Tkapp_UnicodeResult, and it returns a string when it succeeds.
@final
class TkappType:
# Please keep in sync with tkinter.Tk
def call(self, __command: Any, *args: Any) -> Any: ...