@@ -29,7 +29,7 @@ def __init__(
2929 self ,
3030 name : str ,
3131 prefix : str = "rvl" ,
32- storage_type : Optional [ str ] = "hash" ,
32+ storage_type : str = "hash" ,
3333 fields : Optional [List ["Field" ]] = None ,
3434 ):
3535 self ._name = name
@@ -62,7 +62,7 @@ def search(self, *args, **kwargs) -> List["Result"]:
6262 Returns:
6363 List[Result]: A list of search results
6464 """
65- results : List ["Result" ] = self ._redis_conn .ft (self ._name ).search (
65+ results : List ["Result" ] = self ._redis_conn .ft (self ._name ).search ( # type: ignore
6666 * args , ** kwargs
6767 )
6868 return results
@@ -148,7 +148,7 @@ def disconnect(self):
148148 """Disconnect from the Redis instance"""
149149 self ._redis_conn = None
150150
151- def _get_key (self , record : Dict [str , Any ], key_field : str = None ) -> str :
151+ def _get_key (self , record : Dict [str , Any ], key_field : Optional [ str ] = None ) -> str :
152152 """Construct the Redis HASH top level key.
153153
154154 Args:
@@ -236,7 +236,7 @@ def __init__(
236236 self ,
237237 name : str ,
238238 prefix : str = "rvl" ,
239- storage_type : Optional [ str ] = "hash" ,
239+ storage_type : str = "hash" ,
240240 fields : Optional [List ["Field" ]] = None ,
241241 ):
242242 super ().__init__ (name , prefix , storage_type , fields )
@@ -313,7 +313,7 @@ def create(self, overwrite: Optional[bool] = False):
313313 # set storage_type, default to hash
314314 storage_type = IndexType .HASH
315315 if self ._storage .lower () == "json" :
316- self . _storage = IndexType .JSON
316+ storage_type = IndexType .JSON
317317
318318 # Create Index
319319 # will raise correct response error if index already exists
@@ -358,7 +358,7 @@ def load(
358358
359359 # Check if outer interface passes in TTL on load
360360 ttl = kwargs .get ("ttl" )
361- with self ._redis_conn .pipeline (transaction = False ) as pipe :
361+ with self ._redis_conn .pipeline (transaction = False ) as pipe : # type: ignore
362362 for record in data :
363363 key = self ._get_key (record , key_field )
364364 pipe .hset (key , mapping = record ) # type: ignore
@@ -394,7 +394,7 @@ def __init__(
394394 self ,
395395 name : str ,
396396 prefix : str = "rvl" ,
397- storage_type : Optional [ str ] = "hash" ,
397+ storage_type : str = "hash" ,
398398 fields : Optional [List ["Field" ]] = None ,
399399 ):
400400 super ().__init__ (name , prefix , storage_type , fields )
@@ -467,7 +467,7 @@ async def create(self, overwrite: Optional[bool] = False):
467467 # set storage_type, default to hash
468468 storage_type = IndexType .HASH
469469 if self ._storage .lower () == "json" :
470- self . _storage = IndexType .JSON
470+ storage_type = IndexType .JSON
471471
472472 # Create Index
473473 await self ._redis_conn .ft (self ._name ).create_index ( # type: ignore
@@ -516,7 +516,7 @@ async def _load(record: dict):
516516 key = self ._get_key (record , key_field )
517517 await self ._redis_conn .hset (key , mapping = record ) # type: ignore
518518 if ttl :
519- await self ._redis_conn .expire (key , ttl )
519+ await self ._redis_conn .expire (key , ttl ) # type: ignore
520520
521521 # gather with concurrency
522522 await asyncio .gather (* [_load (record ) for record in data ])
0 commit comments