parameters: (self, xml_file, force=False)
return_statement: return True
docstring: Load block description from xml file
docstring_summary: Load block description from xml file
docstring_tokens: Load block description from xml file
function: def load_block_xml(self, xml_file, force=False):
          """Load block description from xml file"""
          if any(part in xml_file for part in excludes) and not force:
              logger.warn('Skipping {} because name is blacklisted!'
                          .format(xml_file))
              return False
          elif any(part in xml_file for part in excludes) and force:
              logger.warn('Forcing conversion of blacklisted file: {}'
                          .format(xml_file))
  
          block_id_from_xml = path.basename(xml_file)[:-4]
          yml_file = path.join(self.output_dir, block_id_from_xml + '.block.yml')
  
          if not self.needs_conversion(xml_file, yml_file):
              return  # yml file up-to-date
  
          logger.info('Converting block %s', path.basename(xml_file))
          data = block.from_xml(xml_file)
          if block_id_from_xml != data['id']:
              logger.warning('block_id and filename differ')
          self.cache[yml_file] = data
  
          with open(yml_file, 'w', encoding='utf-8') as yml_file:
              block.dump(data, yml_file)
          return True
function_tokens: def load_block_xml ( self , xml_file , force = False ) : if any ( part in xml_file for part in excludes ) and not force : logger . warn ( 'Skipping {} because name is blacklisted!' . format ( xml_file ) ) return False elif any ( part in xml_file for part in excludes ) and force : logger . warn ( 'Forcing conversion of blacklisted file: {}' . format ( xml_file ) ) block_id_from_xml = path . basename ( xml_file ) [ : - 4 ] yml_file = path . join ( self . output_dir , block_id_from_xml + '.block.yml' ) if not self . needs_conversion ( xml_file , yml_file ) : return # yml file up-to-date logger . info ( 'Converting block %s' , path . basename ( xml_file ) ) data = block . from_xml ( xml_file ) if block_id_from_xml != data [ 'id' ] : logger . warning ( 'block_id and filename differ' ) self . cache [ yml_file ] = data with open ( yml_file , 'w' , encoding = 'utf-8' ) as yml_file : block . dump ( data , yml_file ) return True