def get_default_content(old_file, json_file):
    with old_file as old_file:
        result_content = old_file.read()
        json_dict = json.load(json_file)
        for replace_property in json_dict:
            propertys = json_dict.get(replace_property)
            start_index = result_content.find(str(replace_property))
            content = propertys.get('content')
            if (propertys.get('mode') == 'add'):
                end_index = (result_content.find(')', start_index) - 1)
                temp_content = result_content[start_index:end_index]
                if ((temp_content[(- 1)] == ',') or (temp_content[(- 1)] == '(')):
                    temp_content += '\n'
                else:
                    temp_content += ',\n'
                result_content = ''.join([result_content[:start_index], temp_content, str(content), result_content[end_index:]])
            elif (propertys.get('mode') == 'cover'):
                end_index = result_content.find('\n', start_index)
                if (result_content[start_index:end_index].strip() == 'IS_USE_CELERY = False'):
                    continue
                start_index += len(replace_property)
                result_content = ''.join([result_content[:start_index], ('%s' % str(content)), result_content[end_index:]])
            else:
                break
        if (PY_VER[0] == '2'):
            with open('config/default.py', 'w') as default_file:
                default_file.write(result_content)
        else:
            with open('config/default.py', 'w', encoding='utf-8') as default_file:
                default_file.write(result_content)
def get_default_content(old_file, json_file):
    with old_file as old_file:
        result_content = old_file.read()
        json_dict = json.load(json_file)
        for replace_property in json_dict:
            propertys = json_dict.get(replace_property)
            start_index = result_content.find(str(replace_property))
            content = propertys.get('content')
            if (propertys.get('mode') == 'add'):
                end_index = (result_content.find(')', start_index) - 1)
                temp_content = result_content[start_index:end_index]
                if ((temp_content[(- 1)] == ',') or (temp_content[(- 1)] == '(')):
                    temp_content += '\n'
                else:
                    temp_content += ',\n'
                result_content = .join([result_content[:start_index], temp_content, str(content), result_content[end_index:]])
            elif (propertys.get('mode') == 'cover'):
                end_index = result_content.find('\n', start_index)
                if (result_content[start_index:end_index].strip() == 'IS_USE_CELERY = False'):
                    continue
                start_index += len(replace_property)
                result_content = .join([result_content[:start_index], ('%s' % str(content)), result_content[end_index:]])
            else:
                break
        if (PY_VER[0] == '2'):
            with open('config/default.py', 'w') as default_file:
                default_file.write(result_content)
        else:
            with open('config/default.py', 'w', encoding='utf-8') as default_file:
                default_file.write(result_content)