Ejemplo n.º 1
0
 def set_val(self, vals):
     ie_val = None
     if vals is None:
         self.unset_IE()
         [elt.set_val(None) for elt in self.__iter__()]
     elif isinstance(vals, (tuple, list)):
         ind = 0
         for elt in self.__iter__():
             val = vals[ind]
             if elt._name == 'V' and not isinstance(val, bytes_types):
                 ie_val = val
             else:
                 elt.set_val(val)
             ind += 1
     elif isinstance(vals, dict):
         for key, val in vals.items():
             if key == 'V' and not isinstance(val, bytes_types):
                 ie_val = val
             else:
                 self.__setitem__(key, val)
     elif self._SAFE_STAT:
         raise(EltErr('{0} [set_val]: vals type is {1}, expecting None, tuple, list or dict'\
               .format(self._name, type(vals).__name__)))
     if ie_val is not None:
         self.set_IE(val=ie_val)
Ejemplo n.º 2
0
 def set_val(self, vals):
     ie_val = None
     if vals is None:
         [elt.set_val(None) for elt in self.__iter__()]
     elif isinstance(vals, (tuple, list)):
         ind = 0
         for elt in self.__iter__():
             val = vals[ind]
             if elt._name == 'V' and not isinstance(val, integer_types):
                 ie_val = val
             else:
                 elt.set_val(val)
             ind += 1
     elif isinstance(vals, dict):
         for key, val in vals.items():
             if key == 'V' and not isinstance(val, integer_types):
                 ie_val = val
             else:
                 self.__setitem__(key, val)
     elif self._SAFE_STAT:
         raise(EltErr('{0} [set_val]: vals type is {1}, expecting None, tuple, list or dict'\
               .format(self._name, type(vals).__name__)))
     if ie_val is not None:
         # potentially clone the IE and set it according to val
         if self._IE_stat is not None and self._IE is None:
             self._IE = self._IE_stat.clone()
         self.set_IE(val=ie_val)
Ejemplo n.º 3
0
 def set_val(self, vals):
     ie_val = None
     if vals is None:
         self.unset_IE()
         [elt.set_val(None) for elt in self.__iter__()]
     elif isinstance(vals, (tuple, list)):
         for ind, elt in enumerate(self.__iter__()):
             val = vals[ind]
             if elt._name == 'V' and not isinstance(val, elt.TYPES):
                 # keep value for setting the inner IE
                 ie_val = val
             else:
                 # set raw V value
                 elt.set_val(val)
     elif isinstance(vals, dict):
         for key, val in vals.items():
             if key == 'V' and not isinstance(val, self['V'].TYPES):
                 # keep value for setting the inner IE
                 ie_val = val
             else:
                 # set raw V value
                 self.__setitem__(key, val)
     elif self._SAFE_STAT:
         raise(EltErr('{0} [set_val]: vals type is {1}, expecting None, tuple, list or dict'\
               .format(self._name, type(vals).__name__)))
     if ie_val is not None:
         # set the value to the inner IE
         self.set_IE(val=ie_val)