mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-07-21 12:41:10 +02:00
Add typing for context managers returning Self
`Self` was introduced in python 3.11. Use `Self` from typing_extensions for previous Python versions
This commit is contained in:
committed by
Scott Talbert
parent
15c6e01231
commit
b5e5cb419a
@@ -32,6 +32,10 @@ from .constants import CPP_ITEMS, VERSION, VALUE_MAP
|
||||
from .constants import RE_KEEP_SPACES, EXTERN_INHERITANCE
|
||||
from .constants import DOXYROOT, SPHINXROOT, WIDGETS_IMAGES_ROOT
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import Self
|
||||
else:
|
||||
from typing_extensions import Self
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
@@ -622,7 +626,7 @@ class PickleFile(object):
|
||||
def __init__(self, fileName):
|
||||
self.fileName = fileName
|
||||
|
||||
def __enter__(self):
|
||||
def __enter__(self) -> Self:
|
||||
self.read()
|
||||
return self
|
||||
|
||||
|
Reference in New Issue
Block a user