Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5453926

Browse files
authored
Add options to only show certain build times (#307)
1 parent0f2598a commit5453926

File tree

1 file changed

+34
-14
lines changed

1 file changed

+34
-14
lines changed

‎check_times.py‎

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
$ python check_times.py
1111
"""
1212

13+
importargparse
1314
importgzip
1415
importtomllib
1516
frompathlibimportPath
@@ -78,17 +79,36 @@ def calc_time(lines: list[str]) -> None:
7879

7980

8081
if__name__=="__main__":
81-
print("Build times (HTML only; English)")
82-
print("=======================")
83-
print()
84-
calc_time(get_lines("docsbuild-only-html-en.log"))
85-
86-
print("Build times (HTML only)")
87-
print("=======================")
88-
print()
89-
calc_time(get_lines("docsbuild-only-html.log"))
90-
91-
print("Build times (no HTML)")
92-
print("=====================")
93-
print()
94-
calc_time(get_lines("docsbuild-no-html.log"))
82+
parser=argparse.ArgumentParser(
83+
description=__doc__,formatter_class=argparse.RawDescriptionHelpFormatter
84+
)
85+
ALL_BUILDS= ("no-html","only-html","only-html-en")
86+
parser.add_argument(
87+
"--select-output",
88+
choices=ALL_BUILDS,
89+
nargs="*",
90+
help="Choose what builds to show (default: all).",
91+
)
92+
args=parser.parse_args()
93+
parser.suggest_on_error=True
94+
95+
ifnotargs.select_output:
96+
args.select_output=ALL_BUILDS
97+
98+
if"only-html-en"inargs.select_output:
99+
print("Build times (HTML only; English)")
100+
print("=======================")
101+
print()
102+
calc_time(get_lines("docsbuild-only-html-en.log"))
103+
104+
if"only-html"inargs.select_output:
105+
print("Build times (HTML only)")
106+
print("=======================")
107+
print()
108+
calc_time(get_lines("docsbuild-only-html.log"))
109+
110+
if"no-html"inargs.select_output:
111+
print("Build times (no HTML)")
112+
print("=====================")
113+
print()
114+
calc_time(get_lines("docsbuild-no-html.log"))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp