Last active
November 17, 2022 18:48
-
-
Save seungwonpark/16a82e44f43ca71c548d56e68d2e8167 to your computer and use it in GitHub Desktop.
Open tf1.15 docs via CLI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# open tensorflow v1.15 docs via command line | |
# example usage: ./open_tf1docs.py tf.train.ProfilerHook | |
# then it will open: https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/train/ProfilerHook | |
# place it in /usr/local/bin and create symlink if you want shorter alias | |
import sys | |
import webbrowser | |
# get the argument | |
if len(sys.argv) == 1: | |
print('Usage: ./open_tf1docs.py <tf symbol>') | |
print('Example: ./open_tf1docs.py tf.train.ProfilerHook') | |
exit(1) | |
arg = sys.argv[1] | |
# split the argument | |
arg = arg.split('.') | |
arg = [x.strip() for x in arg] | |
# get the url | |
url = 'https://www.tensorflow.org/versions/r1.15/api_docs/python/' + '/'.join(arg) | |
# open the url | |
webbrowser.open(url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment