Skip to content

Commit c405d09

Browse files
author
Tim Riddermann
committed
fixed error message from EnumBase and FlagsEnumBase that occures since pyright v1.1.320
1 parent af98d20 commit c405d09

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

construct_typed/tenum.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import enum
22
import typing as t
33

4+
from typing_extensions import Self
5+
46
from .generic_wrapper import *
57

68

@@ -45,7 +47,7 @@ class EnumBase(enum.IntEnum):
4547
'This is the running state.'
4648
"""
4749

48-
def __new__(cls, val: t.Union[EnumValue, int]) -> "EnumBase":
50+
def __new__(cls, val: t.Union[EnumValue, int]) -> "Self":
4951
if isinstance(val, EnumValue):
5052
obj = int.__new__(cls, val.value)
5153
obj._value_ = val.value
@@ -158,7 +160,7 @@ class FlagsEnumBase(enum.IntFlag):
158160
'This is option two.'
159161
"""
160162

161-
def __new__(cls, val: t.Union[EnumValue, int]) -> "FlagsEnumBase":
163+
def __new__(cls, val: t.Union[EnumValue, int]) -> "Self":
162164
if isinstance(val, EnumValue):
163165
obj = int.__new__(cls, val.value)
164166
obj._value_ = val.value

0 commit comments

Comments
 (0)