(req_file, check, newline)
Replace the requirements line for the given check
Replace the requirements line for the given check
Replace the requirements line for the given check
def update_agent_requirements(req_file, check, newline):
    """
    Replace the requirements line for the given check
    """
    package_name = get_package_name(check)
    lines = read_file_lines(req_file)

    for i, line in enumerate(lines):
        current_package_name = line.split('==')[0]

        if current_package_name == package_name:
            lines[i] = f'{newline}\n'
            break

    write_file_lines(req_file, sorted(lines))
def update_agent_requirements ( req_file , check , newline ) : package_name = get_package_name ( check ) lines = read_file_lines ( req_file ) for i , line in enumerate ( lines ) : current_package_name = line . split ( '==' ) [ 0 ] if current_package_name == package_name : lines [ i ] = f'{newline}\n' break write_file_lines ( req_file , sorted ( lines ) )