|
25 | 25 | import python_util |
26 | 26 |
|
27 | 27 |
|
| 28 | +_LIST_MODULE_NAME_PREFIXES_TO_IGNORE = [ |
| 29 | + 'hal', |
| 30 | + 'ntcore', |
| 31 | + 'wpinet', |
| 32 | + 'wpiutil', |
| 33 | +] |
| 34 | + |
28 | 35 | _KEY_MODULES = 'modules' |
29 | 36 | _KEY_CLASSES = 'classes' |
30 | 37 | _KEY_MODULE_NAME = 'moduleName' |
@@ -103,6 +110,13 @@ def getModuleName(m) -> str: |
103 | 110 | return _DICT_FULL_MODULE_NAME_TO_MODULE_NAME.get(module_name, module_name) |
104 | 111 |
|
105 | 112 |
|
| 113 | +def ignoreModule(module_name: str) -> bool: |
| 114 | + for prefix in _LIST_MODULE_NAME_PREFIXES_TO_IGNORE: |
| 115 | + if module_name.startswith(prefix): |
| 116 | + return True |
| 117 | + return False |
| 118 | + |
| 119 | + |
106 | 120 | def getClassName(c, containing_class_name: str = None) -> str: |
107 | 121 | if inspect.isclass(c): |
108 | 122 | full_class_name = python_util.getFullClassName(c) |
@@ -250,11 +264,7 @@ def _processModules(self): |
250 | 264 | set_of_modules.add(module) |
251 | 265 | for module in set_of_modules: |
252 | 266 | module_name = getModuleName(module) |
253 | | - if module_name.startswith('ntcore'): |
254 | | - continue |
255 | | - if module_name.startswith('wpinet'): |
256 | | - continue |
257 | | - if module_name.startswith('wpiutil'): |
| 267 | + if ignoreModule(module_name): |
258 | 268 | continue |
259 | 269 | #if not hasattr(module, '__all__'): |
260 | 270 | # print(f'Skipping module {getModuleName(module)}') |
@@ -464,11 +474,7 @@ def _processClasses(self): |
464 | 474 | if python_util.isEnum(cls): |
465 | 475 | continue |
466 | 476 | module_name = getModuleName(cls.__module__) |
467 | | - if module_name.startswith('ntcore'): |
468 | | - continue |
469 | | - if module_name.startswith('wpinet'): |
470 | | - continue |
471 | | - if module_name.startswith('wpiutil'): |
| 477 | + if ignoreModule(module_name): |
472 | 478 | continue |
473 | 479 | #module = python_util.getModule(module_name) |
474 | 480 | #if not hasattr(module, '__all__'): |
|
0 commit comments