@@ -3593,7 +3593,7 @@ async def reset_synonyms(self) -> TaskInfo:
35933593
35943594 return TaskInfo (** response .json ())
35953595
3596- async def get_filterable_attributes (self ) -> list [str ] | list [ FilterableAttributes ] | None :
3596+ async def get_filterable_attributes (self ) -> list [str | FilterableAttributes ] | None :
35973597 """Get filterable attributes of the index.
35983598
35993599 Returns:
@@ -3616,22 +3616,22 @@ async def get_filterable_attributes(self) -> list[str] | list[FilterableAttribut
36163616
36173617 response_json = response .json ()
36183618
3619- if isinstance (response_json [0 ], str ):
3620- return response_json
3621-
3622- filterable_attributes = []
3619+ filterable_attributes : list [str | FilterableAttributes ] = []
36233620 for r in response_json :
3624- filterable_attributes .append (
3625- FilterableAttributes (
3626- attribute_patterns = r ["attributePatterns" ],
3627- features = FilterableAttributeFeatures (** r ["features" ]),
3621+ if isinstance (r , str ):
3622+ filterable_attributes .append (r )
3623+ else :
3624+ filterable_attributes .append (
3625+ FilterableAttributes (
3626+ attribute_patterns = r ["attributePatterns" ],
3627+ features = FilterableAttributeFeatures (** r ["features" ]),
3628+ )
36283629 )
3629- )
36303630
36313631 return filterable_attributes
36323632
36333633 async def update_filterable_attributes (
3634- self , body : list [str ] | list [ FilterableAttributes ], * , compress : bool = False
3634+ self , body : list [str | FilterableAttributes ], * , compress : bool = False
36353635 ) -> TaskInfo :
36363636 """Update filterable attributes of the index.
36373637
@@ -7224,7 +7224,7 @@ def reset_synonyms(self) -> TaskInfo:
72247224
72257225 return TaskInfo (** response .json ())
72267226
7227- def get_filterable_attributes (self ) -> list [str ] | list [ FilterableAttributes ] | None :
7227+ def get_filterable_attributes (self ) -> list [str | FilterableAttributes ] | None :
72287228 """Get filterable attributes of the index.
72297229
72307230 Returns:
@@ -7247,22 +7247,22 @@ def get_filterable_attributes(self) -> list[str] | list[FilterableAttributes] |
72477247
72487248 response_json = response .json ()
72497249
7250- if isinstance (response_json [0 ], str ):
7251- return response_json
7252-
7253- filterable_attributes = []
7250+ filterable_attributes : list [str | FilterableAttributes ] = []
72547251 for r in response_json :
7255- filterable_attributes .append (
7256- FilterableAttributes (
7257- attribute_patterns = r ["attributePatterns" ],
7258- features = FilterableAttributeFeatures (** r ["features" ]),
7252+ if isinstance (r , str ):
7253+ filterable_attributes .append (r )
7254+ else :
7255+ filterable_attributes .append (
7256+ FilterableAttributes (
7257+ attribute_patterns = r ["attributePatterns" ],
7258+ features = FilterableAttributeFeatures (** r ["features" ]),
7259+ )
72597260 )
7260- )
72617261
72627262 return filterable_attributes
72637263
72647264 def update_filterable_attributes (
7265- self , body : list [str ] | list [ FilterableAttributes ], * , compress : bool = False
7265+ self , body : list [str | FilterableAttributes ], * , compress : bool = False
72667266 ) -> TaskInfo :
72677267 """Update filterable attributes of the index.
72687268
0 commit comments