scripts/support/update_wiki_redirects.py
def update_desc_file(desc_file, tag, updates):
    """
    Function to update changes in desc files automatically

    desc_file: Path to a desc file
    tag: A valid DESC file tag to be modified e.g. 'WK'
    updates: A tuple with the desc changes (old, new)
    """
    family_dir = os.path.split(desc_file)[0]
    new_desc_path = os.path.join(family_dir, "DESC_NEW")

    fp = open(desc_file, 'r')
    new_desc = open(new_desc_path, 'w')
    desc_lines = fp.readlines()
    fp.close()

    for line in desc_lines:
        if line.find(tag) != -1:
            line = line.replace('_', ' ')
            line = line.replace(updates[0], updates[1].replace(' ', '_'))
        new_desc.write(line)

    new_desc.close()

    # remove old desc and rename new one to DESC
    os.remove(desc_file)
    os.rename(new_desc_path, os.path.join(family_dir, "DESC"))

    Function to update changes in desc files automatically

    desc_file: Path to a desc file
    tag: A valid DESC file tag to be modified e.g. 'WK'
    updates: A tuple with the desc changes (old, new)
    
Function to update changes in desc files automatically
desc_file: Path to a desc file
tag: A valid DESC file tag to be modified e.g. 'WK'
updates: A tuple with the desc changes (old, new)
Function to update changes in desc files automatically desc_file : Path to a desc file tag : A valid DESC file tag to be modified e . g . ' WK ' updates : A tuple with the desc changes ( old new )
def update_desc_file(desc_file, tag, updates):
    family_dir = os.path.split(desc_file)[0]
    new_desc_path = os.path.join(family_dir, "DESC_NEW")
    fp = open(desc_file, 'r')
    new_desc = open(new_desc_path, 'w')
    desc_lines = fp.readlines()
    fp.close()
    for line in desc_lines:
        if line.find(tag) != -1:
            line = line.replace('_', ' ')
            line = line.replace(updates[0], updates[1].replace(' ', '_'))
        new_desc.write(line)
    new_desc.close()
    os.remove(desc_file)
    os.rename(new_desc_path, os.path.join(family_dir, "DESC"))
def update_desc_file ( desc_file , tag , updates ) : family_dir = os . path . split ( desc_file ) [ 0 ] new_desc_path = os . path . join ( family_dir , "DESC_NEW" ) fp = open ( desc_file , 'r' ) new_desc = open ( new_desc_path , 'w' ) desc_lines = fp . readlines ( ) fp . close ( ) for line in desc_lines : if line . find ( tag ) != - 1 : line = line . replace ( '_' , ' ' ) line = line . replace ( updates [ 0 ] , updates [ 1 ] . replace ( ' ' , '_' ) ) new_desc . write ( line ) new_desc . close ( ) os . remove ( desc_file ) os . rename ( new_desc_path , os . path . join ( family_dir , "DESC" ) )
Function to update changes in desc files automatically
desc_file: Path to a desc file
tag: A valid DESC file tag to be modified e.g.
Function to update changes in desc files automatically desc_file : Path to a desc file tag : A valid DESC file tag to be modified e . g .
"""
    Function to update changes in desc files automatically

    desc_file: Path to a desc file
    tag: A valid DESC file tag to be modified e.g. 'WK'
    updates: A tuple with the desc changes (old, new)
    """ # remove old desc and rename new one to DESC
desc_file
tag
updates