Skip to content

Commit 3de813e

Browse files
committed
Format
1 parent 245637d commit 3de813e

File tree

3 files changed

+30
-19
lines changed

3 files changed

+30
-19
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ repos:
1313
- id: requirements-txt-fixer
1414
- id: trailing-whitespace
1515

16+
- repo: https://github.com/astral-sh/ruff-pre-commit
17+
rev: v0.6.7
18+
hooks:
19+
- id: ruff-format
20+
1621
- repo: https://github.com/python-jsonschema/check-jsonschema
1722
rev: 0.29.2
1823
hooks:

build_docs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ def build(self):
748748
# Disable CPython switchers, we handle them now:
749749

750750
def is_mac():
751-
return platform.system() == 'Darwin'
751+
return platform.system() == "Darwin"
752752

753753
run(
754754
["sed", "-i"]

check_times.py

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,38 @@
1515

1616
from build_docs import format_seconds
1717

18+
1819
def get_lines() -> list[str]:
1920
lines = []
2021
zipped_logs = list(Path.cwd().glob("docsbuild.log.*.gz"))
21-
zipped_logs.sort(key=lambda p: int(p.name.split('.')[-2]), reverse=True)
22+
zipped_logs.sort(key=lambda p: int(p.name.split(".")[-2]), reverse=True)
2223
for logfile in zipped_logs:
2324
with gzip.open(logfile, "rt", encoding="utf-8") as f:
2425
lines += f.readlines()
2526
with open("docsbuild.log", encoding="utf-8") as f:
26-
lines += f.readlines()
27+
lines += f.readlines()
2728
return lines
2829

2930

3031
def calc_time(lines: list[str]) -> None:
3132
start = end = language = version = start_timestamp = None
32-
reason = lang_ver = ''
33+
reason = lang_ver = ""
3334

3435
print("Start | Version | Language | Build | Trigger")
3536
print(":-- | :--: | :--: | --: | :--:")
3637

3738
for line in lines:
3839
line = line.strip()
3940

40-
if ': Should rebuild: ' in line:
41-
if 'no previous state found' in line:
42-
reason = 'brand new'
43-
elif 'new translations' in line:
44-
reason = 'translation'
45-
elif 'Doc/ has changed' in line:
46-
reason = 'docs'
41+
if ": Should rebuild: " in line:
42+
if "no previous state found" in line:
43+
reason = "brand new"
44+
elif "new translations" in line:
45+
reason = "translation"
46+
elif "Doc/ has changed" in line:
47+
reason = "docs"
4748
else:
48-
reason = ''
49+
reason = ""
4950
lang_ver = line.split(" ")[3].removesuffix(":")
5051

5152
if line.endswith("Build start."):
@@ -62,19 +63,24 @@ def calc_time(lines: list[str]) -> None:
6263
if start and end:
6364
duration = (end - start).total_seconds()
6465
fmt_duration = format_seconds(duration)
65-
if lang_ver != f'{language}/{version}':
66-
reason = ''
67-
print(f"{start_timestamp: <20} | {version: <7} | {language: <8} | {fmt_duration :<14} | {reason}")
66+
if lang_ver != f"{language}/{version}":
67+
reason = ""
68+
print(
69+
f"{start_timestamp: <20} | {version: <7} | {language: <8} | {fmt_duration :<14} | {reason}"
70+
)
6871
start = end = start_timestamp = None
6972

70-
if ': Full build done' in line:
73+
if ": Full build done" in line:
7174
timestamp = f"{line[:16]} UTC"
7275
_, fmt_duration = line.removesuffix(").").split("(")
73-
print(f"{timestamp: <20} | --FULL- | -BUILD-- | {fmt_duration :<14} | -----------")
76+
print(
77+
f"{timestamp: <20} | --FULL- | -BUILD-- | {fmt_duration :<14} | -----------"
78+
)
7479

7580
if start and end is None:
76-
print(f"{start_timestamp: <20} | {version: <7} | {language: <8} | In progress... | {reason}")
77-
81+
print(
82+
f"{start_timestamp: <20} | {version: <7} | {language: <8} | In progress... | {reason}"
83+
)
7884

7985

8086
if __name__ == "__main__":

0 commit comments

Comments
 (0)