(self)
Ensure the class data is valid.
Ensure the class data is valid.
Ensure the class data is valid .
def _Parse(self):
    """Ensure the class data is valid."""
    if self.data is not None:
      try:
        logging.debug('yaml.safe_load(...)')
        self.data.parsed = yaml.safe_load(self.data.data)
      except yaml.YAMLError:
        logging.warning('Error parsing YAML.')
        self.data.parsed = None

      if self.data.parsed is not None:
        try:
          self.data.serial = self.data.parsed.get('serial', None)
          self.data.experiments = self.data.parsed.get('experiments', {})
        except (AttributeError, ExperimentsError):
          logging.warning('Caught exception while parsing self.data.')
          self.data.valid = False
          return

        logging.debug('Parsed YAML data is valid')
        self.data.valid = True
      else:
        logging.debug('Problem parsing YAML data')
        self.data.valid = False
    else:
      logging.error('No data to parse!')
def _Parse ( self ) : if self . data is not None : try : logging . debug ( 'yaml.safe_load(...)' ) self . data . parsed = yaml . safe_load ( self . data . data ) except yaml . YAMLError : logging . warning ( 'Error parsing YAML.' ) self . data . parsed = None if self . data . parsed is not None : try : self . data . serial = self . data . parsed . get ( 'serial' , None ) self . data . experiments = self . data . parsed . get ( 'experiments' , { } ) except ( AttributeError , ExperimentsError ) : logging . warning ( 'Caught exception while parsing self.data.' ) self . data . valid = False return logging . debug ( 'Parsed YAML data is valid' ) self . data . valid = True else : logging . debug ( 'Problem parsing YAML data' ) self . data . valid = False else : logging . error ( 'No data to parse!' )