1
1
from __future__ import annotations
2
2
from msrc .appconfig .schema import (
3
3
Element , AtomicType , TupleType , Schema , SchemaSource )
4
- from typing import Optional , Tuple , Union , Type , cast
4
+ from typing import Optional , Tuple , Union , Type , Any , cast
5
5
import param
6
6
import enum
7
7
@@ -14,8 +14,8 @@ class IntTuple(param.NumericTuple):
14
14
def _validate (self , val : object ):
15
15
super ()._validate (val )
16
16
# NumeriTuple ensures val is a numeric tuple
17
- val = cast (Tuple [object , ...], val )
18
17
if val is not None :
18
+ val = cast (Tuple [object , ...], val )
19
19
for i , n in enumerate (val ):
20
20
if not isinstance (n , int ):
21
21
raise ValueError (
@@ -55,7 +55,9 @@ def make_element(
55
55
t = TupleType (AtomicType .INT , f .length )
56
56
elif isinstance (f , param .NumericTuple ):
57
57
t = TupleType (AtomicType .FLOAT , f .length )
58
- elif isinstance (f , param .List ) and f .class_ is None :
58
+ # pyright 1.1.292 inference makes param.List.class_ be Type[object]
59
+ # which is incorrect.
60
+ elif isinstance (f , param .List ) and cast (Any , f .class_ ) is None :
59
61
raise ValueError ("List parameter %s doesn't specify type of "
60
62
"list items using class_ keyword." )
61
63
elif isinstance (f , param .List ) and issubclass (f .class_ , bool ):
0 commit comments