Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions python_tools/generate_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
from absl import logging

# robotpy
import hal
import hal.simulation
import ntcore
import pyfrc
import wpilib
Expand Down Expand Up @@ -87,8 +85,6 @@ def main(argv):
pathlib.Path(f'{FLAGS.output_directory}/generated/').mkdir(parents=True, exist_ok=True)

robotpy_modules = [
hal,
hal.simulation,
ntcore,
wpilib,
wpilib.counter,
Expand Down
26 changes: 16 additions & 10 deletions python_tools/json_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
import python_util


_LIST_MODULE_NAME_PREFIXES_TO_IGNORE = [
'hal',
'ntcore',
'wpinet',
'wpiutil',
]

_KEY_MODULES = 'modules'
_KEY_CLASSES = 'classes'
_KEY_MODULE_NAME = 'moduleName'
Expand Down Expand Up @@ -103,6 +110,13 @@ def getModuleName(m) -> str:
return _DICT_FULL_MODULE_NAME_TO_MODULE_NAME.get(module_name, module_name)


def ignoreModule(module_name: str) -> bool:
for prefix in _LIST_MODULE_NAME_PREFIXES_TO_IGNORE:
if module_name.startswith(prefix):
return True
return False


def getClassName(c, containing_class_name: str = None) -> str:
if inspect.isclass(c):
full_class_name = python_util.getFullClassName(c)
Expand Down Expand Up @@ -250,11 +264,7 @@ def _processModules(self):
set_of_modules.add(module)
for module in set_of_modules:
module_name = getModuleName(module)
if module_name.startswith('ntcore'):
continue
if module_name.startswith('wpinet'):
continue
if module_name.startswith('wpiutil'):
if ignoreModule(module_name):
continue
#if not hasattr(module, '__all__'):
# print(f'Skipping module {getModuleName(module)}')
Expand Down Expand Up @@ -464,11 +474,7 @@ def _processClasses(self):
if python_util.isEnum(cls):
continue
module_name = getModuleName(cls.__module__)
if module_name.startswith('ntcore'):
continue
if module_name.startswith('wpinet'):
continue
if module_name.startswith('wpiutil'):
if ignoreModule(module_name):
continue
#module = python_util.getModule(module_name)
#if not hasattr(module, '__all__'):
Expand Down
Loading