Skip to content

Commit 6491857

Browse files
committed
Fix iOS backup path mypy typing
1 parent fbd0012 commit 6491857

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/mvt/ios/cmd_check_backup.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,24 @@ def __init__(
5656
self.modules = BACKUP_MODULES + MIXED_MODULES
5757

5858
def resolve_backup_path(self) -> bool:
59-
if not self.target_path:
59+
target_path = getattr(self, "target_path", None)
60+
if not isinstance(target_path, str) or not target_path:
6061
return False
6162

62-
if is_ios_backup_folder(self.target_path):
63+
if is_ios_backup_folder(target_path):
6364
return True
6465

65-
if not os.path.isdir(self.target_path):
66+
if not os.path.isdir(target_path):
6667
self.log.critical(
6768
"%s does not appear to be an iTunes backup folder. "
6869
"Expected Manifest.db and Info.plist.",
69-
self.target_path,
70+
target_path,
7071
)
7172
return False
7273

7374
candidates = []
74-
for entry_name in sorted(os.listdir(self.target_path)):
75-
entry_path = os.path.join(self.target_path, entry_name)
75+
for entry_name in sorted(os.listdir(target_path)):
76+
entry_path = os.path.join(target_path, entry_name)
7677
if os.path.isdir(entry_path) and is_ios_backup_folder(entry_path):
7778
candidates.append(entry_path)
7879

@@ -84,14 +85,14 @@ def resolve_backup_path(self) -> bool:
8485
if candidates:
8586
self.log.critical(
8687
"Found multiple iTunes backups in %s. Please specify one backup folder.",
87-
self.target_path,
88+
target_path,
8889
)
8990
return False
9091

9192
self.log.critical(
9293
"%s does not appear to be an iTunes backup folder. "
9394
"Expected Manifest.db and Info.plist.",
94-
self.target_path,
95+
target_path,
9596
)
9697
return False
9798

0 commit comments

Comments
 (0)