def extract_python_code_from_op_readme(op_path, op_name):
    """
    Extract the readme of all the ops
    Parameters:
        op_path - the path for operator
        op_name - name of operator
    Returns:
        the test case file
    """
    test_case_name = op_path + "/test_" + op_name + ".py"
    with open(op_path+"/README.md") as f:
        lines = f.readlines()
        f.close()

    lines = [i.strip() for i in lines]
    logger.debug("Readme for %s is \n" % op_path)
    logger.debug("%s" % lines)

    # clear test case before extracted the latest
    if os.path.exists(test_case_name):
        os.system(f"rm {test_case_name}")

    for i in range(len(lines)):
        if 'Fine-tune' in lines[i]:
            break
        if ('```Python' in lines[i]) or ('```python' in lines[i]):
            for j in range(i + 1, len(lines)):
                if '```' == lines[j]:
                    break
                else:
                    if "./towhee.jpg" in lines[j]:
                        lines[j] = lines[j].replace('./towhee.jpg', path + '/dataset/test.jpg')
                    elif "towhee.jpg" in lines[j]:
                        lines[j] = lines[j].replace('towhee.jpg', path + '/dataset/test.jpg')
                    elif "./test.png" in lines[j]:
                        lines[j] = lines[j].replace('./test.png', path + '/dataset/test.jpg')
                    elif "./example.jpg" in lines[j]:
                        lines[j] = lines[j].replace('./example.jpg', path + '/dataset/test.jpg')
                    elif "./test_face.jpg" in lines[j]:
                        lines[j] = lines[j].replace('./test_face.jpg', path + '/dataset/test_face.jpg')
                    elif "./towhee.jpeg" in lines[j]:
                        lines[j] = lines[j].replace('./towhee.jpeg', path + '/dataset/test.jpg')
                    elif "towhee.jpeg" in lines[j]:
                        lines[j] = lines[j].replace('towhee.jpeg', path + '/dataset/test.jpg')
                    elif "turing.png" in lines[j]:
                        lines[j] = lines[j].replace('turing.png', path + '/dataset/test.jpg')
                    elif "./img1.jpg" in lines[j]:
                        lines[j] = lines[j].replace('./img1.jpg', path + '/dataset/test.jpg')
                    elif "./img.png" in lines[j]:
                        lines[j] = lines[j].replace('./img.png', path + '/dataset/test.jpg')
                    elif "./image.jpg" in lines[j]:
                        lines[j] = lines[j].replace('./image.jpg', path + '/dataset/test.jpg')
                    elif "img.png" in lines[j]:
                        lines[j] = lines[j].replace('img.png', path + '/dataset/test.jpg')
                    elif "./dog.jpg" in lines[j]:
                        lines[j] = lines[j].replace('./dog.jpg', path + '/dataset/test.jpg')
                    elif "./avengers.jpg" in lines[j]:
                        lines[j] = lines[j].replace('./avengers.jpg', path + '/dataset/test.jpg')
                    elif "./teddy.jpg" in lines[j]:
                        lines[j] = lines[j].replace('./teddy.jpg', path + '/dataset/test.jpg')
                    elif "./animals.jpg" in lines[j]:
                        lines[j] = lines[j].replace('./animals.jpg', path + '/dataset/test.jpg')
                    elif "./hulk.jpg" in lines[j]:
                        lines[j] = lines[j].replace('./hulk.jpg', path + '/dataset/test.jpg')
                    elif "./moon.jpg" in lines[j]:
                        lines[j] = lines[j].replace('./moon.jpg', path + '/dataset/test.jpg')
                    elif "./moon.jpeg" in lines[j]:
                        lines[j] = lines[j].replace('./moon.jpeg', path + '/dataset/test.jpg')
                    elif "./jumpingjack.gif" in lines[j]:
                        lines[j] = lines[j].replace('./jumpingjack.gif', path + '/dataset/test.mp4')
                    elif "./demo_video.mp4" in lines[j]:
                        lines[j] = lines[j].replace('./demo_video.mp4', path + '/dataset/test.mp4')
                    elif "./archery.mp4" in lines[j]:
                        lines[j] = lines[j].replace('./archery.mp4', path + '/dataset/test.mp4')
                    elif "./test.wav" in lines[j]:
                        lines[j] = lines[j].replace('./test.wav', path + '/dataset/test.wav')
                    elif "test.wav" in lines[j]:
                        lines[j] = lines[j].replace('test.wav', path + '/dataset/test.wav')
                    with open(test_case_name, 'a') as f1:
                        f1.write(lines[j] + '\n')
                        f1.close()
    if not os.path.exists(test_case_path):
        os.system(f"mkdir -p {test_case_path}")
    os.system(f"cp {test_case_name} {test_case_path}")
    if os.path.exists(test_case_name):
        logger.debug("Success to create test case %s " % test_case_name)
    else:
        logger.error("Fail to create test case %s " % test_case_name)

    return test_case_name
Extract the readme of all the ops
Parameters:
op_path - the path for operator
op_name - name of operator
Returns:
the test case file
tests/testcases/hub/execute_hub_operators.py