blob: d62a7dd82c0ced4734afedd444ba292d447c3918 [file] [log] [blame]
#
# Copyright (c) 2022 Project CHIP Authors
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class VariableStorage:
'''Stores key value pairs.
This is a code readability convience object for saving/loading values.
'''
def __init__(self):
self._saved_list = {}
def save(self, key, value):
self._saved_list[key] = value
def load(self, key):
return self._saved_list.get(key)
def is_key_saved(self, key) -> bool:
return key in self._saved_list
def clear(self):
self._saved_list.clear()