Created
March 29, 2023 18:15
-
-
Save remia/fe3fe6fddeff30d53631bae6317dc668 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import importlib | |
from inspect import getmembers, isfunction | |
from clairmeta.settings import DCP_CHECK_SETTINGS | |
all_checks = {} | |
prefix = DCP_CHECK_SETTINGS['module_prefix'] | |
for k, v in DCP_CHECK_SETTINGS['modules'].items(): | |
try: | |
module_path = 'clairmeta.' + prefix + k | |
module = importlib.import_module(module_path) | |
funcs = getmembers(module.Checker, isfunction) | |
funcs = [f for f in funcs if f[0].startswith("check_")] | |
checks = [(f[0], f[1].__doc__) for f in funcs] | |
all_checks[module.__name__] = checks | |
except Exception as e: | |
print(str(e)) | |
with open('result.json', 'w') as fp: | |
json.dump(all_checks, fp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment