From 8c1c10b3c7aa9edde8b4ca98ca025a66ba371344 Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 7 Feb 2019 10:02:27 +0000 Subject: [PATCH] Implement `Exports.get_one()` --- src/Exports.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Exports.py b/src/Exports.py index b0cb2043..f5b8852a 100644 --- a/src/Exports.py +++ b/src/Exports.py @@ -29,6 +29,9 @@ class Exports(object): return self._exports.get(setting, []) + sum([ exports.get(setting, []) for exports in 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): if context in self._context_exports: