Skip to content

Commit 2086e7e

Browse files
author
Jim
committed
Fix linter issues.
1 parent b54f89b commit 2086e7e

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

games/game_silenthill2remake.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def __init__(self):
2323

2424
def _find_tree(
2525
self, filetree: mobase.IFileTree
26-
) -> Tuple[str | None, mobase.IFileTree | None]:
26+
) -> Tuple[str | None, mobase.FileTreeEntry | None]:
2727
"""
2828
Search the given filetree for a directory name that matches any component
2929
of self.mod_path (case-insensitive).
@@ -45,7 +45,6 @@ def _find_tree(
4545
prefix_parts = self.mod_path[:i]
4646
prefix = "/".join(prefix_parts) + ("/" if prefix_parts else "")
4747
return (prefix, entry)
48-
4948
# No matches found
5049
return (None, None)
5150

@@ -55,6 +54,7 @@ def dataLooksValid(
5554
# Check for fully valid layout
5655
has_entry, _ = self._find_tree(filetree)
5756
if has_entry is None:
57+
# in this case we check to make sure there's a .pak file
5858
for entry in filetree:
5959
if entry.name().lower().endswith(".pak") and entry.isFile():
6060
return mobase.ModDataChecker.FIXABLE
@@ -73,11 +73,15 @@ def fix(self, filetree: mobase.IFileTree) -> mobase.IFileTree:
7373
foundAPak = False
7474
# Move all top-level items to BepInEx/plugins/
7575
items_to_move = list(filetree)
76-
for item in items_to_move:
77-
if item.name().lower().endswith(".pak"):
76+
for cur_item in items_to_move:
77+
if cur_item.name().lower().endswith(".pak"):
7878
foundAPak = True
79-
filetree.move(item, f"SHProto/Content/Paks/~mod/{item.name()}")
80-
return filetree if foundAPak else None
79+
filetree.move(cur_item, f"SHProto/Content/Paks/~mod/{cur_item.name()}")
80+
# foundAPack MUST be true because if 'prefix' returned None then
81+
# there must be a .pak file or dataLooksValid wouldn't have returned
82+
# a FIXABLE. This is therefore just a sanity check
83+
assert foundAPak
84+
return filetree
8185
elif prefix == "":
8286
return filetree
8387
else:

0 commit comments

Comments
 (0)