File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ def save(self) -> None:
9999 JSONFileErrorHandler: If there is a file-related error accessing the JSON file.
100100 JSONEncodeErrorHandler: If there is an error saving JSON data to the file.
101101 """
102- return self ._map_template .save_json (self . _map_template . data , self ._indent )
102+ return self ._map_template .save_json (indent = self ._indent )
103103
104104 def backup (self ) -> None :
105105 """
@@ -110,7 +110,20 @@ def backup(self) -> None:
110110 JSONDecodeErrorHandler: If there is an error loading JSON data from the file.
111111 JSONEncodeErrorHandler: If there is an error saving JSON data to the file.
112112 """
113- return self ._map_template .backup_json (self ._indent )
113+ return self ._map_template .backup_json (indent = self ._indent )
114+
115+ def reset (self , initial_data : Optional [JSONMap ] = None , save : bool = True ) -> None :
116+ """
117+ Reset the configuration to the given initial data (or to an empty dict).
118+ Optionally saves the configuration to disk.
119+
120+ Args:
121+ initial_data (Optional[JSONMap]): The new config data to use. If None, uses {}.
122+ save (bool): Whether to save immediately after reset.
123+ """
124+ self ._map_template ._data = initial_data if initial_data is not None else {}
125+ if save :
126+ self .save ()
114127
115128 def get_value (self , key : str , default : Optional [Any ] = None ) -> Any :
116129 """
You can’t perform that action at this time.
0 commit comments