mirror of
https://github.com/kennethreitz/simplemind.git
synced 2026-06-05 22:50:18 +00:00
19 lines
495 B
Python
19 lines
495 B
Python
from simplemind.plugins.base import BasePlugin
|
|
|
|
|
|
class KVPlugin(BasePlugin):
|
|
def __init__(self):
|
|
self.store = {}
|
|
|
|
def process(self, key: str, value=None):
|
|
"""
|
|
Get or set a value in the key-value store.
|
|
If value is None, returns the value for the key.
|
|
If value is provided, sets the value for the key and returns it.
|
|
"""
|
|
if value is None:
|
|
return self.store.get(key)
|
|
|
|
self.store[key] = value
|
|
return value
|