Added a get method to Opts to get an Options object
@@ -98,6 +98,26 @@ class Opts(object):
self._obj = obj
+ def get(self, group=None, backend=None):
+ """Returns the corresponding Options object.
+
+ Args:
+ group: The options group. Flattens across groups if None.
+ backend: Current backend if None otherwise chosen backend.
+
+ Returns:
+ Options object associated with the object containing the
+ applied option keywords.
+ """
+ keywords = {}
+ groups = Options._option_groups if group is None else [group]
+ backend = backend if backend else Store.current_backend
+ for group in groups:
+ optsobj = Store.lookup_options(backend, self._obj, group)
+ keywords = dict(keywords, **optsobj.kwargs)
+ return Options(**keywords)
+
+
def __call__(self, *args, **kwargs):
"""Applies nested options definition.
