summaryrefslogtreecommitdiff
path: root/python/languagerepresentation.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/languagerepresentation.py')
-rw-r--r--python/languagerepresentation.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/python/languagerepresentation.py b/python/languagerepresentation.py
index b7dc840d..ba5c44d0 100644
--- a/python/languagerepresentation.py
+++ b/python/languagerepresentation.py
@@ -20,7 +20,7 @@
import ctypes
import traceback
-from typing import List, Optional, Union
+from typing import List, Optional, Union, Any
# Binary Ninja components
import binaryninja
@@ -664,6 +664,23 @@ class _LanguageRepresentationFunctionTypeMetaClass(type):
raise KeyError("'%s' is not a valid language" % str(value))
return CoreLanguageRepresentationFunctionType(handle=lang)
+ def __contains__(cls: '_LanguageRepresentationFunctionTypeMetaClass', name: object) -> bool:
+ if not isinstance(name, str):
+ return False
+ try:
+ cls[name]
+ return True
+ except KeyError:
+ return False
+
+ def get(cls: '_LanguageRepresentationFunctionTypeMetaClass', name: str, default: Any = None) -> Optional['LanguageRepresentationFunctionType']:
+ try:
+ return cls[name]
+ except KeyError:
+ if default is not None:
+ return default
+ return None
+
class LanguageRepresentationFunctionType(metaclass=_LanguageRepresentationFunctionTypeMetaClass):
"""