/usr/share/pyshared/gpyconf/backends/dummy.py is in python-gpyconf 0.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # %FILEHEADER%
from __future__ import print_function
from . import Backend
from . import NONE, MissingOption
_print = print
def print(*args, **kwargs):
return _print(*(["DummyBackend:"]+list(args)), **kwargs)
class DummyBackend(Backend):
"""
A dummy backend. Does not store any values; :meth:`get_option` returns the
corresponding field's current value instead of a stored one.
Useful for debugging and playing around with gpyconf.
"""
def read(self):
print("Read")
def save(self):
print("Save")
def set_option(self, name, value):
print("Set option %s to %s" % (name, value))
def get_option(self, name, default=NONE):
print ("Get option %s" % name)
try:
return self.backref().fields[name].value
except KeyError:
print("Option not set, using default value %s" % default)
if default:
return default
else:
raise MissingOption
def reset_all(self):
print ("Reset all")
@property
def options(self):
return self.backref().fields.keys()
|