Exemplo n.º 1
0
 def update_key_value(self, key):
     # type: (Any) -> None
     if key in self._ok:
         return
     for v in self.merge:
         if key in v[1]:
             ordereddict.__setitem__(self, key, v[1][key])
             return
     ordereddict.__delitem__(self, key)
Exemplo n.º 2
0
 def __setitem__(self, key, value):
     # type: (Any, Any) -> None
     # try to preserve the scalarstring type if setting an existing key to a new value
     if key in self:
         if isinstance(value, string_types) and \
            not isinstance(value, ScalarString) and \
            isinstance(self[key], ScalarString):
             value = type(self[key])(value)
     ordereddict.__setitem__(self, key, value)
Exemplo n.º 3
0
 def add_yaml_merge(self, value):
     # type: (Any) -> None
     for v in value:
         v[1].add_referent(self)
         for k, v in v[1].items():
             if ordereddict.__contains__(self, k):
                 continue
             ordereddict.__setitem__(self, k, v)
     self.merge.extend(value)