Fix doc issues in configcache

This commit is contained in:
Jay Kamat 2018-09-02 14:37:22 -07:00
parent 0335fc31c1
commit cc09f6c962
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5

View File

@ -17,20 +17,22 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""A 'high-performance' cache for the config system.
Useful for areas which call out to the config system very frequently, DO NOT """Implementation of a basic config cache."""
modify the value returned, DO NOT require per-url settings, do not change
frequently, and do not require partially 'expanded' config paths.
If any of these requirements are broken, you will get incorrect or slow
behavior.
"""
from qutebrowser.config import config from qutebrowser.config import config
class ConfigCache(): class ConfigCache():
"""A 'high-performance' cache for the config system.
Useful for areas which call out to the config system very frequently, DO
NOT modify the value returned, DO NOT require per-url settings, do not
change frequently, and do not require partially 'expanded' config paths.
If any of these requirements are broken, you will get incorrect or slow
behavior.
"""
def __init__(self) -> None: def __init__(self) -> None:
self.cache = {} self.cache = {}
@ -40,7 +42,7 @@ class ConfigCache():
if attr in self.cache: if attr in self.cache:
self.cache[attr] = config.instance.get(attr) self.cache[attr] = config.instance.get(attr)
def __setitem__(self, attr): def __setitem__(self, attr, _value):
raise Exception("ConfigCache cannot be used to set values.") raise Exception("ConfigCache cannot be used to set values.")
def __getitem__(self, attr: str): def __getitem__(self, attr: str):