🎨 Try to open file instead of checking

This commit is contained in:
Nikhil Badyal
2023-08-10 22:07:40 +05:30
parent 21912d99fe
commit a1b4563f41
+2 -2
View File
@@ -1,6 +1,5 @@
"""Revanced Patches."""
import json
import os
from typing import Any, Dict, List, Tuple
from loguru import logger
@@ -66,10 +65,11 @@ class Patches(object):
def scrap_patches(self, file_name: str) -> Any:
"""Scrap Patches."""
if os.path.exists(file_name):
try:
with open(file_name) as f:
patches = json.load(f)
return patches
except FileNotFoundError:
raise PatchesJsonFailed()
# noinspection DuplicatedCode