Skip to content

Commit 32e1e48

Browse files
author
longendu
committed
format code
1 parent 2c9b1a3 commit 32e1e48

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

aiutil/filesystem.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22
"""Filesystem related util functions."""
3+
34
from typing import Iterable, Callable
45
import itertools
56
import os
@@ -548,9 +549,10 @@ def dedup_header(file: str | Path, output: str | Path = "") -> None:
548549
:param output: The path of the output file.
549550
If empty, then output to the standard output.
550551
"""
551-
with open(file, "rb") as fin, (
552-
open(output, "wb") if output else sys.stdout.buffer
553-
) as fout:
552+
with (
553+
open(file, "rb") as fin,
554+
open(output, "wb") if output else sys.stdout.buffer as fout,
555+
):
554556
header = fin.readline()
555557
fout.write(header)
556558
for line in fin:
@@ -606,9 +608,10 @@ def prune_json(input: str | Path, output: str | Path = ""):
606608
else:
607609
output = input.with_name(input.stem + "_prune.json")
608610
skip = False
609-
with input.open("r", encoding="utf-8") as fin, output.open(
610-
"w", encoding="utf-8"
611-
) as fout:
611+
with (
612+
input.open("r", encoding="utf-8") as fin,
613+
output.open("w", encoding="utf-8") as fout,
614+
):
612615
for line in fin:
613616
line = line.strip()
614617
if line == '"value_counts": {':

aiutil/hadoop/kerberos.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
If an user authenticate without specifying password,
66
the saved password is used so that users do not have to type in password to authenticate every time.
77
"""
8+
89
from typing import Any
910
import os
1011
from pathlib import Path
@@ -81,7 +82,7 @@ def authenticate(password: str, email: dict[str, str], user: str = "") -> None:
8182
:param user: User name. If empty, the current user name is used.
8283
"""
8384
SUBJECT = "kinit: authentication {}"
84-
MSG = f'kinit ({PID}): authentication on {HOST} ({HOST_IP}) {"{}"} at {datetime.datetime.now()}'
85+
MSG = f"kinit ({PID}): authentication on {HOST} ({HOST_IP}) {'{}'} at {datetime.datetime.now()}"
8586
try:
8687
process = sp.run(
8788
["/usr/bin/kinit", user if user else USER],

aiutil/hadoop/pyspark_submit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22
# encoding: utf-8
33
"""A module makes it easy to run Scala/Python Spark job."""
4+
45
from typing import Callable, Any, Iterable
56
import os
67
import sys

aiutil/notebook/search.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22
"""Search Jupyter/Lab notebooks."""
3+
34
from typing import TypeAlias, Sequence
45
import json
56
from pathlib import Path

aiutil/notebook/util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22
"""Jupyter/Lab notebooks related utils."""
3+
34
from pathlib import Path
45
import subprocess as sp
56
import itertools as it

0 commit comments

Comments
 (0)