sarlinpe · GitHub

Maybe something to consider. To avoid importing internal symbols, the following code snippet reduces the risk of name conflicts and keeps the pycolmap namespace clean:

from . import _core as _core_module
# Loop over all the members of the module, adding the symbols to the current
# module's namespace (i.e., pycolmap package's), and skipping internal symbols
# (names starting with '_').
for _name, _symbol in vars(_core_module).items():
    if not _name.startswith("_"):
        globals()[_name] = _symbol
# Cleanup.
del _core_module, _name, _symbol

This solution ensures that only the relevant symbols from _core are shown, without explicitly listing pycolmap._core when using help(pycolmap). Please note that I haven't tested this.

Read the original on github.com ↗