3 from __future__
import absolute_import
4 from __future__
import division
5 from __future__
import print_function
6 from __future__
import unicode_literals
9 DEFAULT_MODIFIER =
'DEFAULT' 14 provide context to allow param_info to have different modifiers 21 def _rebuild_modifiers(self):
24 self._modifiers.update(m)
26 def _has_modifier(self, name):
29 def _get_modifier(self, name):
30 return self._modifiers.get(name)
32 def push_modifiers(self, modifiers):
34 self._modifiers_list.append(modifiers)
35 self._modifiers.update(modifiers)
37 def pop_modifiers(self):
39 self._modifiers_list.pop()
45 context class to allow setting the current context. 46 Example useage with layer: 47 modifiers = {'modifier1': modifier1, 'modifier2': modifier2} 48 with Modifiers(modifiers): 49 modifier = ModifierContext.current().get_modifier('modifier1') 50 layer(modifier=modifier) 53 def __init__(self, modifier_or_dict):
54 if isinstance(modifier_or_dict, dict):
57 self.
_modifiers = {DEFAULT_MODIFIER: modifier_or_dict}
59 def _context_class(self):
60 raise NotImplementedError
66 def __exit__(self, type, value, traceback):
def _rebuild_modifiers(self)