Skip to content

Commit e9dead7

Browse files
committed
sync-db: fix formatting
1 parent 5fb52b5 commit e9dead7

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

scripts/sync_db.py

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,19 @@ def _get_sha1_hash(game, romfile):
5454
except Exception:
5555
return ""
5656

57+
5758
def get_file_addition_date(file_path, repo_dir):
5859
try:
59-
command = ['git', 'log', '--diff-filter=A', '--follow', '--format=%ad', '--date=iso-strict', '--', file_path]
60+
command = [
61+
"git",
62+
"log",
63+
"--diff-filter=A",
64+
"--follow",
65+
"--format=%ad",
66+
"--date=iso-strict",
67+
"--",
68+
file_path,
69+
]
6070
result = subprocess.run(
6171
command,
6272
cwd=repo_dir,
@@ -70,16 +80,23 @@ def get_file_addition_date(file_path, repo_dir):
7080
except subprocess.CalledProcessError as e:
7181
print(f"Error: {e.stderr}")
7282
return None
73-
83+
84+
7485
def run():
7586
inserted = 0
7687
updated = 0
7788
d = 0
7889
for database_folder in dirs:
79-
80-
a = subprocess.run(
81-
["git", "config", "--global", "--add", "safe.directory", f"{Path.cwd()}/{basefolder}/{database_folder}"],
82-
check=True
90+
subprocess.run(
91+
[
92+
"git",
93+
"config",
94+
"--global",
95+
"--add",
96+
"safe.directory",
97+
f"{Path.cwd()}/{basefolder}/{database_folder}",
98+
],
99+
check=True,
83100
)
84101

85102
folder = f"{basefolder}/{database_folder}"
@@ -99,7 +116,9 @@ def run():
99116
data = json.load(json_file)
100117
print(f"({d}/{len(dirs)}) ({n}/{games_count}) Processing entry {game}")
101118

102-
first_added = get_file_addition_date(f"entries/{game}/game.json", folder)
119+
first_added = get_file_addition_date(
120+
f"entries/{game}/game.json", folder
121+
)
103122

104123
romfile = ""
105124

@@ -117,7 +136,11 @@ def run():
117136
if "database-gb" in folder:
118137
try:
119138
gbtoolsid_out = subprocess.check_output(
120-
["./scripts/gbtoolsid", "-oj", f"{folder}/entries/{game}/{romfile}"]
139+
[
140+
"./scripts/gbtoolsid",
141+
"-oj",
142+
f"{folder}/entries/{game}/{romfile}",
143+
]
121144
)
122145
tools = json.loads(gbtoolsid_out)
123146
except Exception:
@@ -181,7 +204,7 @@ def run():
181204
devtoolinfo=tools,
182205
baserepo=git_pointers[database_folder],
183206
published_date=parsed_date,
184-
firstadded_date=first_added
207+
firstadded_date=first_added,
185208
),
186209
)
187210

0 commit comments

Comments
 (0)