@@ -90,9 +90,12 @@ def __new__(
90
90
# TODO: Support more index subtypes
91
91
from bigframes .core .indexes .multi import MultiIndex
92
92
93
- klass = MultiIndex if len (block ._index_columns ) > 1 else cls
94
- # TODO(b/340893286): fix type error
95
- result = typing .cast (Index , object .__new__ (klass )) # type: ignore
93
+ if len (block ._index_columns ) <= 1 :
94
+ klass = cls
95
+ else :
96
+ klass = MultiIndex
97
+
98
+ result = typing .cast (Index , object .__new__ (klass ))
96
99
result ._query_job = None
97
100
result ._block = block
98
101
block .session ._register_object (result )
@@ -161,7 +164,8 @@ def dtype(self):
161
164
@property
162
165
def dtypes (self ) -> pandas .Series :
163
166
return pandas .Series (
164
- data = self ._block .index .dtypes , index = self ._block .index .names # type:ignore
167
+ data = self ._block .index .dtypes ,
168
+ index = typing .cast (typing .Tuple , self ._block .index .names ),
165
169
)
166
170
167
171
@property
@@ -408,10 +412,10 @@ def drop(
408
412
block = block .drop_columns ([condition_id ])
409
413
return Index (block )
410
414
411
- def dropna (self , how : str = "any" ) -> Index :
415
+ def dropna (self , how : typing . Literal [ "all" , "any" ] = "any" ) -> Index :
412
416
if how not in ("any" , "all" ):
413
417
raise ValueError ("'how' must be one of 'any', 'all'" )
414
- result = block_ops .dropna (self ._block , self ._block .index_columns , how = how ) # type: ignore
418
+ result = block_ops .dropna (self ._block , self ._block .index_columns , how = how )
415
419
return Index (result )
416
420
417
421
def drop_duplicates (self , * , keep : str = "first" ) -> Index :
0 commit comments