@@ -49,7 +49,7 @@ def get(
4949 key : str ,
5050 callback : Callable [[Any ], Any ] = lambda x : x ,
5151 ) -> Any :
52- with self ._lock .read_lock ():
52+ with self ._lock .read ():
5353 items_of_kind = self ._items [kind ]
5454 item = items_of_kind .get (key )
5555 if item is None :
@@ -69,7 +69,7 @@ def get(
6969 return callback (item )
7070
7171 def all (self , kind : VersionedDataKind , callback : Callable [[Any ], Any ] = lambda x : x ) -> Any :
72- with self ._lock .read_lock ():
72+ with self ._lock .read ():
7373 items_of_kind = self ._items [kind ]
7474 return callback (
7575 dict (
@@ -88,7 +88,7 @@ def set_basis(self, collections: Collections) -> bool:
8888 return False
8989
9090 try :
91- with self ._lock .write_lock ():
91+ with self ._lock .write ():
9292 self ._items .clear ()
9393 self ._items .update (all_decoded )
9494 self ._initialized = True
@@ -107,7 +107,7 @@ def apply_delta(self, collections: Collections) -> bool:
107107 return False
108108
109109 try :
110- with self ._lock .write_lock ():
110+ with self ._lock .write ():
111111 for kind , kind_data in all_decoded .items ():
112112 items_of_kind = self ._items [kind ]
113113 kind_data = all_decoded [kind ]
@@ -142,7 +142,7 @@ def initialized(self) -> bool:
142142 """
143143 Indicates whether the store has been initialized with data.
144144 """
145- with self ._lock .read_lock ():
145+ with self ._lock .read ():
146146 return self ._initialized
147147
148148
@@ -212,7 +212,7 @@ def with_persistence(
212212 Returns:
213213 Self for method chaining
214214 """
215- with self ._lock .write_lock ():
215+ with self ._lock .write ():
216216 self ._persistent_store = persistent_store
217217 self ._persistent_store_writable = writable
218218 self ._persistent_store_status_provider = status_provider
@@ -224,12 +224,12 @@ def with_persistence(
224224
225225 def selector (self ) -> Selector :
226226 """Returns the current selector."""
227- with self ._lock .read_lock ():
227+ with self ._lock .read ():
228228 return self ._selector
229229
230230 def close (self ) -> Optional [Exception ]:
231231 """Close the store and any persistent store if configured."""
232- with self ._lock .write_lock ():
232+ with self ._lock .write ():
233233 if self ._persistent_store is not None :
234234 try :
235235 # Most FeatureStore implementations don't have close methods
@@ -250,7 +250,7 @@ def apply(self, change_set: ChangeSet, persist: bool) -> None:
250250 """
251251 collections = self ._changes_to_store_data (change_set .changes )
252252
253- with self ._lock .write_lock ():
253+ with self ._lock .write ():
254254 try :
255255 if change_set .intent_code == IntentCode .TRANSFER_FULL :
256256 self ._set_basis (collections , change_set .selector , persist )
@@ -442,7 +442,7 @@ def __mapping(data: Dict[str, ModelEntity]) -> Dict[str, Dict[str, Any]]:
442442
443443 return __mapping
444444
445- with self ._lock .write_lock ():
445+ with self ._lock .write ():
446446 if self ._should_persist ():
447447 try :
448448 # Get all data from memory store and write to persistent store
@@ -456,7 +456,7 @@ def __mapping(data: Dict[str, ModelEntity]) -> Dict[str, Dict[str, Any]]:
456456
457457 def get_active_store (self ) -> ReadOnlyStore :
458458 """Get the currently active store for reading data."""
459- with self ._lock .read_lock ():
459+ with self ._lock .read ():
460460 return self ._active_store
461461
462462 def is_initialized (self ) -> bool :
@@ -465,5 +465,5 @@ def is_initialized(self) -> bool:
465465
466466 def get_data_store_status_provider (self ) -> Optional [DataStoreStatusProvider ]:
467467 """Get the data store status provider for the persistent store, if configured."""
468- with self ._lock .read_lock ():
468+ with self ._lock .read ():
469469 return self ._persistent_store_status_provider
0 commit comments