🎨 Use newer style of coding (#287)

This commit is contained in:
Nikhil Badyal
2023-08-15 21:49:22 +05:30
committed by GitHub
parent 4f5806a773
commit bc723fe850
3 changed files with 34 additions and 35 deletions
+5 -5
View File
@@ -1,4 +1,6 @@
"""Revanced Patches."""
import contextlib
import json
from typing import Any, Dict, List, Tuple
@@ -114,10 +116,8 @@ class Patches(object):
raise AppNotFound(app)
patches = getattr(self, app_name)
version = "latest"
try:
with contextlib.suppress(StopIteration):
version = next(i["version"] for i in patches if i["version"] != "all")
except StopIteration:
pass
return patches, version
def include_exclude_patch(
@@ -174,5 +174,5 @@ class PatchLoader:
with open(file_name) as f:
patches = json.load(f)
return patches
except FileNotFoundError:
raise PatchesJsonFailed()
except FileNotFoundError as e:
raise PatchesJsonFailed() from e