
Enables excluded pep8 checks and fixes existing the related errors Change-Id: Ib3a909d79b9726567c1cebf5881d1878d91ee052
24 lines
482 B
Python
Executable File
24 lines
482 B
Python
Executable File
"""ORM Dictator module."""
|
|
|
|
DICTATOR = {}
|
|
|
|
|
|
def set(key, value):
|
|
"""Set a key in the Dictator."""
|
|
global DICTATOR
|
|
DICTATOR[key] = value
|
|
|
|
|
|
def soft_set(key, value):
|
|
"""Set a key in the Dictator only if it doesn't exist."""
|
|
global DICTATOR
|
|
DICTATOR.setdefault(key, value)
|
|
|
|
|
|
def get(key, default=None):
|
|
"""Get a key from the Dictator.
|
|
|
|
:return: The value if it exists, default otherwise.
|
|
"""
|
|
return DICTATOR[key] if key in DICTATOR else default
|