From 95853bb603efacc9890f2b86bd28b0377e448ee5 Mon Sep 17 00:00:00 2001 From: ThanosApollo Date: Thu, 1 Sep 2022 07:46:56 +0300 Subject: Re-add anki addons --- .../Anki2/addons21/anki_reworked/utils/modules.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .local/share/Anki2/addons21/anki_reworked/utils/modules.py (limited to '.local/share/Anki2/addons21/anki_reworked/utils/modules.py') diff --git a/.local/share/Anki2/addons21/anki_reworked/utils/modules.py b/.local/share/Anki2/addons21/anki_reworked/utils/modules.py new file mode 100644 index 0000000..fc55a12 --- /dev/null +++ b/.local/share/Anki2/addons21/anki_reworked/utils/modules.py @@ -0,0 +1,18 @@ +def module_exists(module_name): + try: + __import__(module_name) + except ImportError: + return False + else: + return True + +def module_has_attribute(module_name, attribute): + if module_exists(module_name): + return hasattr(__import__(module_name), attribute) + return False + +def attribute_exists(object, attribute): + return attribute in object.__dict__ + +def context_name_includes(context, classname): + return classname in str(context.__class__) \ No newline at end of file -- cgit v1.2.3