File: post_process_dispatcher.py

package info (click to toggle)
pytorch-audio 2.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 108,884 kB
  • sloc: python: 44,403; cpp: 3,384; sh: 126; makefile: 32
file content (16 lines) | stat: -rw-r--r-- 552 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""Replaces every instance of 'torchaudio._backend' with 'torchaudio' in torchaudio.html.
Temporary hack while we maintain both the existing set of info/load/save functions and the
new ones backed by the backend dispatcher in torchaudio._backend.
"""
import sys

if __name__ == "__main__":
    build_dir = sys.argv[1]
    filepath = f"{build_dir}/html/torchaudio.html"

    with open(filepath, "r") as f:
        text = f.read()
        text = text.replace("torchaudio._backend", "torchaudio")

    with open(filepath, "w") as f:
        f.write(text)