Updated IfThenElse so that it represents the real implementation
This commit is contained in:
parent
ceb4b67ff8
commit
349c8e5dd2
1 changed files with 10 additions and 10 deletions
|
|
@ -767,23 +767,23 @@ ThenBuildTypes = t.TypeVar("ThenBuildTypes")
|
|||
ElseParsedType = t.TypeVar("ElseParsedType")
|
||||
ElseBuildTypes = t.TypeVar("ElseBuildTypes")
|
||||
|
||||
# This does not represent the original code, but it is the only solution that works good with pyright
|
||||
class _IfThenElse(Construct[ParsedType, BuildTypes]):
|
||||
class IfThenElse(Construct[ParsedType, BuildTypes]):
|
||||
condfunc: ConstantOrContextLambda[bool]
|
||||
thensubcon: Construct[ParsedType, BuildTypes]
|
||||
elsesubcon: Construct[ParsedType, BuildTypes]
|
||||
def __new__(
|
||||
cls,
|
||||
condfunc: ConstantOrContextLambda[bool],
|
||||
thensubcon: Construct[ThenParsedType, ThenBuildTypes],
|
||||
elsesubcon: Construct[ElseParsedType, ElseBuildTypes],
|
||||
) -> IfThenElse[
|
||||
t.Union[ThenParsedType, ElseParsedType], t.Union[ThenBuildTypes, ElseBuildTypes]
|
||||
]: ...
|
||||
|
||||
def IfThenElse(
|
||||
condfunc: ConstantOrContextLambda[bool],
|
||||
thensubcon: Construct[ThenParsedType, ThenBuildTypes],
|
||||
elsesubcon: Construct[ElseParsedType, ElseBuildTypes],
|
||||
) -> _IfThenElse[
|
||||
t.Union[ThenParsedType, ElseParsedType], t.Union[ThenBuildTypes, ElseBuildTypes]
|
||||
]: ...
|
||||
def If(
|
||||
condfunc: ConstantOrContextLambda[bool],
|
||||
subcon: Construct[ThenParsedType, ThenBuildTypes],
|
||||
) -> _IfThenElse[t.Union[ThenParsedType, None], t.Union[ThenBuildTypes, None]]: ...
|
||||
) -> IfThenElse[t.Union[ThenParsedType, None], t.Union[ThenBuildTypes, None]]: ...
|
||||
|
||||
SwitchType = t.TypeVar("SwitchType")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue