Implement Exports.get_one()

This commit is contained in:
jesopo 2019-02-07 10:02:27 +00:00
parent d013703705
commit 8c1c10b3c7

View file

@ -29,6 +29,9 @@ class Exports(object):
return self._exports.get(setting, []) + sum([ return self._exports.get(setting, []) + sum([
exports.get(setting, []) for exports in exports.get(setting, []) for exports in
self._context_exports.values()], []) self._context_exports.values()], [])
def get_one(self, setting: str) -> typing.Optional[typing.Any]:
values = self.get_all(setting)
return values[0] if values else None
def purge_context(self, context: str): def purge_context(self, context: str):
if context in self._context_exports: if context in self._context_exports: