summaryrefslogtreecommitdiff
path: root/python/update.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/update.py')
-rw-r--r--python/update.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/python/update.py b/python/update.py
index 308094f7..f88770fd 100644
--- a/python/update.py
+++ b/python/update.py
@@ -20,6 +20,7 @@
import traceback
import ctypes
+from typing import Any, Optional
# Binary Ninja components
import binaryninja
@@ -65,6 +66,23 @@ class _UpdateChannelMetaClass(type):
raise KeyError("'%s' is not a valid channel" % str(name))
return result
+ def __contains__(cls: '_UpdateChannelMetaClass', name: object) -> bool:
+ if not isinstance(name, str):
+ return False
+ try:
+ cls[name]
+ return True
+ except KeyError:
+ return False
+
+ def get(cls: '_UpdateChannelMetaClass', name: str, default: Any = None) -> Optional['UpdateChannel']:
+ try:
+ return cls[name]
+ except KeyError:
+ if default is not None:
+ return default
+ return None
+
class UpdateProgressCallback:
def __init__(self, func):