@@ -31,7 +31,7 @@ class InvalidException(DbException):
3131
3232
3333class InvalidOrderStatusException (InvalidException ):
34- def __init__ (self , prev_status : models .StatusOrderEnum , new_status : models .StatusOrderEnum ):
34+ def __init__ (self , prev_status : models .StatusOrderEnum , new_status : models .StatusOrderEnum ) -> None :
3535 super ().__init__ (f"Unable to change order status { prev_status .value !r} to { new_status .value !r} " )
3636
3737
@@ -80,10 +80,10 @@ def get_value(self, name: str, default: Any = None) -> Any:
8080 return self .db .get (name )
8181
8282 @session ()
83- def set_value (self , name : str , value : Any ):
83+ def set_value (self , name : str , value : Any ) -> None :
8484 self .db [name ] = value
8585
86- def __init__ (self , file_name : Path | str = DB_FILE_NAME ):
86+ def __init__ (self , file_name : Path | str = DB_FILE_NAME ) -> None :
8787 self .file_name : str = str (file_name )
8888 self .db : shelve .Shelf | None = None
8989
@@ -93,7 +93,7 @@ def _generate_id(self) -> str:
9393 return str (uuid4 ())
9494
9595 @lock ()
96- def rebuild_indexes (self , clear : bool = True ):
96+ def rebuild_indexes (self , clear : bool = True ) -> None :
9797 indexes : dict [str , dict [str , str ]] = self .get_value (self .KEY_INDEXES , default = dict ())
9898
9999 if self .KEY_USERS not in indexes :
@@ -111,14 +111,14 @@ def rebuild_indexes(self, clear: bool = True):
111111 self .set_value (self .KEY_INDEXES , indexes )
112112
113113 @lock ()
114- def add_index (self , table : str , key : str , id : str ):
114+ def add_index (self , table : str , key : str , id : str ) -> None :
115115 indexes : dict [str , dict [str , str ]] = self .get_value (self .KEY_INDEXES )
116116 indexes [table ][key ] = id
117117
118118 self .set_value (self .KEY_INDEXES , indexes )
119119
120120 @lock ()
121- def remove_index (self , table : str , key : str ):
121+ def remove_index (self , table : str , key : str ) -> None :
122122 indexes : dict [str , dict [str , str ]] = self .get_value (self .KEY_INDEXES )
123123 indexes [table ].pop (key )
124124
@@ -130,7 +130,7 @@ def get_id_from_index(self, table: str, key: str) -> str | None:
130130 return indexes [table ].get (key )
131131
132132 @lock ()
133- def _do_init_db_objects (self ):
133+ def _do_init_db_objects (self ) -> None :
134134 self .rebuild_indexes (clear = False )
135135
136136 if self .KEY_USERS not in self .get_value ("" ):
@@ -271,7 +271,7 @@ def update_product(
271271 name : str | None = None ,
272272 price_minor : int | None = None ,
273273 description : str | None = None ,
274- ):
274+ ) -> None :
275275 product = self .get_product (id , check_exists = True )
276276
277277 if name is not None :
@@ -311,7 +311,7 @@ def create_shopping_cart(self, product_ids: list[str]) -> models.ShoppingCart:
311311 return obj
312312
313313 @lock ()
314- def delete_shopping_cart (self , shopping_cart_id : str ):
314+ def delete_shopping_cart (self , shopping_cart_id : str ) -> None :
315315 # Проверка наличия
316316 self .get_shopping_cart (shopping_cart_id , check_exists = True )
317317
@@ -325,7 +325,7 @@ def update_shopping_cart(
325325 self ,
326326 shopping_cart_id : str ,
327327 product_ids : list [str ],
328- ):
328+ ) -> None :
329329 shopping_cart : models .ShoppingCart = self .get_shopping_cart (
330330 shopping_cart_id , check_exists = True
331331 )
@@ -356,7 +356,7 @@ def add_product_in_shopping_cart(
356356 self ,
357357 shopping_cart_id : str ,
358358 product_id : str ,
359- ):
359+ ) -> None :
360360 shopping_cart : models .ShoppingCart = self .get_shopping_cart (
361361 shopping_cart_id , check_exists = True
362362 )
@@ -372,7 +372,7 @@ def remove_product_from_shopping_cart(
372372 self ,
373373 shopping_cart_id : str ,
374374 product_id : str ,
375- ):
375+ ) -> None :
376376 shopping_cart : models .ShoppingCart = self .get_shopping_cart (
377377 shopping_cart_id , check_exists = True
378378 )
0 commit comments